if (mouseBasedTableItem == null) { table.setSelection(i); Event selectionEvent = new Event(); selectionEvent.widget = table; selectionEvent.item = tableItem; table.notifyListeners(SWT.Selection, selectionEvent); selectedTableItem = tableItem; }
if (tableItem != selectedTableItem) { table.setSelection(i); Event selectionEvent = new Event(); selectionEvent.widget = table; selectionEvent.item = tableItem; table.notifyListeners(SWT.Selection, selectionEvent); selectedTableItem = tableItem; }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/common/ui/celleditor/ExtendedTableEditor.java File path: /emf-2.4.1/src/org/eclipse/emf/common/ui/celleditor/ExtendedTableTreeEditor.java
Method name: void mouseDown(MouseEvent) Method name: void mouseDown(MouseEvent)
Number of AST nodes: 7 Number of AST nodes: 7
1
if (mouseBasedTableItem == null)
1
if (tableItem != selectedTableItem)
2
                {
2
                {
3
                  table.setSelection(i);
3
                  table.setSelection(i);
4
                  Event selectionEvent = new Event();
4
                  Event selectionEvent = new Event();
5
                  selectionEvent.widget = table;
5
                  selectionEvent.widget = table;
6
                  selectionEvent.item = tableItem;
6
                  selectionEvent.item = tableItem;
7
                  table.notifyListeners(SWT.Selection, selectionEvent);
7
                  table.notifyListeners(SWT.Selection, selectionEvent);
8
                  selectedTableItem = tableItem;
8
                  selectedTableItem = tableItem;
9
                }
9
                }
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.2
Clones locationClones are in different classes having the same super class
Number of node comparisons51
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)6.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    27
    if (mouseBasedTableItem == null)
    27
    if (mouseBasedTableItem == null)
    17
    if (tableItem != selectedTableItem)
    Differences
    Expression1Expression2Difference
    mouseBasedTableItemtableItemVARIABLE_NAME_MISMATCH
    nullselectedTableItemTYPE_COMPATIBLE_REPLACEMENT
    ==!=OPERATOR_MISMATCH
    Preondition Violations
    Expression selectedTableItem cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression tableItem != selectedTableItem cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17
    if (tableItem != selectedTableItem)
    28
    table.setSelection(i);
    18
    table.setSelection(i);
    29
    Event selectionEvent = new Event();
    19
    Event selectionEvent = new Event();
    30
    selectionEvent.widget = table;
    20
    selectionEvent.widget = table;
    31
    selectionEvent.item = tableItem;
    21
    selectionEvent.item = tableItem;
    32
    table.notifyListeners(SWT.Selection, selectionEvent);
    22
    table.notifyListeners(SWT.Selection, selectionEvent);
    33
    selectedTableItem = tableItem;
    23
    selectedTableItem = tableItem;
    Precondition Violations (3)
    Row Violation
    1Expression selectedTableItem cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression tableItem != selectedTableItem cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3The refactoring of the clones is infeasible, because classes org.eclipse.emf.common.ui.celleditor.ExtendedTableEditor and org.eclipse.emf.common.ui.celleditor.ExtendedTableTreeEditor do not have a common superclass