if (action.equals("EDIT")) {
String inputValue = JOptionPane.showInputDialog(
GlobalResourceLoader.getString(RESOURCE_PATH, "profiles",
"enter_name"), selection);
if (inputValue == null) {
return;
}
// rename profile in profiles.xml
ProfileManager.getInstance().renameProfile(selection, inputValue);
// modify listmodel
model.setElementAt(inputValue, model.indexOf(selection));
selection = inputValue;
}
String inputValue = JOptionPane.showInputDialog(
GlobalResourceLoader.getString(RESOURCE_PATH, "profiles",
"enter_name"), selection);
if (inputValue == null) {
return;
}
// rename profile in profiles.xml
ProfileManager.getInstance().renameProfile(selection, inputValue);
// modify listmodel
model.setElementAt(inputValue, model.indexOf(selection));
selection = inputValue;
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/profiles/ProfileChooserDialog.java
|
|
File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/profiles/ProfileManagerDialog.java
|
Method name: void actionPerformed(ActionEvent)
|
|
Method name: void actionPerformed(ActionEvent)
|
Number of AST nodes: 7
|
|
Number of AST nodes: 6
|
|
1 | if (action.equals("EDIT")) {↵ | | |
|
2 | String inputValue = JOptionPane.showInputDialog(↵ | | 1 | String inputValue = JOptionPane.showInputDialog(↵
|
3 | GlobalResourceLoader.getString(RESOURCE_PATH, "profiles",↵ | | 2 | GlobalResourceLoader.getString(RESOURCE_PATH, "profiles",↵
|
4 | "enter_name"), selection);↵ | | 3 | "enter_name"), selection);↵
|
5 | ↵ | | |
|
6 | ↵ | | |
|
7 | if (inputValue == null) {↵ | | 4 | if (inputValue == null) {↵
|
8 | return;↵ | | |
|
9 | }↵ | | |
|
10 | ↵ | | |
|
11 | ↵ | | 5 | return;↵
|
| | | 6 | }↵
|
|
12 | // rename profile in profiles.xml↵ | | 7 | // rename profile in profiles.xml↵
|
13 | ProfileManager.getInstance().renameProfile(selection, inputValue);↵ | | 8 | ProfileManager.getInstance().renameProfile(selection, inputValue);↵
|
14 | ↵ | | |
|
15 | ↵ | | |
|
16 | // modify listmodel↵ | | 9 | // modify listmodel↵
|
17 | model.setElementAt(inputValue, model.indexOf(selection));↵ | | 10 | model.setElementAt(inputValue, model.indexOf(selection));↵
|
18 | ↵ | | |
|
19 | selection = inputValue;↵ | | 11 | selection = inputValue;
|
20 | } | | | |
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 15 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.2 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
18 | String inputValue = JOptionPane.showInputDialog(GlobalResourceLoader.getString(RESOURCE_PATH, "profiles", "enter_name"), selection); | | 18 | String inputValue = JOptionPane.showInputDialog(GlobalResourceLoader.getString(RESOURCE_PATH, "profiles", "enter_name"), selection); |
19 | if (inputValue == null) | | 19 | if (inputValue == null) |
20 | | | 20 | |
21 | ProfileManager.getInstance().renameProfile(selection, inputValue); | | 21 | ProfileManager.getInstance().renameProfile(selection, inputValue); |
22 | model.setElementAt(inputValue, model.indexOf(selection)); | | 22 | model.setElementAt(inputValue, model.indexOf(selection)); |
23 | selection = inputValue; | | 23 | selection = inputValue; |
Precondition Violations (2)
Row |
Violation |
1 | Conditional return; |
2 | Conditional return; |