X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.plant3d%2Fsrc%2Forg%2Fsimantics%2Fplant3d%2Fdialog%2FComponentSelectionDialog.java;h=56a81c49ccf961cbe7badc3be85edf48313bfdfc;hb=4d7a89228bcee0f588fcceb9821f676b8cf08383;hp=df00bc39f468804efcde3b91afa6d133087c1000;hpb=1c22d60d859f73fe6320ff1ed1cc6f753752d97a;p=simantics%2F3d.git 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);