]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/dialog/ComponentSelectionDialog.java
Replace "turn" with "elbow" in component creation UI
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / dialog / ComponentSelectionDialog.java
index df00bc39f468804efcde3b91afa6d133087c1000..cce00075faf8b1940ab2da5988f4dbbad5d92df3 100644 (file)
@@ -222,7 +222,7 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange
                inlineViewer.setContentProvider(new ComponentContentProvider());
 
                ExpandItem turnItem = new ExpandItem(expandBar, SWT.NONE);
-               turnItem.setText("Turn");
+               turnItem.setText("Elbow");
                turnViewer = new ListViewer(expandBar);
                turnViewer.setLabelProvider(new ComponentLabelProvider());
                turnViewer.setContentProvider(new ComponentContentProvider());
@@ -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");
@@ -319,7 +324,7 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange
                label.setText("Wall thickness");
                thicknessText = new Text(composite, SWT.SINGLE | SWT.BORDER);
                label = new Label(composite, SWT.NONE);
-               label.setText("Turn radius");
+               label.setText("Elbow radius");
                turnRadiusText = new Text(composite, SWT.SINGLE | SWT.BORDER);
                
                validationLabel = new Label(composite, SWT.NONE);
@@ -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);