TableItem tableItem = tableItems[i]; if (tableItem == selectedTableItem || wasActive) { if (tableItem != selectedTableItem) { table.setSelection(i); Event selectionEvent = new Event(); selectionEvent.widget = table; selectionEvent.item = tableItem; table.notifyListeners(SWT.Selection, selectionEvent); selectedTableItem = tableItem; } editTableItem = tableItems[i]; editTableItemColumn = j; } else { TableItem mouseBasedTableItem = table.getItem(point); 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 || wasActive) { if (tableItem != selectedTableItem) { table.setSelection(i); Event selectionEvent = new Event(); selectionEvent.widget = table; selectionEvent.item = tableItem; table.notifyListeners(SWT.Selection, selectionEvent); selectedTableItem = tableItem; } editTableTreeItem = (TableTreeItem)tableItems[i].getData(ExtendedTableTreeViewer.ITEM_ID); editTableTreeItemColumn = j; } else { TableItem mouseBasedTableItem = table.getItem(point); if (mouseBasedTableItem == null) { 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: 19 Number of AST nodes: 18
1
TableItem tableItem = tableItems[i];
2
              if (tableItem == selectedTableItem || wasActive)
1
if (tableItem == selectedTableItem || wasActive)
3
              {
2
              {
4
                if (tableItem != selectedTableItem)
3
                if (tableItem != selectedTableItem)
5
                {
4
                {
6
                  table.setSelection(i);
5
                  table.setSelection(i);
7
                  Event selectionEvent = new Event();
6
                  Event selectionEvent = new Event();
8
                  selectionEvent.widget = table;
7
                  selectionEvent.widget = table;
9
                  selectionEvent.item = tableItem;
8
                  selectionEvent.item = tableItem;
10
                  table.notifyListeners(SWT.Selection, selectionEvent);
9
                  table.notifyListeners(SWT.Selection, selectionEvent);
11
                  selectedTableItem = tableItem;
10
                  selectedTableItem = tableItem;
12
                }
11
                }
13
                editTableItem = tableItems[i];
12
                editTableTreeItem = (TableTreeItem)tableItems[i].getData(ExtendedTableTreeViewer.ITEM_ID);
14
                editTableItemColumn = j;
13
                editTableTreeItemColumn = j;
15
              }
14
              }
16
              else
15
              else
17
              {
16
              {
18
                TableItem mouseBasedTableItem = table.getItem(point);
17
                TableItem mouseBasedTableItem = table.getItem(point);
19
                if (mouseBasedTableItem == null)
18
                if (mouseBasedTableItem == null)
20
                {
19
                {
21
                  table.setSelection(i);
20
                  table.setSelection(i);
22
                  Event selectionEvent = new Event();
21
                  Event selectionEvent = new Event();
23
                  selectionEvent.widget = table;
22
                  selectionEvent.widget = table;
24
                  selectionEvent.item = tableItem;
23
                  selectionEvent.item = tableItem;
25
                  table.notifyListeners(SWT.Selection, selectionEvent);
24
                  table.notifyListeners(SWT.Selection, selectionEvent);
26
                  selectedTableItem = tableItem;
25
                  selectedTableItem = tableItem;
27
                }
26
                }
28
              }
27
              }
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.8
Clones locationClones are in different classes having the same super class
Number of node comparisons167
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements18
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)7.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    15
    TableItem tableItem = tableItems[i];
    15
    TableItem tableItem = tableItems[i];
    Preondition Violations
    Unmatched statement TableItem tableItem=tableItems[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                
    16
    if (tableItem == selectedTableItem || wasActive)
    16
    if (tableItem == selectedTableItem || wasActive)
    17
    if (tableItem != selectedTableItem)
    17
    if (tableItem != selectedTableItem)
    18
    table.setSelection(i);
    18
    table.setSelection(i);
    19
    Event selectionEvent = new Event();
    19
    Event selectionEvent = new Event();
    20
    selectionEvent.widget = table;
    20
    selectionEvent.widget = table;
    21
    selectionEvent.item = tableItem;
    21
    selectionEvent.item = tableItem;
    22
    table.notifyListeners(SWT.Selection, selectionEvent);
    22
    table.notifyListeners(SWT.Selection, selectionEvent);
    23
    selectedTableItem = tableItem;
    23
    selectedTableItem = tableItem;
    24
    editTableItem = tableItems[i];
    24
    editTableItem = tableItems[i];
    24
    editTableTreeItem = (TableTreeItem)tableItems[i].getData(ExtendedTableTreeViewer.ITEM_ID);
    Differences
    Expression1Expression2Difference
    editTableItemeditTableTreeItemVARIABLE_NAME_MISMATCH
    org.eclipse.swt.widgets.TableItemorg.eclipse.swt.custom.TableTreeItemSUBCLASS_TYPE_MISMATCH
    tableItems[i](TableTreeItem)tableItems[i].getData(ExtendedTableTreeViewer.ITEM_ID)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression editTableItem is a field being modified, and thus it cannot be parameterized
    Expression editTableTreeItem is a field being modified, and thus it cannot be parameterized
    24
    editTableTreeItem = (TableTreeItem)tableItems[i].getData(ExtendedTableTreeViewer.ITEM_ID);
    25
    editTableItemColumn = j;
    25
    editTableItemColumn = j;
    25
    editTableTreeItemColumn = j;
    Differences
    Expression1Expression2Difference
    editTableItemColumneditTableTreeItemColumnVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression editTableItemColumn is a field being modified, and thus it cannot be parameterized
    Expression editTableTreeItemColumn is a field being modified, and thus it cannot be parameterized
    25
    editTableTreeItemColumn = j;
    else
    else
    26
    TableItem mouseBasedTableItem = table.getItem(point);
    26
    TableItem mouseBasedTableItem = table.getItem(point);
    27
    if (mouseBasedTableItem == null)
    27
    if (mouseBasedTableItem == null)
    28
    table.setSelection(i);
    28
    table.setSelection(i);
    29
    Event selectionEvent = new Event();
    29
    Event selectionEvent = new Event();
    30
    selectionEvent.widget = table;
    30
    selectionEvent.widget = table;
    31
    selectionEvent.item = tableItem;
    31
    selectionEvent.item = tableItem;
    32
    table.notifyListeners(SWT.Selection, selectionEvent);
    32
    table.notifyListeners(SWT.Selection, selectionEvent);
    33
    selectedTableItem = tableItem;
    33
    selectedTableItem = tableItem;
    Precondition Violations (5)
    Row Violation
    1Unmatched statement TableItem tableItem=tableItems[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Expression editTableItem is a field being modified, and thus it cannot be parameterized
    3Expression editTableTreeItem is a field being modified, and thus it cannot be parameterized
    4Expression editTableItemColumn is a field being modified, and thus it cannot be parameterized
    5Expression editTableTreeItemColumn is a field being modified, and thus it cannot be parameterized