1751-1-2

leftSelectionViewer.makeContributions (leftSelectionViewerPane.getMenuManager(), leftSelectionViewerPane.getToolBarManager(), getActionBars().getStatusLineManager()); leftSelectionFactory = new MyDecoratorAdapterFactory(mappingDomain.getAdapterFactory(), leftSelectionViewer.getFilterMappedObjectsAction(), true) { @Override protected boolean doMappingRefresh(Object object) { if (leftSelectionViewer.getFilterMappedObjectsAction().isChecked()) { leftSelectionViewer.getFilterMappedObjectsAction().setChecked(false); leftSelectionViewer.getFilterMappedObjectsAction().run(); } return true; } }; leftSelectionFactory.adapt((Object)mappingRoot, ITreeItemContentProvider.class); leftSelectionViewer.setAdapterFactory(leftSelectionFactory); leftSelectionViewer.setContentProvider (new AdapterFactoryContentProvider(leftSelectionFactory) { @Override public void notifyChanged(Notification note) { if (note.getNotifier() == mappingRoot && (note.getFeature() == MappingPackage.eINSTANCE.getMapping_Outputs() || note.getFeature() == MappingPackage.eINSTANCE.getMapping_Inputs())) { leftSelectionViewer.setInput(new ItemProvider(mappingRoot.getTops())); } else { super.notifyChanged(note); } } }); leftSelectionViewer.setLabelProvider(new MappingDomainLabelProvider(mappingDomain)); leftSelectionViewer.setAutoExpandLevel(2); leftSelectionViewer.setInput(new ItemProvider(mappingRoot.getTops())); leftSelectionViewer.setSelection(new StructuredSelection(mappingRoot.getTops().toArray())); leftSelectionViewerPane.setTitle(getTopLabel(), getTopImage());
rightSelectionViewer.makeContributions (rightSelectionViewerPane.getMenuManager(), rightSelectionViewerPane.getToolBarManager(), getActionBars().getStatusLineManager()); rightSelectionFactory = new MyDecoratorAdapterFactory(mappingDomain.getAdapterFactory(), rightSelectionViewer.getFilterMappedObjectsAction(), true) { @Override protected boolean doMappingRefresh(Object object) { if (rightSelectionViewer.getFilterMappedObjectsAction().isChecked()) { rightSelectionViewer.getFilterMappedObjectsAction().setChecked(false); rightSelectionViewer.getFilterMappedObjectsAction().run(); } return true; } }; rightSelectionFactory.adapt((Object)mappingRoot, ITreeItemContentProvider.class); rightSelectionViewer.setAdapterFactory(rightSelectionFactory); rightSelectionViewer.setContentProvider (new AdapterFactoryContentProvider(rightSelectionFactory) { @Override public void notifyChanged(Notification note) { if (note.getNotifier() == mappingRoot && (note.getFeature() == MappingPackage.eINSTANCE.getMapping_Outputs() || note.getFeature() == MappingPackage.eINSTANCE.getMapping_Inputs())) { rightSelectionViewer.setInput(new ItemProvider(mappingRoot.getBottoms())); } else { super.notifyChanged(note); } } }); rightSelectionViewer.setLabelProvider(new MappingDomainLabelProvider(mappingDomain)); rightSelectionViewer.setAutoExpandLevel(2); rightSelectionViewer.setInput(new ItemProvider(mappingRoot.getBottoms())); rightSelectionViewer.setSelection(new StructuredSelection(mappingRoot.getBottoms().toArray())); rightSelectionViewerPane.setTitle(getBottomLabel(), getBottomImage());

Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/mapping/presentation/MappingEditor.java |  | File path: /emf-2.4.1/src/org/eclipse/emf/mapping/presentation/MappingEditor.java
Method name: `void createPages()` |  | Method name: `void createPages()`
Number of AST nodes: 10 |  | Number of AST nodes: 10

1

    leftSelectionViewer.makeContributions↵

1

    rightSelectionViewer.makeContributions↵

2

            (leftSelectionViewerPane.getMenuManager(), leftSelectionViewerPane.getToolBarManager(), getActionBars().getStatusLineManager());↵

2

            (rightSelectionViewerPane.getMenuManager(), rightSelectionViewerPane.getToolBarManager(), getActionBars().getStatusLineManager());↵

3

          leftSelectionFactory = ↵

3

          rightSelectionFactory = ↵

