JLabel label = (JLabel) super.getListCellRendererComponent(list, value,
index, isSelected, cellHasFocus);
// id = org.columba.example.HelloWorld$HelloWorldPlugin
String id = (String) value;
//String userVisibleName = pluginHandler.getUserVisibleName(id);
String userVisibleName = id;
label.setText(userVisibleName);
return label;
return new DefaultListCellRenderer() {
public Component getListCellRendererComponent(JList list,
Object value, int index, boolean isSelected,
boolean cellHasFocus) {
JLabel label = (JLabel) super.getListCellRendererComponent(list,
value, index, isSelected, cellHasFocus);
PlasticTheme theme = (PlasticTheme) value;
label.setText(theme.getName());
return label;
}
};
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/config/ThemeComboBoxRenderer.java
|
|
File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/themes/plugin/PlasticLookAndFeelConfigPlugin.java
|
Method name: Component getListCellRendererComponent(JList, Object, int, boolean, boolean)
|
|
Method name: ListCellRenderer createThemeRenderer()
|
Number of AST nodes: 5
|
|
Number of AST nodes: 1
|
|
1 | JLabel label = (JLabel) super.getListCellRendererComponent(list,↵ | | 1 | return new DefaultListCellRenderer() {↵
|
| | | 2 | public Component getListCellRendererComponent(JList list,↵
|
2 | value,↵ | | 3 | Object value,↵
|
3 | index, isSelected, cellHasFocus);↵ | | 4 | int index, boolean isSelected,↵
|
4 | // id = org.columba.example.HelloWorld$HelloWorldPlugin↵ | | |
|
5 | String id = (String) value;↵ | | |
|
6 | //String userVisibleName = pluginHandler.getUserVisibleName(id);↵ | | |
|
7 | String userVisibleName = id;↵ | | |
|
8 | ↵ | | |
|
| | | 5 | boolean cellHasFocus) {↵
|
| | | 6 | JLabel label = (JLabel) super.getListCellRendererComponent(list,↵
|
| | | 7 | value, index, isSelected, cellHasFocus);↵
|
| | | 8 | PlasticTheme theme = (PlasticTheme) value;↵
|
9 | label.setText(userVisibleName);↵ | | 9 | label.setText(theme.getName());↵
|
10 | return label↵ | | |
|
| | | 10 | return label;↵
|
| | | 11 | }↵
|
11 | ; | | 12 | };
|
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.0 |
Clones location | Clones are in different classes |
Number of node comparisons | 5 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 4 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | JLabel label = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); | | | |
2 | String id = (String)value; | | | |
3 | String userVisibleName = id; | | | |
4 | label.setText(userVisibleName); | | | |
5 | return label; | | 1 | return new DefaultListCellRenderer() {...}; |
Precondition Violations (0)
Row |
Violation |