From 9b0eac761760d1ed937f7944890e6e1679dfb195 Mon Sep 17 00:00:00 2001 From: Branislav Stojkovic Date: Sat, 6 May 2017 16:10:45 +0200 Subject: [PATCH] improve duplication --- diylc/diylc-core/src/org/diylc/presenter/Presenter.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/diylc/diylc-core/src/org/diylc/presenter/Presenter.java b/diylc/diylc-core/src/org/diylc/presenter/Presenter.java index e4b04317..f63b4ae5 100644 --- a/diylc/diylc-core/src/org/diylc/presenter/Presenter.java +++ b/diylc/diylc-core/src/org/diylc/presenter/Presenter.java @@ -1410,6 +1410,7 @@ public class Presenter implements IPlugInPort { instantiationManager.getFirstControlPoint()); } + @SuppressWarnings("unchecked") @Override public void duplicateSelection() { LOG.info("duplicateSelection()"); @@ -1424,6 +1425,10 @@ public class Presenter implements IPlugInPort { for (IDIYComponent component : this.selectedComponents) { try { IDIYComponent cloned = component.clone(); + ComponentType componentType = + ComponentProcessor.getInstance().extractComponentTypeFrom( + (Class>) cloned.getClass()); + cloned.setName(instantiationManager.createUniqueName(componentType, currentProject.getComponents())); newSelection.add(cloned); for (int i = 0; i < component.getControlPointCount(); i++) { Point p = component.getControlPoint(i);