4

            new MyDecoratorAdapterFactory(mappingDomain.getAdapterFactory(), leftSelectionViewer.getFilterMappedObjectsAction(), true)↵

4

            new MyDecoratorAdapterFactory(mappingDomain.getAdapterFactory(), rightSelectionViewer.getFilterMappedObjectsAction(), true)↵

5

            {↵

5

            {↵

6

              @Override↵

6

              @Override↵

7

              protected boolean doMappingRefresh(Object object)↵

7

              protected boolean doMappingRefresh(Object object)↵

8

              {↵

8

              {↵

9

                if (leftSelectionViewer.getFilterMappedObjectsAction().isChecked())↵

9

                if (rightSelectionViewer.getFilterMappedObjectsAction().isChecked())↵

10

                {↵

10

                {↵

11

                  leftSelectionViewer.getFilterMappedObjectsAction().setChecked(false);↵

11

                  rightSelectionViewer.getFilterMappedObjectsAction().setChecked(false);↵

12

                  leftSelectionViewer.getFilterMappedObjectsAction().run();↵

12

                  rightSelectionViewer.getFilterMappedObjectsAction().run();↵

13

                }↵

13

                }↵

14

                return true;↵

14

                return true;↵

15

              }↵

15

              }↵

16

            };↵

16

            };↵

17

          leftSelectionFactory.adapt((Object)mappingRoot, ITreeItemContentProvider.class);↵

17

          rightSelectionFactory.adapt((Object)mappingRoot, ITreeItemContentProvider.class);↵

18

          leftSelectionViewer.setAdapterFactory(leftSelectionFactory);↵

18

          rightSelectionViewer.setAdapterFactory(rightSelectionFactory);↵

19

          leftSelectionViewer.setContentProvider↵

19

          rightSelectionViewer.setContentProvider↵

20

            (new AdapterFactoryContentProvider(leftSelectionFactory)↵

20

            (new AdapterFactoryContentProvider(rightSelectionFactory)↵

21

             {↵

21

             {↵

22

               @Override↵

22

               @Override↵

23

               public void notifyChanged(Notification note)↵

23

               public void notifyChanged(Notification note)↵

24

               {↵

24

               {↵

25

                 if (note.getNotifier() == mappingRoot &&↵

25

                 if (note.getNotifier() == mappingRoot &&↵

26

                       (note.getFeature() == MappingPackage.eINSTANCE.getMapping_Outputs() ↵

26

                       (note.getFeature() == MappingPackage.eINSTANCE.getMapping_Outputs() ↵

27

                       || note.getFeature() == MappingPackage.eINSTANCE.getMapping_Inputs()))↵

27

                       || note.getFeature() == MappingPackage.eINSTANCE.getMapping_Inputs()))↵

28

                 {↵

28

                 {↵

29

                   leftSelectionViewer.setInput(new ItemProvider(mappingRoot.getTops()));↵

29

                   rightSelectionViewer.setInput(new ItemProvider(mappingRoot.getBottoms()));↵

30

                 }↵

30

                 }↵

31

                 else↵

31

                 else↵

32

                 {↵

32

                 {↵

33

                   super.notifyChanged(note);↵

33

                   super.notifyChanged(note);↵

34

                 }↵

34

                 }↵

35

               }↵

35

               }↵

36

             });↵

36

             });↵

37

          leftSelectionViewer.setLabelProvider(new MappingDomainLabelProvider(mappingDomain));↵

37

          rightSelectionViewer.setLabelProvider(new MappingDomainLabelProvider(mappingDomain));↵

38

          leftSelectionViewer.setAutoExpandLevel(2);↵

38

          rightSelectionViewer.setAutoExpandLevel(2);↵

39

          leftSelectionViewer.setInput(new ItemProvider(mappingRoot.getTops()));↵

39

          rightSelectionViewer.setInput(new ItemProvider(mappingRoot.getBottoms()));↵

40

          leftSelectionViewer.setSelection(new StructuredSelection(mappingRoot.getTops().toArray()));↵

40

          rightSelectionViewer.setSelection(new StructuredSelection(mappingRoot.getBottoms().toArray()));↵

41

          leftSelectionViewerPane.setTitle(getTopLabel(), getTopImage());

41

          rightSelectionViewerPane.setTitle(getBottomLabel(), getBottomImage());

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0
Clones location | Clones are in the same method
Number of node comparisons | 82

