|
@@ -52,7 +52,7 @@ public class ActionNamePanel extends JPanel implements PropertyChangeListener {
|
52
|
52
|
*/
|
53
|
53
|
private static final long serialVersionUID = 1;
|
54
|
54
|
/** Original name. */
|
55
|
|
- private final String originalName;
|
|
55
|
+ private String existingName;
|
56
|
56
|
/** Action name field. */
|
57
|
57
|
private ValidatingJTextField name;
|
58
|
58
|
/** Action group. */
|
|
@@ -77,9 +77,9 @@ public class ActionNamePanel extends JPanel implements PropertyChangeListener {
|
77
|
77
|
super();
|
78
|
78
|
|
79
|
79
|
if (name == null) {
|
80
|
|
- this.originalName = "";
|
|
80
|
+ this.existingName = "";
|
81
|
81
|
} else {
|
82
|
|
- this.originalName = name;
|
|
82
|
+ this.existingName = name;
|
83
|
83
|
}
|
84
|
84
|
this.group = ActionManager.getGroup(group);
|
85
|
85
|
|
|
@@ -92,10 +92,18 @@ public class ActionNamePanel extends JPanel implements PropertyChangeListener {
|
92
|
92
|
/**
|
93
|
93
|
* Sets the action name.
|
94
|
94
|
*
|
95
|
|
- * @param name new name
|
|
95
|
+ * @param newName new name
|
96
|
96
|
*/
|
97
|
|
- void setActionName(final String name) {
|
98
|
|
- this.name.setText(name);
|
|
97
|
+ @SuppressWarnings("unchecked")
|
|
98
|
+ void setActionName(final String newName) {
|
|
99
|
+ if (newName == null) {
|
|
100
|
+ this.existingName = "";
|
|
101
|
+ } else {
|
|
102
|
+ this.existingName = newName;
|
|
103
|
+ }
|
|
104
|
+ name.setValidator(new ValidatorChain<String>(new FileNameValidator(),
|
|
105
|
+ new ActionNameValidator(group, existingName)));
|
|
106
|
+ this.name.setText(newName);
|
99
|
107
|
}
|
100
|
108
|
|
101
|
109
|
/** Validates the name. */
|
|
@@ -106,9 +114,9 @@ public class ActionNamePanel extends JPanel implements PropertyChangeListener {
|
106
|
114
|
/** Initialises the components. */
|
107
|
115
|
@SuppressWarnings("unchecked")
|
108
|
116
|
private void initComponents() {
|
109
|
|
- name = new ValidatingJTextField(new JTextField(originalName),
|
|
117
|
+ name = new ValidatingJTextField(new JTextField(existingName),
|
110
|
118
|
new ValidatorChain<String>(new FileNameValidator(),
|
111
|
|
- new ActionNameValidator(group)));
|
|
119
|
+ new ActionNameValidator(group, existingName)));
|
112
|
120
|
}
|
113
|
121
|
|
114
|
122
|
/** Adds the listeners. */
|
|
@@ -134,7 +142,7 @@ public class ActionNamePanel extends JPanel implements PropertyChangeListener {
|
134
|
142
|
|
135
|
143
|
*/
|
136
|
144
|
public boolean hasNameChanged() {
|
137
|
|
- return getActionName().equals(originalName);
|
|
145
|
+ return getActionName().equals(existingName);
|
138
|
146
|
}
|
139
|
147
|
|
140
|
148
|
/**
|