selectFontButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { // Create the color-change dialog FontDialog dlg = new FontDialog(getShell()); dlg.setText(localizationResources.getString( "Font_Selection")); dlg.setFontList(new FontData[] { SWTAxisEditor.this.labelFont }); if (dlg.open() != null) { // Dispose of any fonts we have created if (SWTAxisEditor.this.font != null) { SWTAxisEditor.this.font.dispose(); } // Create the new font and set it into the title // label SWTAxisEditor.this.font = new Font( getShell().getDisplay(), dlg.getFontList()); //label.setFont(font); SWTAxisEditor.this.labelFontField.setText( SWTAxisEditor.this.font.getFontData()[0] .toString()); SWTAxisEditor.this.labelFont = SWTAxisEditor.this.font.getFontData()[0]; } } } );
this.selectFontButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { // Create the font-change dialog FontDialog dlg = new FontDialog(getShell()); dlg.setText(localizationResources.getString( "Font_Selection")); dlg.setFontList(new FontData[] { SWTTitleEditor.this.titleFont }); if (dlg.open() != null) { // Dispose of any fonts we have created if (SWTTitleEditor.this.font != null) { SWTTitleEditor.this.font.dispose(); } // Create the new font and set it into the title // label SWTTitleEditor.this.font = new Font( getShell().getDisplay(), dlg.getFontList()); //titleField.setFont(font); SWTTitleEditor.this.fontField.setText( SWTTitleEditor.this.font.getFontData()[0] .toString()); SWTTitleEditor.this.titleFont = SWTTitleEditor.this.font.getFontData()[0]; } } } );
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
selectFontButton.addSelectionListener(
1
this.selectFontButton.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 font-change dialog
5
                        FontDialog dlg = new FontDialog(getShell());
5
                        FontDialog dlg = new FontDialog(getShell());
6
                        dlg.setText(localizationResources.getString(
6
                        dlg.setText(localizationResources.getString(
7
                                "Font_Selection"));
7
                                "Font_Selection"));
8
                        dlg.setFontList(new FontData[] { 
8
                        dlg.setFontList(new FontData[] { 
9
                                SWTAxisEditor.this.labelFont });
9
                                SWTTitleEditor.this.titleFont });
10
                        if (dlg.open() != null) {
10
                        if (dlg.open() != null) {
11
                            // Dispose of any fonts we have created
11
                            // Dispose of any fonts we have created
12
                            if (SWTAxisEditor.this.font != null) {
12
                            if (SWTTitleEditor.this.font != null) {
13
                                SWTAxisEditor.this.font.dispose();
13
                                SWTTitleEditor.this.font.dispose();
14
                            }
14
                            }
15
                            // Create the new font and set it into the title 
15
                            // Create the new font and set it into the title 
16
                            // label
16
                            // label
17
                            SWTAxisEditor.this.font = new Font(
17
                            SWTTitleEditor.this.font = new Font(
18
                                    getShell().getDisplay(), dlg.getFontList());
18
                                    getShell().getDisplay(), dlg.getFontList());
19
                            //label.setFont(font);
19
                            //titleField.setFont(font);
20
                            SWTAxisEditor.this.labelFontField.setText(
20
                            SWTTitleEditor.this.fontField.setText(
21
                                    SWTAxisEditor.this.font.getFontData()[0]
21
                                    SWTTitleEditor.this.font.getFontData()[0]
22
                                    .toString());
22
                                    .toString());
23
                            SWTAxisEditor.this.labelFont 
23
                            SWTTitleEditor.this.titleFont 
24
                                    = SWTAxisEditor.this.font.getFontData()[0];
24
                                    = SWTTitleEditor.this.font.getFontData()[0];
25
                        }
25
                        }
26
                    }
26
                    }
27
                }
27
                }
28
        );
28
        );
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
    24
    selectFontButton.addSelectionListener(new SelectionAdapter() {...});
    24
    selectFontButton.addSelectionListener(new SelectionAdapter() {...});
    32
    this.selectFontButton.addSelectionListener(new SelectionAdapter() {...});
    Differences
    Expression1Expression2Difference
    org.jfree.experimental.chart.swt.editor.SWTAxisEditororg.jfree.experimental.chart.swt.editor.SWTTitleEditorSUBCLASS_TYPE_MISMATCH
    labelFonttitleFontVARIABLE_NAME_MISMATCH
    org.jfree.experimental.chart.swt.editor.SWTAxisEditororg.jfree.experimental.chart.swt.editor.SWTTitleEditorSUBCLASS_TYPE_MISMATCH
    org.jfree.experimental.chart.swt.editor.SWTAxisEditororg.jfree.experimental.chart.swt.editor.SWTTitleEditorSUBCLASS_TYPE_MISMATCH
    org.jfree.experimental.chart.swt.editor.SWTAxisEditororg.jfree.experimental.chart.swt.editor.SWTTitleEditorSUBCLASS_TYPE_MISMATCH
    org.jfree.experimental.chart.swt.editor.SWTAxisEditororg.jfree.experimental.chart.swt.editor.SWTTitleEditorSUBCLASS_TYPE_MISMATCH
    org.jfree.experimental.chart.swt.editor.SWTAxisEditororg.jfree.experimental.chart.swt.editor.SWTTitleEditorSUBCLASS_TYPE_MISMATCH
    labelFontFieldfontFieldVARIABLE_NAME_MISMATCH
    org.jfree.experimental.chart.swt.editor.SWTAxisEditororg.jfree.experimental.chart.swt.editor.SWTTitleEditorSUBCLASS_TYPE_MISMATCH
    labelFonttitleFontVARIABLE_NAME_MISMATCH
    org.jfree.experimental.chart.swt.editor.SWTAxisEditororg.jfree.experimental.chart.swt.editor.SWTTitleEditorSUBCLASS_TYPE_MISMATCH
    selectFontButtonthis.selectFontButtonTYPE_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.labelFont cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression SWTTitleEditor.this.titleFont 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 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 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 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 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 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.labelFont cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression SWTTitleEditor.this.titleFont cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression SWTAxisEditor.this.labelFont is a field being modified, and thus it cannot be parameterized
    Expression SWTTitleEditor.this.titleFont 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
    32
    this.selectFontButton.addSelectionListener(new SelectionAdapter() {...});
    Precondition Violations (14)
    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.labelFont cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression SWTTitleEditor.this.titleFont 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 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
    6Expression 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
    7Expression 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
    8Expression 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
    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.labelFont cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression SWTTitleEditor.this.titleFont cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression SWTAxisEditor.this.labelFont is a field being modified, and thus it cannot be parameterized
    13Expression SWTTitleEditor.this.titleFont is a field being modified, and thus it cannot be parameterized
    14Expression 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