1. {Non-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) | 0.0
   Clone type | Type 2

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

   16

       leftSelectionViewer.makeContributions(leftSelectionViewerPane.getMenuManager(), leftSelectionViewerPane.getToolBarManager(), getActionBars().getStatusLineManager());

   16 | leftSelectionViewer.makeContributions(leftSelectionViewerPane.getMenuManager(), leftSelectionViewerPane.getToolBarManager(), getActionBars().getStatusLineManager());
   26 | rightSelectionViewer.makeContributions(rightSelectionViewerPane.getMenuManager(), rightSelectionViewerPane.getToolBarManager(), getActionBars().getStatusLineManager());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   leftSelectionViewerPane | rightSelectionViewerPane | VARIABLE_NAME_MISMATCH
   leftSelectionViewerPane | rightSelectionViewerPane | VARIABLE_NAME_MISMATCH
   leftSelectionViewer | rightSelectionViewer | VARIABLE_NAME_MISMATCH

   26

       rightSelectionViewer.makeContributions(rightSelectionViewerPane.getMenuManager(), rightSelectionViewerPane.getToolBarManager(), getActionBars().getStatusLineManager());

   17

       leftSelectionFactory = new MyDecoratorAdapterFactory(mappingDomain.getAdapterFactory(), leftSelectionViewer.getFilterMappedObjectsAction(), true) {...};

   17 | leftSelectionFactory = new MyDecoratorAdapterFactory(mappingDomain.getAdapterFactory(), leftSelectionViewer.getFilterMappedObjectsAction(), true) {...};
   27 | rightSelectionFactory = new MyDecoratorAdapterFactory(mappingDomain.getAdapterFactory(), rightSelectionViewer.getFilterMappedObjectsAction(), true) {...};

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   leftSelectionFactory | rightSelectionFactory | VARIABLE_NAME_MISMATCH
   leftSelectionViewer | rightSelectionViewer | VARIABLE_NAME_MISMATCH
   leftSelectionViewer | rightSelectionViewer | VARIABLE_NAME_MISMATCH
   leftSelectionViewer | rightSelectionViewer | VARIABLE_NAME_MISMATCH
   leftSelectionViewer | rightSelectionViewer | VARIABLE_NAME_MISMATCH

   Preondition Violations
   Expression leftSelectionFactory is a field being modified, and thus it cannot be parameterized
   Expression rightSelectionFactory is a field being modified, and thus it cannot be parameterized

   27

       rightSelectionFactory = new MyDecoratorAdapterFactory(mappingDomain.getAdapterFactory(), rightSelectionViewer.getFilterMappedObjectsAction(), true) {...};

   18

       leftSelectionFactory.adapt((Object)mappingRoot, ITreeItemContentProvider.class);

   18 | leftSelectionFactory.adapt((Object)mappingRoot, ITreeItemContentProvider.class);
   28 | rightSelectionFactory.adapt((Object)mappingRoot, ITreeItemContentProvider.class);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   leftSelectionFactory | rightSelectionFactory | VARIABLE_NAME_MISMATCH

   Preondition Violations
   Expression leftSelectionFactory cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression rightSelectionFactory cannot be parameterized, because it has dependencies to/from statements that will be extracted

   28

       rightSelectionFactory.adapt((Object)mappingRoot, ITreeItemContentProvider.class);

   19

       leftSelectionViewer.setAdapterFactory(leftSelectionFactory);

   19 | leftSelectionViewer.setAdapterFactory(leftSelectionFactory);
   29 | rightSelectionViewer.setAdapterFactory(rightSelectionFactory);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   leftSelectionFactory | rightSelectionFactory | VARIABLE_NAME_MISMATCH
   leftSelectionViewer | rightSelectionViewer | VARIABLE_NAME_MISMATCH

   Preondition Violations
   Expression leftSelectionFactory cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression rightSelectionFactory cannot be parameterized, because it has dependencies to/from statements that will be extracted

   29

       rightSelectionViewer.setAdapterFactory(rightSelectionFactory);

   20

       leftSelectionViewer.setContentProvider(new AdapterFactoryContentProvider(leftSelectionFactory) {...});

   20 | leftSelectionViewer.setContentProvider(new AdapterFactoryContentProvider(leftSelectionFactory) {...});
   30 | rightSelectionViewer.setContentProvider(new AdapterFactoryContentProvider(rightSelectionFactory) {...});

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getTops | getBottoms | METHOD_INVOCATION_NAME_MISMATCH
   leftSelectionViewer | rightSelectionViewer | VARIABLE_NAME_MISMATCH
   leftSelectionFactory | rightSelectionFactory | VARIABLE_NAME_MISMATCH
   leftSelectionViewer | rightSelectionViewer | VARIABLE_NAME_MISMATCH

   Preondition Violations
   Expression leftSelectionFactory cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression rightSelectionFactory cannot be parameterized, because it has dependencies to/from statements that will be extracted

   30

       rightSelectionViewer.setContentProvider(new AdapterFactoryContentProvider(rightSelectionFactory) {...});

   21

       leftSelectionViewer.setLabelProvider(new MappingDomainLabelProvider(mappingDomain));

   21 | leftSelectionViewer.setLabelProvider(new MappingDomainLabelProvider(mappingDomain));
   31 | rightSelectionViewer.setLabelProvider(new MappingDomainLabelProvider(mappingDomain));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   leftSelectionViewer | rightSelectionViewer | VARIABLE_NAME_MISMATCH

   31

       rightSelectionViewer.setLabelProvider(new MappingDomainLabelProvider(mappingDomain));

   22

       leftSelectionViewer.setAutoExpandLevel(2);

   22 | leftSelectionViewer.setAutoExpandLevel(2);
   32 | rightSelectionViewer.setAutoExpandLevel(2);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   leftSelectionViewer | rightSelectionViewer | VARIABLE_NAME_MISMATCH

   32

       rightSelectionViewer.setAutoExpandLevel(2);

   23

       leftSelectionViewer.setInput(new ItemProvider(mappingRoot.getTops()));

   23 | leftSelectionViewer.setInput(new ItemProvider(mappingRoot.getTops()));
   33 | rightSelectionViewer.setInput(new ItemProvider(mappingRoot.getBottoms()));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getTops | getBottoms | METHOD_INVOCATION_NAME_MISMATCH
   leftSelectionViewer | rightSelectionViewer | VARIABLE_NAME_MISMATCH

   33

       rightSelectionViewer.setInput(new ItemProvider(mappingRoot.getBottoms()));

   24

       leftSelectionViewer.setSelection(new StructuredSelection(mappingRoot.getTops().toArray()));

   24 | leftSelectionViewer.setSelection(new StructuredSelection(mappingRoot.getTops().toArray()));
   34 | rightSelectionViewer.setSelection(new StructuredSelection(mappingRoot.getBottoms().toArray()));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getTops | getBottoms | METHOD_INVOCATION_NAME_MISMATCH
   leftSelectionViewer | rightSelectionViewer | VARIABLE_NAME_MISMATCH

   34

       rightSelectionViewer.setSelection(new StructuredSelection(mappingRoot.getBottoms().toArray()));

   25

       leftSelectionViewerPane.setTitle(getTopLabel(), getTopImage());

   25 | leftSelectionViewerPane.setTitle(getTopLabel(), getTopImage());
   35 | rightSelectionViewerPane.setTitle(getBottomLabel(), getBottomImage());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getTopLabel | getBottomLabel | METHOD_INVOCATION_NAME_MISMATCH
   getTopImage | getBottomImage | METHOD_INVOCATION_NAME_MISMATCH
   leftSelectionViewerPane | rightSelectionViewerPane | VARIABLE_NAME_MISMATCH

   35

       rightSelectionViewerPane.setTitle(getBottomLabel(), getBottomImage());

   Precondition Violations (8)
   Row | Violation
   --- | ---
   1 | Expression leftSelectionFactory is a field being modified, and thus it cannot be parameterized
   2 | Expression rightSelectionFactory is a field being modified, and thus it cannot be parameterized
   3 | Expression leftSelectionFactory cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression rightSelectionFactory cannot be parameterized, because it has dependencies to/from statements that will be extracted
   5 | Expression leftSelectionFactory cannot be parameterized, because it has dependencies to/from statements that will be extracted
   6 | Expression rightSelectionFactory cannot be parameterized, because it has dependencies to/from statements that will be extracted
   7 | Expression leftSelectionFactory cannot be parameterized, because it has dependencies to/from statements that will be extracted
   8 | Expression rightSelectionFactory cannot be parameterized, because it has dependencies to/from statements that will be extracted