From ab53f7e85fc160919f6a6e7bb0a69b8e82b73d89 Mon Sep 17 00:00:00 2001 From: Bane Stojkovic Date: Wed, 14 Dec 2022 22:49:57 +0100 Subject: [PATCH] 'Renumber On Paste' feature now applies to variants as well --- .../src/org/diylc/presenter/InstantiationManager.java | 9 ++++++--- diylc/diylc-core/src/org/diylc/presenter/Presenter.java | 6 +++--- diylc/diylc-core/src/org/diylc/presenter/update.xml | 4 ++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/diylc/diylc-core/src/org/diylc/presenter/InstantiationManager.java b/diylc/diylc-core/src/org/diylc/presenter/InstantiationManager.java index 5ee0d7dc..2b09bfdb 100644 --- a/diylc/diylc-core/src/org/diylc/presenter/InstantiationManager.java +++ b/diylc/diylc-core/src/org/diylc/presenter/InstantiationManager.java @@ -285,8 +285,6 @@ public class InstantiationManager { } component.createdIn(currentProject); - component.setName(createUniqueName(componentType, currentProject.getComponents())); - // Translate them to the desired location. if (point != null) { for (int j = 0; j < component.getControlPointCount(); j++) { @@ -297,11 +295,16 @@ public class InstantiationManager { } } - loadComponentShapeFromTemplate(component, template); + loadComponentShapeFromTemplate(component, template); if (model == null) { // do not fill with defaults if creating by a model fillWithDefaultProperties(component, template); + } + + // preserve component from the template if RENUMBER_ON_PASTE_KEY is OFF + if (template == null || ConfigurationManager.getInstance().readBoolean(IPlugInPort.RENUMBER_ON_PASTE_KEY, true)) { + component.setName(createUniqueName(componentType, currentProject.getComponents())); } // Write to recent components diff --git a/diylc/diylc-core/src/org/diylc/presenter/Presenter.java b/diylc/diylc-core/src/org/diylc/presenter/Presenter.java index 573fb0c4..3be751e5 100644 --- a/diylc/diylc-core/src/org/diylc/presenter/Presenter.java +++ b/diylc/diylc-core/src/org/diylc/presenter/Presenter.java @@ -2564,9 +2564,9 @@ public class Presenter implements IPlugInPort { List properties = ComponentProcessor.getInstance().extractProperties(component.getClass()); Map values = new HashMap(); for (PropertyWrapper property : properties) { - if (property.getName().equalsIgnoreCase("name")) { - continue; - } +// if (property.getName().equalsIgnoreCase("name")) { +// continue; +// } try { property.readFrom(component); values.put(property.getName(), property.getValue()); diff --git a/diylc/diylc-core/src/org/diylc/presenter/update.xml b/diylc/diylc-core/src/org/diylc/presenter/update.xml index d2c0116e..21d966ae 100644 --- a/diylc/diylc-core/src/org/diylc/presenter/update.xml +++ b/diylc/diylc-core/src/org/diylc/presenter/update.xml @@ -4253,6 +4253,10 @@ NEW_FEATURE Title Block added as one of factory building blocks + + + NEW_FEATURE + 'Renumber On Paste' feature now applies to variants as well. When set to OFF, the app honors the name saved in the variant IMPROVEMENT