1 | package de.uka.ipd.sdq.sensorframework.visualisation.menu; |
2 | |
3 | import org.eclipse.jface.action.Action; |
4 | import org.eclipse.ui.IWorkbenchPage; |
5 | import org.eclipse.ui.PartInitException; |
6 | |
7 | import de.uka.ipd.sdq.sensorframework.visualisation.VisualisationPlugin; |
8 | import de.uka.ipd.sdq.sensorframework.visualisation.editor.ConfigEditorInput; |
9 | |
10 | public class OpenAction extends Action { |
11 | |
12 | private String editorID; |
13 | private String adapterFactoryID; |
14 | |
15 | public OpenAction(String label, String adapterFactoryID, String editorID){ |
16 | super(label); |
17 | this.editorID = editorID; |
18 | this.adapterFactoryID = adapterFactoryID; |
19 | } |
20 | |
21 | @Override |
22 | public void run() { |
23 | IWorkbenchPage page = VisualisationPlugin.getDefault().getWorkbench() |
24 | .getActiveWorkbenchWindow().getActivePage(); |
25 | |
26 | try { |
27 | page.openEditor(new ConfigEditorInput(adapterFactoryID), |
28 | editorID); |
29 | } catch (PartInitException e) { |
30 | // TODO Auto-generated catch block |
31 | e.printStackTrace(); |
32 | } |
33 | } |
34 | |
35 | } |