]> gerrit.simantics Code Review - simantics/3d.git/blob
969fcad993e901cbf5a31b747649fab06f2ba517
[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 public class Plant3DEditorAdapter extends SimpleEditorAdapter {\r
14         public Plant3DEditorAdapter() {\r
15                 super("PlantEditor",\r
16                         BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/factory.png"),\r
17                         null,null,null);\r
18         }\r
19 \r
20         @Override\r
21         public boolean canHandle(Graph g, Resource r) {\r
22                 if(ProcessResource.plant3Dresource == null) return false; \r
23                 if(ProcessResource.plant3Dresource.Plant == null) return false; \r
24                 return g.isInstanceOf(r, ProcessResource.plant3Dresource.Plant);\r
25         }\r
26 \r
27 \r
28         @Override\r
29         public void openEditor(Resource r) throws Exception {\r
30                 WorkbenchUtils.openEditor("org.simantics.proconf.processeditor.planteditor", new ResourceEditorInput("org.simantics.proconf.processeditor.planteditor",r));\r
31 \r
32         }\r
33 \r
34 }\r