if (editorToOpen != null) { Button openButton = new Button(buttonComposite, SWT.PUSH); openButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL)); openButton.setText(CommonUIPlugin.getPlugin().getString("_UI_ErrorEditor_OpenEditor_label")); openButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { openEditor(); } }); }
if (markerUtil != null) { Button createMarkersButton = new Button(buttonComposite, SWT.PUSH); createMarkersButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL)); createMarkersButton.setText(CommonUIPlugin.getPlugin().getString("_UI_ErrorEditor_CreateMarkers_label")); createMarkersButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { createMarkers(); } }); }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/common/ui/editor/ProblemEditorPart.java File path: /emf-2.4.1/src/org/eclipse/emf/common/ui/editor/ProblemEditorPart.java
Method name: void createPartControl(Composite) Method name: void createPartControl(Composite)
Number of AST nodes: 5 Number of AST nodes: 5
1
if (editorToOpen != null)
1
if (markerUtil != null)
2
    {
2
    {
3
      Button openButton = new Button(buttonComposite, SWT.PUSH);
3
      Button createMarkersButton = new Button(buttonComposite, SWT.PUSH);
4
      openButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL));
4
      createMarkersButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL));
5
      openButton.setText(CommonUIPlugin.getPlugin().getString("_UI_ErrorEditor_OpenEditor_label"));
5
      createMarkersButton.setText(CommonUIPlugin.getPlugin().getString("_UI_ErrorEditor_CreateMarkers_label"));
6
      openButton.addSelectionListener(new SelectionAdapter()
6
      createMarkersButton.addSelectionListener(new SelectionAdapter()
7
        {
7
        {
8
          @Override
8
          @Override
9
          public void widgetSelected(SelectionEvent e)
9
          public void widgetSelected(SelectionEvent e)
10
          {
10
          {
11
            openEditor();
11
            createMarkers();
12
          }
12
          }
13
        });
13
        });
14
    }
14
    }
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.1
Clones locationClones are in the same method
Number of node comparisons25
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    27
    if (editorToOpen != null)
    27
    if (editorToOpen != null)
    32
    if (markerUtil != null)
    Differences
    Expression1Expression2Difference
    editorToOpenmarkerUtilVARIABLE_NAME_MISMATCH
    java.lang.Stringorg.eclipse.emf.common.ui.MarkerHelperVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable editorToOpen does not match with type org.eclipse.emf.common.ui.MarkerHelper of variable markerUtil
    • Make classes java.lang.String and org.eclipse.emf.common.ui.MarkerHelper extend a common superclass
    32
    if (markerUtil != null)
    28
    Button openButton = new Button(buttonComposite, SWT.PUSH);
    28
    Button openButton = new Button(buttonComposite, SWT.PUSH);
    33
    Button createMarkersButton = new Button(buttonComposite, SWT.PUSH);
    Differences
    Expression1Expression2Difference
    openButtoncreateMarkersButtonVARIABLE_NAME_MISMATCH
    33
    Button createMarkersButton = new Button(buttonComposite, SWT.PUSH);
    29
    openButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL));
    29
    openButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL));
    34
    createMarkersButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL));
    Differences
    Expression1Expression2Difference
    openButtoncreateMarkersButtonVARIABLE_NAME_MISMATCH
    34
    createMarkersButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL));
    30
    openButton.setText(CommonUIPlugin.getPlugin().getString("_UI_ErrorEditor_OpenEditor_label"));
    30
    openButton.setText(CommonUIPlugin.getPlugin().getString("_UI_ErrorEditor_OpenEditor_label"));
    35
    createMarkersButton.setText(CommonUIPlugin.getPlugin().getString("_UI_ErrorEditor_CreateMarkers_label"));
    Differences
    Expression1Expression2Difference
    "_UI_ErrorEditor_OpenEditor_label""_UI_ErrorEditor_CreateMarkers_label"LITERAL_VALUE_MISMATCH
    openButtoncreateMarkersButtonVARIABLE_NAME_MISMATCH
    35
    createMarkersButton.setText(CommonUIPlugin.getPlugin().getString("_UI_ErrorEditor_CreateMarkers_label"));
    31
    openButton.addSelectionListener(new SelectionAdapter() {...});
    31
    openButton.addSelectionListener(new SelectionAdapter() {...});
    36
    createMarkersButton.addSelectionListener(new SelectionAdapter() {...});
    Differences
    Expression1Expression2Difference
    openEditorcreateMarkersMETHOD_INVOCATION_NAME_MISMATCH
    openButtoncreateMarkersButtonVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression openEditor() is a void method call, and thus it cannot be parameterized
    Expression createMarkers() is a void method call, and thus it cannot be parameterized
    36
    createMarkersButton.addSelectionListener(new SelectionAdapter() {...});
    Precondition Violations (3)
    Row Violation
    1Type java.lang.String of variable editorToOpen does not match with type org.eclipse.emf.common.ui.MarkerHelper of variable markerUtil
    2Expression openEditor() is a void method call, and thus it cannot be parameterized
    3Expression createMarkers() is a void method call, and thus it cannot be parameterized