selectColorButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { // Create the color-change dialog ColorDialog dlg = new ColorDialog(getShell()); dlg.setText(localizationResources.getString( "Title_Color")); dlg.setRGB(SWTAxisEditor.this.labelPaintColor.getRGB()); RGB rgb = dlg.open(); if (rgb != null) { // create the new color and set it to the // SwtPaintCanvas SWTAxisEditor.this.labelPaintColor = new Color( getDisplay(), rgb); colorCanvas.setColor( SWTAxisEditor.this.labelPaintColor); } } } );
this.selectColorButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { // Create the color-change dialog ColorDialog dlg = new ColorDialog(getShell()); dlg.setText(localizationResources.getString( "Title_Color")); dlg.setRGB(SWTTitleEditor.this.titleColor.getRGB()); RGB rgb = dlg.open(); if (rgb != null) { // create the new color and set it to the // SwtPaintCanvas SWTTitleEditor.this.titleColor = new Color( getDisplay(), rgb); colorCanvas.setColor( SWTTitleEditor.this.titleColor); } } } );
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/swt/org/jfree/experimental/chart/swt/editor/SWTAxisEditor.java File path: /jfreechart-1.0.10/swt/org/jfree/experimental/chart/swt/editor/SWTTitleEditor.java
Method name: void SWTAxisEditor(Composite, int, Axis) Method name: void SWTTitleEditor(Composite, int, Title)
Number of AST nodes: 1 Number of AST nodes: 1
1
selectColorButton.addSelectionListener(
1
this.selectColorButton.addSelectionListener(
2
                new SelectionAdapter() {
2
                new SelectionAdapter() {
3
                    public void widgetSelected(SelectionEvent event) {
3
                    public void widgetSelected(SelectionEvent event) {
4
                        // Create the color-change dialog
4
                        // Create the color-change dialog
5
                        ColorDialog dlg = new ColorDialog(getShell());
5
                        ColorDialog dlg = new ColorDialog(getShell());
6
                        dlg.setText(localizationResources.getString(
6
                        dlg.setText(localizationResources.getString(
7
                                "Title_Color"));
7
                                "Title_Color"));
8
                        dlg.setRGB(SWTAxisEditor.this.labelPaintColor.getRGB());
8
                        dlg.setRGB(SWTTitleEditor.this.titleColor.getRGB());
9
                        RGB rgb = dlg.open();
9
                        RGB rgb = dlg.open();
10
                        if (rgb != null) {
10
                        if (rgb != null) {
11
                          // create the new color and set it to the 
11
                            // create the new color and set it to the 
12
                          // SwtPaintCanvas
12
                            // SwtPaintCanvas
13
                            SWTAxisEditor.this.labelPaintColor = new Color(
13
                            SWTTitleEditor.this.titleColor = new Color(
14
                                    getDisplay(), rgb);
14
                                    getDisplay(), rgb);
15
                            colorCanvas.setColor(
15
                            colorCanvas.setColor(
16
                                    SWTAxisEditor.this.labelPaintColor);
16
                                    SWTTitleEditor.this.titleColor);
17
                        }
17
                        }
18
                    }
18
                    }
19
                }
19
                }
20
        );
20
        );
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.0
Clones locationClones are in different classes having the same super class
Number of node comparisons1
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    32
    selectColorButton.addSelectionListener(new SelectionAdapter() {...});
    32
    selectColorButton.addSelectionListener(new SelectionAdapter() {...});
    40
    this.selectColorButton.addSelectionListener(new SelectionAdapter() {...});
    Differences
    Expression1Expression2Difference
    org.jfree.experimental.chart.swt.editor.SWTAxisEditororg.jfree.experimental.chart.swt.editor.SWTTitleEditorSUBCLASS_TYPE_MISMATCH
    labelPaintColortitleColorVARIABLE_NAME_MISMATCH
    org.jfree.experimental.chart.swt.editor.SWTAxisEditororg.jfree.experimental.chart.swt.editor.SWTTitleEditorSUBCLASS_TYPE_MISMATCH
    labelPaintColortitleColorVARIABLE_NAME_MISMATCH
    org.jfree.experimental.chart.swt.editor.SWTAxisEditororg.jfree.experimental.chart.swt.editor.SWTTitleEditorSUBCLASS_TYPE_MISMATCH
    labelPaintColortitleColorVARIABLE_NAME_MISMATCH
    selectColorButtonthis.selectColorButtonTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression SWTAxisEditor cannot be unified with expression SWTTitleEditor , because common superclass org.eclipse.swt.widgets.Composite does not declare member(s) protected static java.util.ResourceBundle localizationResources
    Expression SWTAxisEditor.this.labelPaintColor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression SWTTitleEditor.this.titleColor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression SWTAxisEditor cannot be unified with expression SWTTitleEditor , because common superclass org.eclipse.swt.widgets.Composite does not declare member(s) protected static java.util.ResourceBundle localizationResources
    Expression SWTAxisEditor.this.labelPaintColor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression SWTTitleEditor.this.titleColor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression SWTAxisEditor.this.labelPaintColor is a field being modified, and thus it cannot be parameterized
    Expression SWTTitleEditor.this.titleColor is a field being modified, and thus it cannot be parameterized
    Expression SWTAxisEditor cannot be unified with expression SWTTitleEditor , because common superclass org.eclipse.swt.widgets.Composite does not declare member(s) protected static java.util.ResourceBundle localizationResources
    Expression SWTAxisEditor.this.labelPaintColor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression SWTTitleEditor.this.titleColor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    40
    this.selectColorButton.addSelectionListener(new SelectionAdapter() {...});
    Precondition Violations (11)
    Row Violation
    1Expression SWTAxisEditor cannot be unified with expression SWTTitleEditor , because common superclass org.eclipse.swt.widgets.Composite does not declare member(s) protected static java.util.ResourceBundle localizationResources
    2Expression SWTAxisEditor.this.labelPaintColor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression SWTTitleEditor.this.titleColor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression SWTAxisEditor cannot be unified with expression SWTTitleEditor , because common superclass org.eclipse.swt.widgets.Composite does not declare member(s) protected static java.util.ResourceBundle localizationResources
    5Expression SWTAxisEditor.this.labelPaintColor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression SWTTitleEditor.this.titleColor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression SWTAxisEditor.this.labelPaintColor is a field being modified, and thus it cannot be parameterized
    8Expression SWTTitleEditor.this.titleColor is a field being modified, and thus it cannot be parameterized
    9Expression SWTAxisEditor cannot be unified with expression SWTTitleEditor , because common superclass org.eclipse.swt.widgets.Composite does not declare member(s) protected static java.util.ResourceBundle localizationResources
    10Expression SWTAxisEditor.this.labelPaintColor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression SWTTitleEditor.this.titleColor cannot be parameterized, because it has dependencies to/from statements that will be extracted