this.shortcut = getShortcut();
if(OperatingSystem.hasScreenMenuBar() && shortcut != null)
{
setText(label + " (" + shortcut + ")");
shortcut = null;
}
else
setText(label);
if(action != null)
{
setEnabled(true);
addActionListener(new EditAction.Wrapper(context,action));
addMouseListener(new MouseHandler());
}
else
setEnabled(false);
this.shortcut = getShortcut();
if(OperatingSystem.hasScreenMenuBar() && shortcut != null)
{
setText(label + " (" + shortcut + ")");
shortcut = null;
}
else
setText(label);
if(action != null)
{
setEnabled(true);
addActionListener(new EditAction.Wrapper(context,action));
addMouseListener(new MouseHandler());
}
else
setEnabled(false);
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/menu/EnhancedCheckBoxMenuItem.java
|
|
File path: /jEdit-4.2/src/org/gjt/sp/jedit/menu/EnhancedMenuItem.java
|
Method name: void EnhancedCheckBoxMenuItem(String, String, ActionContext)
|
|
Method name: void EnhancedMenuItem(String, String, ActionContext)
|
Number of AST nodes: 10
|
|
Number of AST nodes: 10
|
|
1 | this.shortcut = getShortcut();↵ | | 1 | this.shortcut = getShortcut();↵
|
2 | if(OperatingSystem.hasScreenMenuBar() && shortcut != null)↵ | | 2 | if(OperatingSystem.hasScreenMenuBar() && shortcut != null)↵
|
3 | {↵ | | 3 | {↵
|
4 | setText(label + " (" + shortcut + ")");↵ | | 4 | setText(label + " (" + shortcut + ")");↵
|
5 | shortcut = null;↵ | | 5 | shortcut = null;↵
|
6 | }↵ | | 6 | }↵
|
7 | else↵ | | 7 | else↵
|
8 | setText(label);↵ | | 8 | setText(label);↵
|
|
9 | if(action != null)↵ | | 9 | if(action != null)↵
|
10 | {↵ | | 10 | {↵
|
11 | setEnabled(true);↵ | | 11 | setEnabled(true);↵
|
12 | addActionListener(new EditAction.Wrapper(context,action));↵ | | 12 | addActionListener(new EditAction.Wrapper(context,action));↵
|
|
13 | addMouseListener(new MouseHandler());↵ | | 13 | addMouseListener(new MouseHandler());↵
|
14 | }↵ | | 14 | }↵
|
15 | else↵ | | 15 | else↵
|
16 | setEnabled(false); | | 16 | setEnabled(false);
|
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.7 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 63 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 10 |
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) | 5.3 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
3 | this.shortcut = getShortcut(); | | 2 | this.shortcut = getShortcut(); |
4 | if (OperatingSystem.hasScreenMenuBar() && shortcut != null) | | 3 | if (OperatingSystem.hasScreenMenuBar() && shortcut != null) |
5 | setText(label + " (" + shortcut + ")"); | | 4 | setText(label + " (" + shortcut + ")"); |
6 | | | 5 | |
| | | | |
7 | | | 6 | |
8 | if (action != null) | | 7 | if (action != null) |
9 | | | 8 | |
10 | addActionListener(new EditAction.Wrapper(context, action)); | | 9 | addActionListener(new EditAction.Wrapper(context, action)); |
11 | addMouseListener(new MouseHandler()); | | 10 | addMouseListener(new MouseHandler()); |
| | | | |
12 | | | 11 | |
Precondition Violations (0)
Row |
Violation |