X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.plant3d%2Fsrc%2Forg%2Fsimantics%2Fplant3d%2Fdialog%2FComponentSelectionDialog.java;h=00b52f3bb1073b0e12e1cb43dd64b5b18f47b97d;hb=f8e541f1d66cda57802da11aaa715b9f9c1c79a9;hp=7c124eb0ecb269076d4979bc1155305befc385dd;hpb=9817ec2aa0d2afada7024d2aba0cd7562de317ed;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 7c124eb0..00b52f3b 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/dialog/ComponentSelectionDialog.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/dialog/ComponentSelectionDialog.java @@ -62,16 +62,23 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange private Double angle; private Double length; + private Double rotationAngle; + // In-line component private Text lengthText; + // Turn component private Text angleText; + // Rotated In-line, or turn conponent. + private Text rotationAngleText; + // Input for new PipeRun private Double diameter; private Double turnRadius; private Text diameterText; private Text turnRadiusText; + // Position selection private Button startButton; private Button middleButton; private Button endButton; @@ -198,6 +205,9 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange startButton.setImage(resourceManager.createImage(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/insert_start.png"))); middleButton.setImage(resourceManager.createImage(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/insert_middle.png"))); endButton.setImage(resourceManager.createImage(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/insert_end.png"))); + startButton.setToolTipText("Overlapping insert"); + middleButton.setToolTipText("Cutting insert"); + endButton.setToolTipText("Adding insert"); GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.TOP).applyTo(buttonComposite); GridLayoutFactory.fillDefaults().numColumns(3).applyTo(buttonComposite); @@ -232,6 +242,9 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange label = new Label(composite, SWT.NONE); label.setText("Angle"); angleText = new Text(composite, SWT.SINGLE|SWT.BORDER); + label = new Label(composite, SWT.NONE); + label.setText("Rotation angle"); + rotationAngleText = new Text(composite, SWT.SINGLE|SWT.BORDER); label = new Label(composite, SWT.NONE); label.setText("Diameter"); @@ -242,9 +255,11 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange lengthText.setEnabled(false); angleText.setEnabled(false); + rotationAngleText.setEnabled(false); turnRadiusText.setEnabled(false); diameterText.setEnabled(false); + lengthText.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { @@ -269,6 +284,18 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange } }); + rotationAngleText.addKeyListener(new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + try { + rotationAngle = Double.parseDouble(rotationAngleText.getText()); + } catch (NumberFormatException err) { + rotationAngle = null; + } + validate(); + } + }); + diameterText.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { @@ -295,6 +322,7 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.TOP).applyTo(lengthText); GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.TOP).applyTo(angleText); + GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.TOP).applyTo(rotationAngleText); GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.TOP).applyTo(diameterText); GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.TOP).applyTo(turnRadiusText); @@ -409,14 +437,16 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange if (selected.getType() == Type.INLINE) { filterAllowed.add(PositionType.NEXT); filterAllowed.add(PositionType.PREVIOUS); - if (inlineSplit) { + if (inlineSplit && selected.isVariable()) { lengthText.setEnabled(false); angleText.setEnabled(false); + rotationAngleText.setEnabled(selected.isRotated()); ok = false; } else { lengthText.setEnabled(true); angleText.setEnabled(false); + rotationAngleText.setEnabled(selected.isRotated()); if (length == null) ok = false; } @@ -425,16 +455,20 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange filterAllowed.add(PositionType.PREVIOUS); lengthText.setEnabled(false); angleText.setEnabled(true); + rotationAngleText.setEnabled(true); if (angle == null) ok = false; } else { - // this should not happen + // this should not happen, since end components should not have variable, or modifiable flag. lengthText.setEnabled(false); angleText.setEnabled(false); + rotationAngleText.setEnabled(false); + } } else { lengthText.setEnabled(false); - angleText.setEnabled(false); + angleText.setEnabled(false); + rotationAngleText.setEnabled(selected.getType() == Type.TURN || selected.isRotated()); } if (selected.isSizeChange()) { @@ -495,6 +529,10 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange return length; } + public Double getRotationAngle() { + return rotationAngle; + } + public Double getDiameter() { return diameter; }