IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ? contentOutlineStatusLineManager : getActionBars().getStatusLineManager(); if (statusLineManager != null) { if (selection instanceof IStructuredSelection) { Collection<?> collection = ((IStructuredSelection)selection).toList(); switch (collection.size()) { case 0: { statusLineManager.setMessage(getString("_UI_NoObjectSelected")); //$NON-NLS-1$ break; } case 1: { String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next()); statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text)); //$NON-NLS-1$ break; } default: { statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size()))); //$NON-NLS-1$ break; } } } else { statusLineManager.setMessage(""); //$NON-NLS-1$ } }
IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ? contentOutlineStatusLineManager : getActionBars().getStatusLineManager(); if (statusLineManager != null) { if (selection instanceof IStructuredSelection) { Collection<?> collection = ((IStructuredSelection)selection).toList(); switch (collection.size()) { case 0: { statusLineManager.setMessage(getString("_UI_NoObjectSelected")); break; } case 1: { String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next()); statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text)); break; } default: { statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size()))); break; } } } else { statusLineManager.setMessage(""); } }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/mapping/ecore2xml/presentation/Ecore2XMLEditor.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/presentation/EcoreEditor.java
Method name: void setStatusLineManager(ISelection) Method name: void setStatusLineManager(ISelection)
Number of AST nodes: 16 Number of AST nodes: 16
1
IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ?
1
IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ?
2
      contentOutlineStatusLineManager : getActionBars().getStatusLineManager();
2
      contentOutlineStatusLineManager : getActionBars().getStatusLineManager();
3
    if (statusLineManager != null)
3
    if (statusLineManager != null)
4
    {
4
    {
5
      if (selection instanceof IStructuredSelection)
5
      if (selection instanceof IStructuredSelection)
6
      {
6
      {
7
        Collection<?> collection = ((IStructuredSelection)selection).toList();
7
        Collection<?> collection = ((IStructuredSelection)selection).toList();
8
        switch (collection.size())
8
        switch (collection.size())
9
        {
9
        {
10
          case 0:
10
          case 0:
11
          {
11
          {
12
            statusLineManager.setMessage(getString("_UI_NoObjectSelected")); //$NON-NLS-1$
12
            statusLineManager.setMessage(getString("_UI_NoObjectSelected"));
13
            break;
13
            break;
14
          }
14
          }
15
          case 1:
15
          case 1:
16
          {
16
          {
17
            String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next());
17
            String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next());
18
            statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text)); //$NON-NLS-1$
18
            statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text));
19
            break;
19
            break;
20
          }
20
          }
21
          default:
21
          default:
22
          {
22
          {
23
            statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size()))); //$NON-NLS-1$
23
            statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size())));
24
            break;
24
            break;
25
          }
25
          }
26
        }
26
        }
27
      }
27
      }
28
      else
28
      else
29
      {
29
      {
30
        statusLineManager.setMessage(""); //$NON-NLS-1$
30
        statusLineManager.setMessage("");
31
      }
31
      }
32
    }
32
    }
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.3
Clones locationClones are in different classes having the same super class
Number of node comparisons79
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements16
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3984.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ? contentOutlineStatusLineManager : getActionBars().getStatusLineManager();
    1
    IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ? contentOutlineStatusLineManager : getActionBars().getStatusLineManager();
    2
    if (statusLineManager != null)
    2
    if (statusLineManager != null)
    3
    if (selection instanceof IStructuredSelection)
    3
    if (selection instanceof IStructuredSelection)
    4
    Collection<?> collection = ((IStructuredSelection)selection).toList();
    4
    Collection<?> collection = ((IStructuredSelection)selection).toList();
    5
    switch (collection.size())
    5
    switch (collection.size())
    5
    switch (collection.size())
    Differences
    Expression1Expression2Difference
    java.util.Collection<>java.util.Collection<>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Collection<> of variable collection does not match with type java.util.Collection<> of variable collection
    • Make classes java.util.Collection<> and java.util.Collection<> extend a common superclass
    5
    switch (collection.size())
    6
    case 0:
    6
    case 0:
    7
    statusLineManager.setMessage(getString("_UI_NoObjectSelected"));
    7
    statusLineManager.setMessage(getString("_UI_NoObjectSelected"));
    8
    break;
    8
    break;
    9
    case 1:
    9
    case 1:
    10
    String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next());
    10
    String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next());
    10
    String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next());
    Differences
    Expression1Expression2Difference
    VARIABLE_TYPE_MISMATCH
    java.util.Iterator<>java.util.Iterator<>VARIABLE_TYPE_MISMATCH
    java.util.Collection<>java.util.Collection<>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression collection.iterator().next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression collection.iterator().next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type of variable collection.iterator().next() does not match with type of variable collection.iterator().next()
    • Make classes and extend a common superclass
    Expression collection.iterator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression collection.iterator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.util.Iterator<> of variable collection.iterator() does not match with type java.util.Iterator<> of variable collection.iterator()
    • Make classes java.util.Iterator<> and java.util.Iterator<> extend a common superclass
    Type java.util.Collection<> of variable collection does not match with type java.util.Collection<> of variable collection
    • Make classes java.util.Collection<> and java.util.Collection<> extend a common superclass
    10
    String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next());
    11
    statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text));
    11
    statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text));
    12
    break;
    12
    break;
    13
    default:
    13
    default:
    14
    statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size())));
    14
    statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size())));
    14
    statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size())));
    Differences
    Expression1Expression2Difference
    java.util.Collection<>java.util.Collection<>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Collection<> of variable collection does not match with type java.util.Collection<> of variable collection
    • Make classes java.util.Collection<> and java.util.Collection<> extend a common superclass
    14
    statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size())));
    15
    break;
    15
    break;
    else
    else
    16
    statusLineManager.setMessage("");
    16
    statusLineManager.setMessage("");
    Precondition Violations (9)
    Row Violation
    1Type java.util.Collection<> of variable collection does not match with type java.util.Collection<> of variable collection
    2Expression collection.iterator().next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression collection.iterator().next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Type of variable collection.iterator().next() does not match with type of variable collection.iterator().next()
    5Expression collection.iterator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression collection.iterator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Type java.util.Iterator<> of variable collection.iterator() does not match with type java.util.Iterator<> of variable collection.iterator()
    8Type java.util.Collection<> of variable collection does not match with type java.util.Collection<> of variable collection
    9Type java.util.Collection<> of variable collection does not match with type java.util.Collection<> of variable collection