]> gerrit.simantics Code Review - simantics/3d.git/blob
b9267ba1446c2c2818d8aa968e1adaa645e7307b
[simantics/3d.git] /
1 package org.simantics.processeditor.handlers;\r
2 \r
3 import org.simantics.db.Graph;\r
4 import org.simantics.db.Resource;\r
5 import org.simantics.processeditor.Activator;\r
6 import org.simantics.processeditor.ProcessResource;\r
7 import org.simantics.proconf.ui.workbench.ResourceEditorInput;\r
8 import org.simantics.proconf.ui.workbench.editor.SimpleEditorAdapter;\r
9 import org.simantics.utils.ui.BundleUtils;\r
10 import org.simantics.utils.ui.workbench.WorkbenchUtils;\r
11 \r
12 \r
13 /**\r
14  * EditorAdapter for EquipmentEditor\r
15  * \r
16  * @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>\r
17  *\r
18  */\r
19 public class EquipmentEditorAdapter extends SimpleEditorAdapter {\r
20         public EquipmentEditorAdapter() {\r
21                 super("Equipment Editor",\r
22                         BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/tank.png"),\r
23                         null,null,null);\r
24         }\r
25 \r
26         @Override\r
27         public boolean canHandle(Graph g, Resource r) {\r
28                 if(ProcessResource.plant3Dresource == null) return false; \r
29                 if(ProcessResource.plant3Dresource.Plant == null) return false; \r
30                 if(!g.isInstanceOf(r, ProcessResource.plant3Dresource.Equipment)) return false;\r
31                 return true;\r
32         }\r
33 \r
34 \r
35         @Override\r
36         public void openEditor(Resource r) throws Exception {\r
37                 WorkbenchUtils.openEditor("org.simantics.proconf.processeditor.equipmenteditor", new ResourceEditorInput("org.simantics.proconf.processeditor.equipmenteditor",r));\r
38         }\r
39 \r
40 }\r