]> gerrit.simantics Code Review - simantics/3d.git/blob - org.simantics.proconf.processeditor/src/org/simantics/processeditor/handlers/PipelineComponentEditorAdapter.java
Set copyright texts for java files in the latest development branches.
[simantics/3d.git] / org.simantics.proconf.processeditor / src / org / simantics / processeditor / handlers / PipelineComponentEditorAdapter.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
3  * All rights reserved. This program and the accompanying materials\r
4  * are made available under the terms of the Eclipse Public License v1.0\r
5  * which accompanies this distribution, and is available at\r
6  * http://www.eclipse.org/legal/epl-v10.html\r
7  *\r
8  * Contributors:\r
9  *     VTT Technical Research Centre of Finland - initial API and implementation\r
10  *******************************************************************************/\r
11 package org.simantics.processeditor.handlers;\r
12 \r
13 import org.simantics.db.Graph;\r
14 import org.simantics.db.Resource;\r
15 import org.simantics.processeditor.Activator;\r
16 import org.simantics.processeditor.ProcessResource;\r
17 import org.simantics.proconf.ui.workbench.ResourceEditorInput;\r
18 import org.simantics.proconf.ui.workbench.editor.SimpleEditorAdapter;\r
19 import org.simantics.utils.ui.BundleUtils;\r
20 import org.simantics.utils.ui.workbench.WorkbenchUtils;\r
21 \r
22 \r
23 /**\r
24  * EditorAdapter for PipeLineComponentEditor\r
25  * \r
26  * @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>\r
27  *\r
28  */\r
29 public class PipelineComponentEditorAdapter extends SimpleEditorAdapter {\r
30         public PipelineComponentEditorAdapter() {\r
31                 super("Component Editor",\r
32                         BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/Component.png"),\r
33                         null,null,null);\r
34         }\r
35 \r
36         @Override\r
37         public boolean canHandle(Graph g, Resource r) {\r
38                 if(ProcessResource.plant3Dresource == null) return false; \r
39                 if(ProcessResource.plant3Dresource.Plant == null) return false; \r
40                 if(!g.isInstanceOf(r, ProcessResource.plant3Dresource.PipelineComponent)) {\r
41                         if (g.isInstanceOf(r, ProcessResource.plant3Dresource.Nozzle))\r
42                                 return true;\r
43                         return false;\r
44                 }\r
45                 if(g.isInstanceOf(r, ProcessResource.plant3Dresource.CodedComponent)) return false;\r
46                 return true;\r
47         }\r
48 \r
49 \r
50         @Override\r
51         public void openEditor(Resource r) throws Exception {\r
52                 WorkbenchUtils.openEditor("org.simantics.proconf.processeditor.componenteditor", new ResourceEditorInput("org.simantics.proconf.processeditor.componenteditor",r));\r
53         }\r
54 \r
55 }\r