\r
import java.util.ArrayList;\r
import java.util.Collections;\r
+import java.util.HashSet;\r
import java.util.List;\r
+import java.util.Set;\r
\r
import org.eclipse.core.runtime.IStatus;\r
import org.eclipse.core.runtime.Status;\r
*/\r
public class ComponentsRenamingModel {\r
public ArrayList<NameEntry> entries = new ArrayList<NameEntry>();\r
+ public Set<NameEntry> selectedEntries = new HashSet<>();\r
public String oldNamePrefix;\r
public String newNamePrefix;\r
public boolean reset;\r
private Resource configuration;\r
private ComponentNamingStrategy namingStrategy;\r
\r
- public void read(ReadGraph g, Resource composite) throws DatabaseException {\r
+ public ComponentsRenamingModel read(ReadGraph g, Resource composite) throws DatabaseException {\r
this.session = g.getSession();\r
this.compositeVariable = Variables.getVariable(g, composite);\r
this.configuration = g.syncRequest(new Configuration(composite));\r
prefixValidator = displayValue.getPossiblePropertyValue(g, Variables.INPUT_VALIDATOR);\r
\r
this.namingStrategy = ComponentNamingUtil.findNamingStrategy(g, null, composite);\r
+\r
+ // By default, select all entries.\r
+ this.selectedEntries.addAll(entries);\r
+\r
+ return this;\r
}\r
\r
public void computeNewNames() {\r
Layer0 L0 = Layer0.getInstance(g);\r
Layer0X L0X = Layer0X.getInstance(g);\r
for(NameEntry entry : entries)\r
- if(!entry.oldName.equals(entry.newName))\r
+ if(!entry.oldName.equals(entry.newName) && selectedEntries.contains(entry))\r
g.claimLiteral(entry.resource, L0.HasName, entry.newName, Bindings.STRING);\r
if(!oldNamePrefix.equals(newNamePrefix))\r
compositeVariable.setPropertyValue(g, L0X.HasGeneratedNamePrefix, newNamePrefix, Bindings.STRING);\r