129-1-2

super.setActiveEditor(part); activeEditorPart = part; // Switch to the new selection provider. // if (selectionProvider != null) { selectionProvider.removeSelectionChangedListener(this); } if (part == null) { selectionProvider = null; } else { selectionProvider = part.getSite().getSelectionProvider(); selectionProvider.addSelectionChangedListener(this); // Fake a selection changed event to update the menus. // if (selectionProvider.getSelection() != null) { selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection())); } }
super.setActiveEditor(part); activeEditorPart = part; // Switch to the new selection provider. // if (selectionProvider != null) { selectionProvider.removeSelectionChangedListener(this); } if (part == null) { selectionProvider = null; } else { selectionProvider = part.getSite().getSelectionProvider(); selectionProvider.addSelectionChangedListener(this); // Fake a selection changed event to update the menus. // if (selectionProvider.getSelection() != null) { selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection())); } }

Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/presentation/EcoreActionBarContributor.java |  | File path: /emf-2.4.1/src/org/eclipse/emf/mapping/ecore2xml/presentation/Ecore2XMLActionBarContributor.java
Method name: `void setActiveEditorGen(IEditorPart)` |  | Method name: `void setActiveEditor(IEditorPart)`
Number of AST nodes: 10 |  | Number of AST nodes: 10

1

    super.setActiveEditor(part);↵

1

    super.setActiveEditor(part);↵

2

        activeEditorPart = part;↵

2

        activeEditorPart = part;↵

3

        // Switch to the new selection provider.↵

3

        // Switch to the new selection provider.↵

4

        //↵

4

        //↵

5

        if (selectionProvider != null)↵

5

        if (selectionProvider != null)↵

6

        {↵

6

        {↵

7

          selectionProvider.removeSelectionChangedListener(this);↵

7

          selectionProvider.removeSelectionChangedListener(this);↵

8

        }↵

8

        }↵

9

        if (part == null)↵

9

        if (part == null)↵

10

        {↵

10

        {↵

11

          selectionProvider = null;↵

11

          selectionProvider = null;↵

12

        }↵

12

        }↵

13

        else↵

13

        else↵

14

        {↵

14

        {↵

15

          selectionProvider = part.getSite().getSelectionProvider();↵

15

          selectionProvider = part.getSite().getSelectionProvider();↵

16

          selectionProvider.addSelectionChangedListener(this);↵

16

          selectionProvider.addSelectionChangedListener(this);↵

17

          // Fake a selection changed event to update the menus.↵

17

          // Fake a selection changed event to update the menus.↵

18

          //↵

18

          //↵

19

          if (selectionProvider.getSelection() != null)↵

19

          if (selectionProvider.getSelection() != null)↵

20

          {↵

20

          {↵

21

            selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection()));↵

21

            selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection()));↵

22

          }↵

22

          }↵

23

        }

23

        }

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

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 10
   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) | 1.9
   Clone type | Type 1

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

   1

       super.setActiveEditor(part);

   1

       super.setActiveEditor(part);

   2

       activeEditorPart = part;

   2

       activeEditorPart = part;

   3

       if (selectionProvider != null)

   3

       if (selectionProvider != null)

   4

       selectionProvider.removeSelectionChangedListener(this);

   4

       selectionProvider.removeSelectionChangedListener(this);

   5

       if (part == null)

   5

       if (part == null)

   6

       selectionProvider = null;

   6

       selectionProvider = null;

       else

       else

   7

       selectionProvider = part.getSite().getSelectionProvider();

   7

       selectionProvider = part.getSite().getSelectionProvider();

   8

       selectionProvider.addSelectionChangedListener(this);

   8

       selectionProvider.addSelectionChangedListener(this);

   9

       if (selectionProvider.getSelection() != null)

   9

       if (selectionProvider.getSelection() != null)

   10

       selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection()));

   10

       selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection()));

   Precondition Violations (0)
   Row | Violation
   --- | ---