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
9 * VTT Technical Research Centre of Finland - initial API and implementation
\r
10 *******************************************************************************/
\r
11 package org.simantics.processeditor.handlers;
\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
23 public class Plant3DEditorAdapter extends SimpleEditorAdapter {
\r
24 public Plant3DEditorAdapter() {
\r
25 super("PlantEditor",
\r
26 BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/factory.png"),
\r
31 public boolean canHandle(Graph g, Resource r) {
\r
32 if(ProcessResource.plant3Dresource == null) return false;
\r
33 if(ProcessResource.plant3Dresource.Plant == null) return false;
\r
34 return g.isInstanceOf(r, ProcessResource.plant3Dresource.Plant);
\r
39 public void openEditor(Resource r) throws Exception {
\r
40 WorkbenchUtils.openEditor("org.simantics.proconf.processeditor.planteditor", new ResourceEditorInput("org.simantics.proconf.processeditor.planteditor",r));
\r