String id = menuElement.getAttributeValue(MenuXMLDecoder.ID); AbstractSelectableAction action = (AbstractSelectableAction) getAction( id, mediator); if (action == null) continue; CCheckBoxMenuItem menuItem = new CCheckBoxMenuItem(action); menuItem.addMouseListener(mediator.getMouseTooltipHandler()); parentMenu.add(menuItem);
String id = menuElement.getAttributeValue(MenuXMLDecoder.ID); AbstractColumbaAction action = getAction(id, mediator); if (action == null) continue; JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(action); menuItem.addMouseListener(mediator.getMouseTooltipHandler()); parentMenu.insert(menuItem, placeholderId);
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/menu/MenuXMLDecoder.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/menu/MenuXMLDecoder.java
Method name: void parseMenu(ExtendableMenu, Element) Method name: void extendMenu(ExtendableMenuBar, ExtendableMenu, Element, String)
Number of AST nodes: 7 Number of AST nodes: 7
1
String id = menuElement.getAttributeValue(MenuXMLDecoder.ID);
1
String id = menuElement.getAttributeValue(MenuXMLDecoder.ID);
2
				AbstractSelectableAction action = (AbstractSelectableAction) getAction(
2
				AbstractColumbaAction action = getAction(
3
						id, mediator);
3
id, mediator);
4
				if (action == null)
4
				if (action == null)
5
					continue;
5
					continue;
6
				CCheckBoxMenuItem menuItem = new CCheckBoxMenuItem(action);
6
				JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(action);
7
				menuItem.addMouseListener(mediator.getMouseTooltipHandler());
7
				menuItem.addMouseListener(mediator.getMouseTooltipHandler());
8
				parentMenu.add(menuItem);
8
				parentMenu.insert(menuItem, placeholderId);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are declared in the same class
Number of node comparisons19
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)20.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    19
    String id = menuElement.getAttributeValue(MenuXMLDecoder.ID);
    32
    String id = menuElement.getAttributeValue(MenuXMLDecoder.ID);
    20
    AbstractSelectableAction action = (AbstractSelectableAction)getAction(id, mediator);
    20
    AbstractSelectableAction action = (AbstractSelectableAction)getAction(id, mediator);
    33
    AbstractColumbaAction action = getAction(id, mediator);
    Differences
    Expression1Expression2Difference
    org.columba.core.gui.action.AbstractSelectableActionorg.columba.core.gui.action.AbstractColumbaActionSUBCLASS_TYPE_MISMATCH
    org.columba.core.gui.action.AbstractSelectableActionorg.columba.core.gui.action.AbstractColumbaActionSUBCLASS_TYPE_MISMATCH
    org.columba.core.gui.action.AbstractSelectableActionorg.columba.core.gui.action.AbstractColumbaActionSUBCLASS_TYPE_MISMATCH
    (AbstractSelectableAction)getAction(id,mediator)getAction(id,mediator)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression (AbstractSelectableAction)getAction(id,mediator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression getAction(id,mediator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method getAction
    33
    AbstractColumbaAction action = getAction(id, mediator);
    21
    if (action == null)
    21
    if (action == null)
    34
    if (action == null)
    Differences
    Expression1Expression2Difference
    org.columba.core.gui.action.AbstractSelectableActionorg.columba.core.gui.action.AbstractColumbaActionSUBCLASS_TYPE_MISMATCH
    34
    if (action == null)
    22
    continue;
    22
    continue;
    35
    continue;
    Preondition Violations
    Statement continue; without innermost loop
    Statement continue; without innermost loop
    35
    continue;
    23
    CCheckBoxMenuItem menuItem = new CCheckBoxMenuItem(action);
    23
    CCheckBoxMenuItem menuItem = new CCheckBoxMenuItem(action);
    36
    JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(action);
    Differences
    Expression1Expression2Difference
    org.columba.core.gui.action.CCheckBoxMenuItemjavax.swing.JRadioButtonMenuItemSUBCLASS_TYPE_MISMATCH
    org.columba.core.gui.action.CCheckBoxMenuItemjavax.swing.JRadioButtonMenuItemSUBCLASS_TYPE_MISMATCH
    org.columba.core.gui.action.CCheckBoxMenuItemjavax.swing.JRadioButtonMenuItemSUBCLASS_TYPE_MISMATCH
    org.columba.core.gui.action.AbstractSelectableActionorg.columba.core.gui.action.AbstractColumbaActionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new CCheckBoxMenuItem(action) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new JRadioButtonMenuItem(action) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    36
    JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(action);
    24
    menuItem.addMouseListener(mediator.getMouseTooltipHandler());
    24
    menuItem.addMouseListener(mediator.getMouseTooltipHandler());
    37
    menuItem.addMouseListener(mediator.getMouseTooltipHandler());
    Differences
    Expression1Expression2Difference
    org.columba.core.gui.action.CCheckBoxMenuItemjavax.swing.JRadioButtonMenuItemSUBCLASS_TYPE_MISMATCH
    37
    menuItem.addMouseListener(mediator.getMouseTooltipHandler());
    25
    parentMenu.add(menuItem);
    25
    parentMenu.add(menuItem);
    Preondition Violations
    Unmatched statement parentMenu.add(menuItem); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                              
                                                                                                
    38
    parentMenu.insert(menuItem, placeholderId);
    Preondition Violations
    Unmatched statement parentMenu.insert(menuItem,placeholderId); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    38
    parentMenu.insert(menuItem, placeholderId);
    Precondition Violations (8)
    Row Violation
    1Expression (AbstractSelectableAction)getAction(id,mediator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression getAction(id,mediator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Statement continue; without innermost loop
    4Statement continue; without innermost loop
    5Expression new CCheckBoxMenuItem(action) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression new JRadioButtonMenuItem(action) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Unmatched statement parentMenu.add(menuItem); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement parentMenu.insert(menuItem,placeholderId); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted