'Renumber On Paste' feature now applies to variants as well

This commit is contained in:
Bane Stojkovic
2022-12-14 22:49:57 +01:00
parent 7a186d0d49
commit ab53f7e85f
3 changed files with 13 additions and 6 deletions
@@ -285,8 +285,6 @@ public class InstantiationManager {
} }
component.createdIn(currentProject); component.createdIn(currentProject);
component.setName(createUniqueName(componentType, currentProject.getComponents()));
// Translate them to the desired location. // Translate them to the desired location.
if (point != null) { if (point != null) {
for (int j = 0; j < component.getControlPointCount(); j++) { for (int j = 0; j < component.getControlPointCount(); j++) {
@@ -304,6 +302,11 @@ public class InstantiationManager {
fillWithDefaultProperties(component, template); 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 // Write to recent components
List<String> recentComponentTypes = List<String> recentComponentTypes =
(List<String>) ConfigurationManager.getInstance().readObject(IPlugInPort.RECENT_COMPONENTS_KEY, (List<String>) ConfigurationManager.getInstance().readObject(IPlugInPort.RECENT_COMPONENTS_KEY,
@@ -2564,9 +2564,9 @@ public class Presenter implements IPlugInPort {
List<PropertyWrapper> properties = ComponentProcessor.getInstance().extractProperties(component.getClass()); List<PropertyWrapper> properties = ComponentProcessor.getInstance().extractProperties(component.getClass());
Map<String, Object> values = new HashMap<String, Object>(); Map<String, Object> values = new HashMap<String, Object>();
for (PropertyWrapper property : properties) { for (PropertyWrapper property : properties) {
if (property.getName().equalsIgnoreCase("name")) { // if (property.getName().equalsIgnoreCase("name")) {
continue; // continue;
} // }
try { try {
property.readFrom(component); property.readFrom(component);
values.put(property.getName(), property.getValue()); values.put(property.getName(), property.getValue());
@@ -4254,6 +4254,10 @@
<changeType>NEW_FEATURE</changeType> <changeType>NEW_FEATURE</changeType>
<description>Title Block added as one of factory building blocks</description> <description>Title Block added as one of factory building blocks</description>
</org.diylc.appframework.update.Change> </org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>NEW_FEATURE</changeType>
<description>'Renumber On Paste' feature now applies to variants as well. When set to OFF, the app honors the name saved in the variant</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change> <org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType> <changeType>IMPROVEMENT</changeType>
<description>Ability to use up/down arrow keys in the project explorer to select components</description> <description>Ability to use up/down arrow keys in the project explorer to select components</description>