improve duplication

This commit is contained in:
Branislav Stojkovic
2017-05-06 16:10:45 +02:00
parent d84f7dadf5
commit 9b0eac7617
@@ -1410,6 +1410,7 @@ public class Presenter implements IPlugInPort {
instantiationManager.getFirstControlPoint()); instantiationManager.getFirstControlPoint());
} }
@SuppressWarnings("unchecked")
@Override @Override
public void duplicateSelection() { public void duplicateSelection() {
LOG.info("duplicateSelection()"); LOG.info("duplicateSelection()");
@@ -1424,6 +1425,10 @@ public class Presenter implements IPlugInPort {
for (IDIYComponent<?> component : this.selectedComponents) { for (IDIYComponent<?> component : this.selectedComponents) {
try { try {
IDIYComponent<?> cloned = component.clone(); IDIYComponent<?> cloned = component.clone();
ComponentType componentType =
ComponentProcessor.getInstance().extractComponentTypeFrom(
(Class<? extends IDIYComponent<?>>) cloned.getClass());
cloned.setName(instantiationManager.createUniqueName(componentType, currentProject.getComponents()));
newSelection.add(cloned); newSelection.add(cloned);
for (int i = 0; i < component.getControlPointCount(); i++) { for (int i = 0; i < component.getControlPointCount(); i++) {
Point p = component.getControlPoint(i); Point p = component.getControlPoint(i);