37 |
|
|
38 |
package nongnu.cashews.eclipse.composer.commands; |
package nongnu.cashews.eclipse.composer.commands; |
39 |
|
|
40 |
|
import nongnu.cashews.eclipse.composer.model.Diagram; |
41 |
import nongnu.cashews.eclipse.composer.model.Node; |
import nongnu.cashews.eclipse.composer.model.Node; |
42 |
import nongnu.cashews.eclipse.composer.model.NodeRegistrar; |
import nongnu.cashews.eclipse.composer.model.NodeRegistrar; |
43 |
import nongnu.cashews.eclipse.composer.util.Dialogs; |
import nongnu.cashews.eclipse.composer.util.Dialogs; |
47 |
public class RenameNodeCommand |
public class RenameNodeCommand |
48 |
extends Command |
extends Command |
49 |
{ |
{ |
50 |
|
Diagram diagram; |
51 |
|
|
52 |
private Node node; |
private Node node; |
53 |
|
|
54 |
private String newName; |
private String newName; |
75 |
return "Rename Node"; |
return "Rename Node"; |
76 |
} |
} |
77 |
|
|
78 |
|
public boolean canExecute(){ |
79 |
|
return false; |
80 |
|
} |
81 |
public void execute() |
public void execute() |
82 |
{ |
{/* if (newName.equals("")){ |
83 |
if (!NodeRegistrar.renameNode(oldName, newName)) |
Dialogs.displayErrorDialog("The name of the node can not be null!"); |
84 |
|
return; |
85 |
|
} |
86 |
|
if (!NodeRegistrar.renameNode(oldName, newName, (Diagram)DiagramSingleton.getInstance().getDiagram())) |
87 |
{ |
{ |
88 |
Dialogs.displayErrorDialog("The node, " + newName + ", already exists."); |
Dialogs.displayErrorDialog("The node, " + newName + ", already exists."); |
89 |
return; |
return; |
90 |
} |
} |
91 |
oldName = this.node.getName(); |
oldName = this.node.getName(); |
92 |
this.node.setName(newName); |
this.node.setName(newName);*/ |
93 |
} |
} |
94 |
|
|
95 |
public void undo() |
public void undo() |
101 |
{ |
{ |
102 |
this.node.setName(newName); |
this.node.setName(newName); |
103 |
} |
} |
104 |
|
public void setDiagram(Diagram d) |
105 |
|
{ |
106 |
|
this.diagram = d; |
107 |
|
DiagramSingleton.getInstance().setDiagram(d); |
108 |
|
} |
109 |
} |
} |