From 6bdca885df3dd6e0ff4d0baccffd98f7b94833aa Mon Sep 17 00:00:00 2001 From: Reino Ruusu Date: Tue, 7 Apr 2020 13:17:21 +0300 Subject: [PATCH] Hide insertion position controls when adding to a connected pipe gitlab #112 Change-Id: Ifebee86babe1a869e9dec1bffe4efaa47aa454d5 --- .../plant3d/dialog/ComponentSelectionDialog.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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); -- 2.45.2