X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=org.simantics.plant3d%2Fsrc%2Forg%2Fsimantics%2Fplant3d%2Feditor%2FPlant3DEditor.java;h=5d755d06f7e3d6b74f704365d1c8dc06c452551b;hb=3d51c0d674afdad4413a16ac104ee111c7031dfc;hp=53a0ed2c78ed1298bca72e551986d2fe2f3cd8fc;hpb=4a656971025eea4b563933179d6120d0e87e7549;p=simantics%2F3d.git diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/editor/Plant3DEditor.java b/org.simantics.plant3d/src/org/simantics/plant3d/editor/Plant3DEditor.java index 53a0ed2c..5d755d06 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/editor/Plant3DEditor.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/editor/Plant3DEditor.java @@ -46,6 +46,7 @@ import org.simantics.plant3d.actions.AddComponentAction; import org.simantics.plant3d.actions.AddEquipmentAction; import org.simantics.plant3d.actions.AddNozzleAction; import org.simantics.plant3d.actions.RemoveAndSplitAction; +import org.simantics.plant3d.actions.ReversePipeRunAction; import org.simantics.plant3d.actions.RoutePipeAction; import org.simantics.plant3d.actions.TranslateFreeVariableLengthAction; import org.simantics.plant3d.actions.TranslateInlineAction; @@ -56,6 +57,7 @@ import org.simantics.plant3d.scenegraph.IP3DNode; import org.simantics.plant3d.scenegraph.InlineComponent; import org.simantics.plant3d.scenegraph.Nozzle; import org.simantics.plant3d.scenegraph.P3DRootNode; +import org.simantics.plant3d.scenegraph.PipeRun; import org.simantics.plant3d.scenegraph.PipelineComponent; import org.simantics.plant3d.scenegraph.SchemaBuilder; import org.simantics.plant3d.scenegraph.TurnComponent; @@ -82,7 +84,6 @@ import vtk.vtkRenderer; import vtk.vtkSSAAPass; import vtk.vtkSequencePass; import vtk.vtkSimpleMotionBlurPass; -import vtk.vtkSobelGradientMagnitudePass; public class Plant3DEditor extends ResourceEditorPart { @@ -109,6 +110,7 @@ public class Plant3DEditor extends ResourceEditorPart { protected RemoveAndSplitAction removeSplitAction; protected RoutePipeAction routePipeAction; protected AddComponentAction addComponentAction; + protected ReversePipeRunAction reversePipeRunAction; private P3DNodeMap nodeMap; @@ -230,12 +232,12 @@ public class Plant3DEditor extends ResourceEditorPart { return new NodeSelectionProvider2(this,mapping,nodeMap); } - protected HoverHighlighter createHoverHighlhighter() { - return new HoverHighlighter(panel,nodeMap); + protected HoverHighlighter createHoverHighlhighter() { + return new HoverHighlighter<>(panel,nodeMap); } - protected SelectionHighlighter createSelectionHighlighter() { - return new SelectionHighlighter(panel,nodeMap); + protected SelectionHighlighter createSelectionHighlighter() { + return new SelectionHighlighter(panel,nodeMap); } protected String getLibraryUri() { @@ -252,6 +254,7 @@ public class Plant3DEditor extends ResourceEditorPart { removeSplitAction = new RemoveAndSplitAction(nodeMap); routePipeAction = new RoutePipeAction(panel,rootNode); addComponentAction = new AddComponentAction(panel, rootNode, getLibraryUri()); + reversePipeRunAction = new ReversePipeRunAction(nodeMap); } public void populate() { @@ -455,6 +458,10 @@ public class Plant3DEditor extends ResourceEditorPart { m.add(removeAction); m.add(removeSplitAction); removeSplitAction.setNode(node); + } else if (node instanceof PipeRun) { + m.add(reversePipeRunAction); + m.add(removeAction); + reversePipeRunAction.setNode(node); } else { m.add(removeAction); } @@ -491,30 +498,29 @@ public class Plant3DEditor extends ResourceEditorPart { return outlinePage; } - @SuppressWarnings("rawtypes") @Override - public Object getAdapter(Class adapter) { - if (IPropertyPage.class.equals(adapter)) - return new StandardPropertyPage(getSite(),getPropertyContexts()); - if (IContentOutlinePage.class.equals(adapter)) { - return createOutline(); + public T getAdapter(Class adapter) { + if (adapter.isAssignableFrom(IPropertyPage.class)) + return adapter.cast(new StandardPropertyPage(getSite(),getPropertyContexts())); + if (adapter.isAssignableFrom(ISelectionProvider.class)) + return adapter.cast(selectionProvider); + if (adapter.isAssignableFrom(IContentOutlinePage.class)) { + return adapter.cast(createOutline()); } - if (NodeMap.class.equals(adapter)) { - return nodeMap; + if (adapter.isAssignableFrom(NodeMap.class)) { + return adapter.cast(nodeMap); } - if (INode.class.equals(adapter)) { - return rootNode; + if (adapter.isAssignableFrom(INode.class)) { + return adapter.cast(rootNode); } - if (IMapping.class.equals(adapter)) { - return mapping; + if (adapter.isAssignableFrom(IMapping.class)) { + return adapter.cast(mapping); } -// if (InteractiveVtkPanel.class.equals(adapter)) { -// return panel; +// if (adapter.isAssignableFrom(InteractiveVtkPanel.class)) { +// return adapter.cast(panel); // } - if (VtkView.class.equals(adapter)) - return panel; - if (ISelectionProvider.class.equals(adapter)) - return selectionProvider; + if (adapter.isAssignableFrom(VtkView.class)) + return adapter.cast(panel); return super.getAdapter(adapter); }