X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.plant3d%2Fsrc%2Forg%2Fsimantics%2Fplant3d%2Fdialog%2FComponentSelectionDialog.java;h=df00bc39f468804efcde3b91afa6d133087c1000;hb=c66db4cc6b57647163cfb15db250525ff8e0e882;hp=da764775d509a3b17185e8ca76fe401c51e640e4;hpb=e30f145f533c87b5c784e44ee101cc7fbcd2538f;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 da764775..df00bc39 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/dialog/ComponentSelectionDialog.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/dialog/ComponentSelectionDialog.java @@ -134,6 +134,9 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange dialogSettings = settings.getSection(DIALOG); if (dialogSettings == null) dialogSettings = settings.addNewSection(DIALOG); + + if (component.getNext() != null && component.getPrevious() != null) + insertPosition = PositionType.PREVIOUS; } public void setLengthFactor(double lengthFactor) { @@ -267,6 +270,10 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange horizFillData.applyTo(buttonComposite); GridLayoutFactory.fillDefaults().numColumns(3).applyTo(buttonComposite); + startButton.setSelection(insertPosition == PositionType.PREVIOUS); + middleButton.setSelection(insertPosition == PositionType.SPLIT); + endButton.setSelection(insertPosition == PositionType.NEXT); + startButton.setEnabled(false); middleButton.setEnabled(false); endButton.setEnabled(false); @@ -290,7 +297,6 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange updateInsertPosition(PositionType.NEXT); } }); - endButton.setSelection(true); label = new Label(composite, SWT.NONE); label.setText("Name"); @@ -428,9 +434,9 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange private void updateInsertPosition(PositionType type) { if (insertPosition == type) return; - endButton.setSelection(type == PositionType.NEXT); - middleButton.setSelection(type == PositionType.SPLIT); startButton.setSelection(type == PositionType.PREVIOUS); + middleButton.setSelection(type == PositionType.SPLIT); + endButton.setSelection(type == PositionType.NEXT); insertPosition = type; } @@ -481,7 +487,15 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange } else { lenghtAdjustable = ((selected.getType() == Type.INLINE) && (selected.isVariable() || selected.isModifiable())); - if (insertAdjustable) { + + if (component.getNext() != null && component.getPrevious() != null) { + // We are inserting to a fully connected variable length component + // only allow insertion within the component + startButton.setEnabled(false); + middleButton.setEnabled(false); + endButton.setEnabled(false); + updateInsertPosition(PositionType.PREVIOUS); + } else if (insertAdjustable) { switch (selected.getType()) { case END: startButton.setEnabled(false); @@ -566,7 +580,7 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange rotationAngleText.setEnabled(true); if (angle == null) { ok = false; - if (msg == null) msg = "Please provide a rotation angle"; + if (msg == null) msg = "Please provide a turn angle"; } } else { // this should not happen, since end components should not have variable, or