]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Merge "Removed 3D modelling preferences page description which is equals title"
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 3 Jun 2020 17:24:53 +0000 (17:24 +0000)
committerGerrit Code Review <gerrit2@simantics>
Wed, 3 Jun 2020 17:24:53 +0000 (17:24 +0000)
org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java
org.simantics.plant3d/src/org/simantics/plant3d/dialog/ComponentSelectionDialog.java

index dae8c629b4335a7bfacb88503086d7d34285311b..b82a097cb7b250b554588e942ad832c8f358ff21 100644 (file)
@@ -206,12 +206,23 @@ public class AddComponentAction extends vtkSwtAction {
                        inst.insertPosition = insertPosition;
                        inst.rotationAngle = rotationAngle;
                        inst.position = position;
-                       ComponentUtils.addComponent(root, component, inst);
+                       PipelineComponent newComponent = ComponentUtils.addComponent(root, component, inst);
+                       componentAdded(newComponent);
                } catch (Exception e) {
                        ExceptionUtils.logAndShowError("Cannot add component", e);
                }
        }
        
+       /**
+        * This method does nothing, but can be overridden by a subclass to do additional
+        * post-processing for a newly added component.
+        * 
+        * @param newComponent  A newly added pipeline component
+        */
+       protected void componentAdded(PipelineComponent newComponent) {
+               // Nothing to do here
+       }
+
        public boolean mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 1 && e.getButton() == MouseEvent.BUTTON1) {
                        int type = panel.getPickType();
index cfd8c861dbc7d578f9f7e7ee39eaad13a9014e63..2321c1f9941fbd89f2251c6b64b9f89a2ec8efea 100644 (file)
@@ -447,8 +447,10 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange
                GridDataFactory.fillDefaults().span(2, 1).align(SWT.END, SWT.END).grab(true, false).applyTo(validationLabel);
 
                if (!allowed.contains(PositionType.NEXT) && !allowed.contains(PositionType.PREVIOUS)) {
-                       turnViewer.getList().setEnabled(false);
-                       endViewer.getList().setEnabled(false);
+                       if (turnViewer != null)
+                               turnViewer.getList().setEnabled(false);
+                       if (endViewer != null)
+                               endViewer.getList().setEnabled(false);
                        inlineSplit = true;
                }