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 |
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.0 |
Clones location | Clones are in different classes |
Number of node comparisons | 5 |
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 |
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() {...}; |
Row | Violation |
---|---|
1 | Unmatched statement label.setText(userVisibleName); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Expression label cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression 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; } } cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Super method call 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; } } ; cannot be extracted from method |
5 | The refactoring of the clones is infeasible, because classes org.columba.core.gui.config.ThemeComboBoxRenderer and org.columba.core.gui.themes.plugin.PlasticLookAndFeelConfigPlugin do not have a common superclass |