From 9497b5d9e26b3f6ea39030af6b14f8776a449591 Mon Sep 17 00:00:00 2001 From: Reino Ruusu Date: Wed, 3 Jun 2020 10:29:07 +0300 Subject: [PATCH] Provide a hook for post-processing after adding a new component gitlab #131 Change-Id: I3da7ee63cafe3f3f190f57fcc08719cec69ef9c6 --- .../plant3d/actions/AddComponentAction.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java b/org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java index dae8c629..b82a097c 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java @@ -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(); -- 2.47.1