From: Reino Ruusu Date: Tue, 7 Apr 2020 10:17:21 +0000 (+0300) Subject: Hide insertion position controls when adding to a connected pipe X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=6bdca885df3dd6e0ff4d0baccffd98f7b94833aa;p=simantics%2F3d.git Hide insertion position controls when adding to a connected pipe gitlab #112 Change-Id: Ifebee86babe1a869e9dec1bffe4efaa47aa454d5 --- diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/dialog/ComponentSelectionDialog.java b/org.simantics.plant3d/src/org/simantics/plant3d/dialog/ComponentSelectionDialog.java index df00bc39..56a81c49 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/dialog/ComponentSelectionDialog.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/dialog/ComponentSelectionDialog.java @@ -297,6 +297,11 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange updateInsertPosition(PositionType.NEXT); } }); + + if (!hasInsertPosition()) { + label.setVisible(false); + buttonComposite.setVisible(false); + } label = new Label(composite, SWT.NONE); label.setText("Name"); @@ -431,6 +436,10 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange return composite; } + private boolean hasInsertPosition() { + return component.getNext() == null || component.getPrevious() == null; + } + private void updateInsertPosition(PositionType type) { if (insertPosition == type) return; @@ -488,7 +497,7 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange lenghtAdjustable = ((selected.getType() == Type.INLINE) && (selected.isVariable() || selected.isModifiable())); - if (component.getNext() != null && component.getPrevious() != null) { + if (!hasInsertPosition()) { // We are inserting to a fully connected variable length component // only allow insertion within the component startButton.setEnabled(false);