1 package fi.vtt.simantics.processeditor.handlers;
\r
3 import org.simantics.db.Graph;
\r
4 import org.simantics.db.Resource;
\r
5 import org.simantics.proconf.ui.workbench.ResourceEditorInput;
\r
6 import org.simantics.proconf.ui.workbench.editor.SimpleEditorAdapter;
\r
7 import org.simantics.utils.ui.BundleUtils;
\r
8 import org.simantics.utils.ui.workbench.WorkbenchUtils;
\r
10 import fi.vtt.simantics.processeditor.Activator;
\r
11 import fi.vtt.simantics.processeditor.ProcessResource;
\r
14 * EditorAdapter for PipeLineComponentEditor
\r
16 * @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>
\r
19 public class PipelineComponentEditorAdapter extends SimpleEditorAdapter {
\r
20 public PipelineComponentEditorAdapter() {
\r
21 super("Component Editor",
\r
22 BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/Component.png"),
\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.PipelineComponent)) {
\r
31 if (g.isInstanceOf(r, ProcessResource.plant3Dresource.Nozzle))
\r
35 if(g.isInstanceOf(r, ProcessResource.plant3Dresource.CodedComponent)) return false;
\r
41 public void openEditor(Resource r) throws Exception {
\r
42 WorkbenchUtils.openEditor("org.simantics.proconf.processeditor.componenteditor", new ResourceEditorInput("org.simantics.proconf.processeditor.componenteditor",r));
\r