TreePath path = e.getNewLeadSelectionPath();
// remember last selected folder treenode
if (path != null) {
treeNode = (AddressbookTreeNode) path.getLastPathComponent();
}
// enable, if more than zero treenodes selected
if ((path != null) && (treeNode instanceof AddressbookFolder)) {
setEnabled(true);
} else {
setEnabled(false);
}
TreePath path = e.getNewLeadSelectionPath();
// remember last selected folder treenode
if (path != null) {
treeNode = (AddressbookTreeNode) path.getLastPathComponent();
}
// enable, if more than zero treenodes selected
if ( (path != null) && ( treeNode instanceof AddressbookFolder ) ){
setEnabled(true);
} else {
setEnabled(false);
}
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/gui/action/AddContactCardAction.java
|
|
File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/gui/action/DefaultTreeAction.java
|
Method name: void valueChanged(TreeSelectionEvent)
|
|
Method name: void valueChanged(TreeSelectionEvent)
|
Number of AST nodes: 6
|
|
Number of AST nodes: 6
|
|
1 | TreePath path = e.getNewLeadSelectionPath();↵ | | 1 | TreePath path = e.getNewLeadSelectionPath();↵
|
|
2 | // remember last selected folder treenode↵ | | 2 | // remember last selected folder treenode↵
|
3 | if (path != null) {↵ | | 3 | if (path != null) {↵
|
4 | treeNode = (AddressbookTreeNode) path.getLastPathComponent();↵ | | 4 | treeNode = (AddressbookTreeNode) path.getLastPathComponent();↵
|
5 | }↵ | | 5 | }↵
|
|
6 | // enable, if more than zero treenodes selected↵ | | 6 | // enable, if more than zero treenodes selected↵
|
7 | if ((path != null) && (treeNode instanceof AddressbookFolder)) {↵ | | 7 | if ( (path != null) && ( treeNode instanceof AddressbookFolder ) ){↵
|
8 | setEnabled(true);↵ | | 8 | setEnabled(true);↵
|
9 | } else {↵ | | 9 | } else {↵
|
10 | setEnabled(false);↵ | | 10 | setEnabled(false);↵
|
11 | } | | 11 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.4 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 21 |
-
{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) | 0.8 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | TreePath path = e.getNewLeadSelectionPath(); | | 1 | TreePath path = e.getNewLeadSelectionPath(); |
2 | if (path != null) | | 2 | if (path != null) |
3 | treeNode = (AddressbookTreeNode)path.getLastPathComponent(); | | 3 | treeNode = (AddressbookTreeNode)path.getLastPathComponent(); |
4 | if ((path != null) && (treeNode instanceof AddressbookFolder)) | | 4 | if ((path != null) && (treeNode instanceof AddressbookFolder)) |
5 | | | 5 | |
| | | | |
6 | | | 6 | |
Precondition Violations (0)
Row |
Violation |