Point p = e.getPoint();
if (e.isPopupTrigger()) {
// check if a single entry is selected
if (getSelectedIndices().length <= 1) {
// select new item
int index = locationToIndex(p);
setSelectedIndex(index);
}
// show context menu
getPopupMenu().show(e.getComponent(), p.x, p.y);
}
Point p = e.getPoint();
if (e.isPopupTrigger()) {
// check if a single entry is selected
if (getSelectedIndices().length <= 1) {
// select new item
int index = locationToIndex(p);
setSelectedIndex(index);
}
// show context menu
getPopupMenu().show(e.getComponent(), p.x, p.y);
}
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/gui/search/SearchResultList.java
|
|
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/search/ResultList.java
|
Method name: void handlePopupEvent(MouseEvent)
|
|
Method name: void handlePopupEvent(MouseEvent)
|
Number of AST nodes: 6
|
|
Number of AST nodes: 6
|
|
1 | Point p = e.getPoint();↵ | | 1 | Point p = e.getPoint();↵
|
2 | if (e.isPopupTrigger()) {↵ | | 2 | if (e.isPopupTrigger()) {↵
|
3 | // check if a single entry is selected↵ | | 3 | // check if a single entry is selected↵
|
4 | if (getSelectedIndices().length <= 1) {↵ | | 4 | if (getSelectedIndices().length <= 1) {↵
|
5 | // select new item↵ | | 5 | // select new item↵
|
6 | int index = locationToIndex(p);↵ | | 6 | int index = locationToIndex(p);↵
|
7 | setSelectedIndex(index);↵ | | 7 | setSelectedIndex(index);↵
|
8 | }↵ | | 8 | }↵
|
9 | // show context menu↵ | | 9 | // show context menu↵
|
10 | getPopupMenu().show(e.getComponent(), p.x, p.y);↵ | | 10 | getPopupMenu().show(e.getComponent(), p.x, p.y);↵
|
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.2 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 14 |
-
{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.5 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | Point p = e.getPoint(); | | 1 | Point p = e.getPoint(); |
2 | if (e.isPopupTrigger()) | | 2 | if (e.isPopupTrigger()) |
3 | if (getSelectedIndices().length <= 1) | | 3 | if (getSelectedIndices().length <= 1) |
4 | int index = locationToIndex(p); | | 4 | int index = locationToIndex(p); |
5 | | | 5 | |
6 | getPopupMenu().show(e.getComponent(), p.x, p.y); | | 6 | getPopupMenu().show(e.getComponent(), p.x, p.y); |
Precondition Violations (0)
Row |
Violation |