X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.plant3d%2Fsrc%2Forg%2Fsimantics%2Fplant3d%2Factions%2FAddComponentAction.java;h=a39d84c8ebd31d7706d2848472c38464ce3293a6;hb=53d55c24c779745f188bdb18d32f71d20acb61b2;hp=defee7024561616c386089806168175f591399cc;hpb=f36217aeeb09c0c46f99886ee99772156ce9cfe6;p=simantics%2F3d.git diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java b/org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java index defee702..a39d84c8 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java @@ -64,19 +64,19 @@ public class AddComponentAction extends vtkSwtAction { allowed.clear(); if (component instanceof Nozzle) { - if (component.getNext() == null && component.getPrevious() == null) { - allowed.add(PositionType.NEXT); - } + if (component.getNext() == null && component.getPrevious() == null) { + allowed.add(PositionType.NEXT); + } } else { - if (component.getNext() == null) { - allowed.add(PositionType.NEXT); - } - if (component.getPrevious() == null) { - allowed.add(PositionType.PREVIOUS); - } - if (component instanceof InlineComponent && !component.getControlPoint().isFixed()){ - allowed.add(PositionType.SPLIT); - } + if (component.getNext() == null) { + allowed.add(PositionType.NEXT); + } + if (component.getPrevious() == null) { + allowed.add(PositionType.PREVIOUS); + } + if (component instanceof InlineComponent && !component.getControlPoint().isFixed()){ + allowed.add(PositionType.SPLIT); + } } setEnabled(allowed.size() > 0); } @@ -88,7 +88,7 @@ public class AddComponentAction extends vtkSwtAction { @Override public void run() { - + ComponentSelectionDialog dialog = new ComponentSelectionDialog(Display.getCurrent().getActiveShell(), allowed, component); if (dialog.open() == ComponentSelectionDialog.CANCEL) return; @@ -169,19 +169,19 @@ public class AddComponentAction extends vtkSwtAction { } public void doInsert(PositionType position) { - try { - InsertInstruction inst = new InsertInstruction(); - inst.typeUri = toAdd.getUri(); - inst.angle = angle; - inst.diameter = diameter; - inst.length = length; - inst.turnRadius = turnRadius; - inst.insertPosition = insertPosition; - inst.position = position; - ComponentUtils.addComponent(root, component, inst); - } catch (Exception e) { - ExceptionUtils.logAndShowError("Cannot add component", e); - } + try { + InsertInstruction inst = new InsertInstruction(); + inst.typeUri = toAdd.getUri(); + inst.angle = angle; + inst.diameter = diameter; + inst.length = length; + inst.turnRadius = turnRadius; + inst.insertPosition = insertPosition; + inst.position = position; + ComponentUtils.addComponent(root, component, inst); + } catch (Exception e) { + ExceptionUtils.logAndShowError("Cannot add component", e); + } // try { // PipelineComponent newComponent = ComponentUtils.createComponent(root,toAdd.getUri()); // PipeControlPoint newPcp = newComponent.getControlPoint(); @@ -360,6 +360,6 @@ public class AddComponentAction extends vtkSwtAction { @Override public boolean mouseWheelMoved(MouseWheelEvent e) { - return getDefaultAction().mouseWheelMoved(e); + return getDefaultAction().mouseWheelMoved(e); } }