1 package org.simantics.processeditor.views;
\r
3 import java.util.Collection;
\r
5 import org.eclipse.swt.widgets.Display;
\r
6 import org.simantics.db.Graph;
\r
7 import org.simantics.db.Resource;
\r
8 import org.simantics.db.management.ISessionContext;
\r
9 import org.simantics.processeditor.ProcessResource;
\r
10 import org.simantics.processeditor.tools.ControlPointContribution;
\r
11 import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;
\r
12 import org.simantics.proconf.g3d.base.ThreeDimensionalEditorPart;
\r
13 import org.simantics.proconf.g3d.shapeeditor.views.ShapeEditorBase;
\r
16 public class PipelineComponentEditorPart extends ThreeDimensionalEditorPart {
\r
19 protected ThreeDimensionalEditorBase createEditor(ISessionContext session) {
\r
20 ShapeEditorBase base = new ShapeEditorBase(session);
\r
21 base.addEditorContribution(new ControlPointContribution(base));
\r
26 public void reload(Graph g) {
\r
27 Resource inputResource = getInputResource();
\r
28 Collection<Resource> model = g.getObjects(inputResource, ProcessResource.plant3Dresource.HasGraphics);
\r
29 if (model.size() != 1)
\r
30 throw new RuntimeException("Cannot find model for pipeline component " + inputResource);
\r
31 Resource modelResource = model.iterator().next();
\r
32 if (modelResource != null) {
\r
33 editor.reload(g,modelResource);
\r
36 Display d = getSite().getShell().getDisplay();
\r
37 d.asyncExec(new Runnable() {
\r
39 editor.showMessage("Failed to load model.");
\r
40 getSite().getPage().closeEditor(PipelineComponentEditorPart.this,false);
\r