1546-1-2

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; }
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: 8 |  | Number of AST nodes: 8

1

    TableItem mouseBasedTableItem = table.getItem(point);↵

1

    TableItem mouseBasedTableItem = table.getItem(point);↵

2

                    if (mouseBasedTableItem == null)↵

2

                    if (mouseBasedTableItem == null)↵

3

                    {↵

3

                    {↵

4

                      table.setSelection(i);↵

4

                      table.setSelection(i);↵

5

                      Event selectionEvent = new Event();↵

5

                      Event selectionEvent = new Event();↵

6

                      selectionEvent.widget = table;↵

6

                      selectionEvent.widget = table;↵

7

                      selectionEvent.item = tableItem;↵

7

                      selectionEvent.item = tableItem;↵

8

                      table.notifyListeners(SWT.Selection, selectionEvent);↵

8

                      table.notifyListeners(SWT.Selection, selectionEvent);↵

9

                      selectedTableItem = tableItem;↵

9

                      selectedTableItem = tableItem;↵

10

                    }

10

                    }

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.2
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 54

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 8
   Number of unmapped statements in the first code fragment | 0
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 2.8
   Clone type | Type 1

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   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 (0)
   Row | Violation
   --- | ---