]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java
Add units to ComponentSelectionDialog
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / actions / AddComponentAction.java
index b82a097cb7b250b554588e942ad832c8f358ff21..f87e63f70aa216639bc947d8e3dc9f5bf3f53f09 100644 (file)
@@ -52,6 +52,7 @@ public class AddComponentAction extends vtkSwtAction {
        private String libUri;
        
        private double lengthFactor = 1.0;
+       private String lengthUnit = "m";
        
        public AddComponentAction(InteractiveVtkComposite panel, P3DRootNode root, String libUri) {
                super(panel);
@@ -67,6 +68,10 @@ public class AddComponentAction extends vtkSwtAction {
                this.lengthFactor = lengthFactor;
        }
 
+       public void setLengthUnit(String lengthUnit) {
+               this.lengthUnit = lengthUnit;
+       }
+
        public void setComponent(PipelineComponent component) {
                this.component = component;
                
@@ -106,6 +111,7 @@ public class AddComponentAction extends vtkSwtAction {
                // Set list of already reserved component names
                dialog.addUsedNames(ComponentUtils.getPipelineComponentNames(root));
                dialog.setLengthFactor(lengthFactor);
+               dialog.setLengthUnit(lengthUnit);
                
                if (dialog.open() == ComponentSelectionDialog.CANCEL)
                        return;