]> gerrit.simantics Code Review - simantics/3d.git/blob
62713e2ab9e530fd9d0f95324717913410509fde
[simantics/3d.git] /
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.proconf.g3d.shapeeditor.handlers;\r
12 \r
13 import org.simantics.db.Graph;\r
14 import org.simantics.db.Resource;\r
15 import org.simantics.proconf.g3d.shapeeditor.Activator;\r
16 import org.simantics.proconf.g3d.shapeeditor.ShapeEditorResources;\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 public class ResourceEditorAdapter3 extends SimpleEditorAdapter {\r
24 \r
25         public ResourceEditorAdapter3() {\r
26                 super("Parameterization Editor",\r
27                         BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/unlink.png"),\r
28                         null,null,null);\r
29         }\r
30 \r
31         @Override\r
32         public boolean canHandle(Graph g, Resource r) {\r
33                 if(ShapeEditorResources.csgResource == null) return false; \r
34                 if(ShapeEditorResources.csgResource.CSGModel == null) return false; \r
35                 return g.isInstanceOf(r, ShapeEditorResources.csgResource.CSGModel);\r
36         }\r
37 \r
38 \r
39         @Override\r
40         public void openEditor(Resource r) throws Exception {\r
41                 WorkbenchUtils.openEditor("org.simantics.proconf.shapeeditor.editor3", new ResourceEditorInput("org.simantics.proconf.shapeeditor.editor3",r));\r
42 \r
43         }\r
44 \r
45 }\r