if (createChildMenuManager != null) { depopulateManager(createChildMenuManager, createChildActions); } if (createSiblingMenuManager != null) { depopulateManager(createSiblingMenuManager, createSiblingActions); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) { Object object = ((IStructuredSelection)selection).getFirstElement(); EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain(); newChildDescriptors = domain.getNewChildDescriptors(object, null); newSiblingDescriptors = domain.getNewChildDescriptors(null, object); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions(newChildDescriptors, selection); createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection); if (createChildMenuManager != null) { populateManager(createChildMenuManager, createChildActions, null); createChildMenuManager.update(true); } if (createSiblingMenuManager != null) { populateManager(createSiblingMenuManager, createSiblingActions, null); createSiblingMenuManager.update(true); }
if (createChildMenuManager != null) { depopulateManager(createChildMenuManager, createChildActions); } if (createSiblingMenuManager != null) { depopulateManager(createSiblingMenuManager, createSiblingActions); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) { Object object = ((IStructuredSelection)selection).getFirstElement(); EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain(); newChildDescriptors = domain.getNewChildDescriptors(object, null); newSiblingDescriptors = domain.getNewChildDescriptors(null, object); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions(newChildDescriptors, selection); createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection); if (createChildMenuManager != null) { populateManager(createChildMenuManager, createChildActions, null); createChildMenuManager.update(true); } if (createSiblingMenuManager != null) { populateManager(createSiblingMenuManager, createSiblingActions, null); createSiblingMenuManager.update(true); }
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 selectionChangedGen(SelectionChangedEvent) Method name: void selectionChanged(SelectionChangedEvent)
Number of AST nodes: 20 Number of AST nodes: 20
1
if (createChildMenuManager != null)
1
if (createChildMenuManager != null)
2
    {
2
    {
3
      depopulateManager(createChildMenuManager, createChildActions);
3
      depopulateManager(createChildMenuManager, createChildActions);
4
    }
4
    }
5
    if (createSiblingMenuManager != null)
5
    if (createSiblingMenuManager != null)
6
    {
6
    {
7
      depopulateManager(createSiblingMenuManager, createSiblingActions);
7
      depopulateManager(createSiblingMenuManager, createSiblingActions);
8
    }
8
    }
9
    // Query the new selection for appropriate new child/sibling descriptors
9
    // Query the new selection for appropriate new child/sibling descriptors
10
    //
10
    //
11
    Collection<?> newChildDescriptors = null;
11
    Collection<?> newChildDescriptors = null;
12
    Collection<?> newSiblingDescriptors = null;
12
    Collection<?> newSiblingDescriptors = null;
13
    ISelection selection = event.getSelection();
13
    ISelection selection = event.getSelection();
14
    if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1)
14
    if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1)
15
    {
15
    {
16
      Object object = ((IStructuredSelection)selection).getFirstElement();
16
      Object object = ((IStructuredSelection)selection).getFirstElement();
17
      EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();
17
      EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();
18
      newChildDescriptors = domain.getNewChildDescriptors(object, null);
18
      newChildDescriptors = domain.getNewChildDescriptors(object, null);
19
      newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
19
      newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
20
    }
20
    }
21
    // Generate actions for selection; populate and redraw the menus.
21
    // Generate actions for selection; populate and redraw the menus.
22
    //
22
    //
23
    createChildActions = generateCreateChildActions(newChildDescriptors, selection);
23
    createChildActions = generateCreateChildActions(newChildDescriptors, selection);
24
    createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);
24
    createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);
25
    if (createChildMenuManager != null)
25
    if (createChildMenuManager != null)
26
    {
26
    {
27
      populateManager(createChildMenuManager, createChildActions, null);
27
      populateManager(createChildMenuManager, createChildActions, null);
28
      createChildMenuManager.update(true);
28
      createChildMenuManager.update(true);
29
    }
29
    }
30
    if (createSiblingMenuManager != null)
30
    if (createSiblingMenuManager != null)
31
    {
31
    {
32
      populateManager(createSiblingMenuManager, createSiblingActions, null);
32
      populateManager(createSiblingMenuManager, createSiblingActions, null);
33
      createSiblingMenuManager.update(true);
33
      createSiblingMenuManager.update(true);
34
    }
34
    }
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)1.8
Clones locationClones are in different classes having the same super class
Number of node comparisons160
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements20
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)22.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (createChildMenuManager != null)
    1
    if (createChildMenuManager != null)
    2
    depopulateManager(createChildMenuManager, createChildActions);
    2
    depopulateManager(createChildMenuManager, createChildActions);
    3
    if (createSiblingMenuManager != null)
    3
    if (createSiblingMenuManager != null)
    4
    depopulateManager(createSiblingMenuManager, createSiblingActions);
    4
    depopulateManager(createSiblingMenuManager, createSiblingActions);
    5
    Collection<?> newChildDescriptors = null;
    5
    Collection<?> newChildDescriptors = null;
    6
    Collection<?> newSiblingDescriptors = null;
    6
    Collection<?> newSiblingDescriptors = null;
    7
    ISelection selection = event.getSelection();
    7
    ISelection selection = event.getSelection();
    8
    if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1)
    8
    if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1)
    9
    Object object = ((IStructuredSelection)selection).getFirstElement();
    9
    Object object = ((IStructuredSelection)selection).getFirstElement();
    10
    EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();
    10
    EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();
    11
    newChildDescriptors = domain.getNewChildDescriptors(object, null);
    11
    newChildDescriptors = domain.getNewChildDescriptors(object, null);
    12
    newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
    12
    newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
    13
    createChildActions = generateCreateChildActions(newChildDescriptors, selection);
    13
    createChildActions = generateCreateChildActions(newChildDescriptors, selection);
    13
    createChildActions = generateCreateChildActions(newChildDescriptors, selection);
    Differences
    Expression1Expression2Difference
    java.util.Collection<>java.util.Collection<>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Collection<> of variable newChildDescriptors does not match with type java.util.Collection<> of variable newChildDescriptors
    • Make classes java.util.Collection<> and java.util.Collection<> extend a common superclass
    13
    createChildActions = generateCreateChildActions(newChildDescriptors, selection);
    14
    createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);
    14
    createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);
    14
    createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);
    Differences
    Expression1Expression2Difference
    java.util.Collection<>java.util.Collection<>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Collection<> of variable newSiblingDescriptors does not match with type java.util.Collection<> of variable newSiblingDescriptors
    • Make classes java.util.Collection<> and java.util.Collection<> extend a common superclass
    14
    createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);
    15
    if (createChildMenuManager != null)
    15
    if (createChildMenuManager != null)
    16
    populateManager(createChildMenuManager, createChildActions, null);
    16
    populateManager(createChildMenuManager, createChildActions, null);
    17
    createChildMenuManager.update(true);
    17
    createChildMenuManager.update(true);
    18
    if (createSiblingMenuManager != null)
    18
    if (createSiblingMenuManager != null)
    19
    populateManager(createSiblingMenuManager, createSiblingActions, null);
    19
    populateManager(createSiblingMenuManager, createSiblingActions, null);
    20
    createSiblingMenuManager.update(true);
    20
    createSiblingMenuManager.update(true);
    Precondition Violations (2)
    Row Violation
    1Type java.util.Collection<> of variable newChildDescriptors does not match with type java.util.Collection<> of variable newChildDescriptors
    2Type java.util.Collection<> of variable newSiblingDescriptors does not match with type java.util.Collection<> of variable newSiblingDescriptors