]> gerrit.simantics Code Review - simantics/3d.git/blob
41f07ade59fd3a388a21cf15eba7e3514a43180e
[simantics/3d.git] /
1 /*******************************************************************************\r
2  * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.proconf.g3d.shapeeditor.Activator;\r
14 import org.simantics.proconf.g3d.shapeeditor.ShapeEditorResources;\r
15 import org.simantics.proconf.ui.workbench.ResourceEditorInput;\r
16 import org.simantics.proconf.ui.workbench.editor.SimpleEditorAdapter;\r
17 \r
18 import org.simantics.db.Graph;\r
19 import org.simantics.db.Resource;\r
20 import org.simantics.utils.ui.BundleUtils;\r
21 import org.simantics.utils.ui.workbench.WorkbenchUtils;\r
22 \r
23 \r
24 public class ResourceEditorAdapter1 extends SimpleEditorAdapter {\r
25 \r
26         public ResourceEditorAdapter1() {\r
27                 super("ShapeEditor",\r
28                         BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/union.png"),\r
29                         null,null,null);\r
30         }\r
31 \r
32         @Override\r
33         public boolean canHandle(Graph g, Resource r) {\r
34                 if(ShapeEditorResources.csgResource == null) return false; \r
35                 if(ShapeEditorResources.csgResource.CSGModel == null) return false; \r
36                 return g.isInstanceOf(r, ShapeEditorResources.csgResource.CSGModel);\r
37         }\r
38 \r
39 \r
40         @Override\r
41         public void openEditor(Resource r) throws Exception {\r
42                 WorkbenchUtils.openEditor("org.simantics.proconf.shapeeditor.editor1", new ResourceEditorInput("org.simantics.proconf.shapeeditor.editor1",r));\r
43 \r
44         }\r
45 \r
46 }\r