1
package dk.aau.cs.gui.undo;
3
import pipe.dataLayer.TAPNQuery;
4
import dk.aau.cs.TCTL.visitors.RenamePlaceTCTLVisitor;
5
import dk.aau.cs.gui.TabContent;
6
import dk.aau.cs.model.tapn.LocalTimedPlace;
8
public class RenameTimedPlaceCommand extends Command {
9
private final LocalTimedPlace place;
10
private final String oldName;
11
private final String newName;
12
private final TabContent tabContent;
14
public RenameTimedPlaceCommand(TabContent tabContent, LocalTimedPlace place, String oldName, String newName) {
15
this.tabContent = tabContent;
17
this.oldName = oldName;
18
this.newName = newName;
23
place.setName(newName);
24
updateQueries(oldName, newName);
29
place.setName(oldName);
30
updateQueries(newName,oldName);
33
private void updateQueries(String nameToFind, String nameToInsert){
34
RenamePlaceTCTLVisitor renameVisitor = new RenamePlaceTCTLVisitor(nameToFind, nameToInsert);
35
for (TAPNQuery q : tabContent.queries()) {
36
q.getProperty().accept(renameVisitor, null);