]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Hide insertion position controls when adding to a connected pipe 17/4117/1
authorReino Ruusu <reino.ruusu@semantum.fi>
Tue, 7 Apr 2020 10:17:21 +0000 (13:17 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 7 Apr 2020 10:28:06 +0000 (10:28 +0000)
gitlab #112

Change-Id: Ifebee86babe1a869e9dec1bffe4efaa47aa454d5
(cherry picked from commit 6bdca885df3dd6e0ff4d0baccffd98f7b94833aa)

org.simantics.plant3d/src/org/simantics/plant3d/dialog/ComponentSelectionDialog.java

index df00bc39f468804efcde3b91afa6d133087c1000..56a81c49ccf961cbe7badc3be85edf48313bfdfc 100644 (file)
@@ -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);