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]; } } } );
selectTickLabelFontButton.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[] { SWTAxisEditor.this.tickLabelFont}); 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()); //tickLabelFontField.setFont(font); SWTAxisEditor.this.tickLabelFontField.setText( SWTAxisEditor.this.font.getFontData()[0] .toString()); SWTAxisEditor.this.tickLabelFont = SWTAxisEditor.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/SWTAxisEditor.java
Method name: void SWTAxisEditor(Composite, int, Axis) Method name: void SWTAxisEditor(Composite, int, Axis)
Number of AST nodes: 1 Number of AST nodes: 1
1
selectFontButton.addSelectionListener(
1
selectTickLabelFontButton.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
                                SWTAxisEditor.this.tickLabelFont});
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 (SWTAxisEditor.this.font != null) {
13
                                SWTAxisEditor.this.font.dispose();
13
                                SWTAxisEditor.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
                            SWTAxisEditor.this.font = new Font(
18
                                    getShell().getDisplay(), dlg.getFontList());
18
                                    getShell().getDisplay(), dlg.getFontList());
19
                            //label.setFont(font);
19
                            //tickLabelFontField.setFont(font);
20
                            SWTAxisEditor.this.labelFontField.setText(
20
                            SWTAxisEditor.this.tickLabelFontField.setText(
21
                                    SWTAxisEditor.this.font.getFontData()[0]
21
                                    SWTAxisEditor.this.font.getFontData()[0]
22
                                    .toString());
22
                                    .toString());
23
                            SWTAxisEditor.this.labelFont 
23
                            SWTAxisEditor.this.tickLabelFont 
24
                                    = SWTAxisEditor.this.font.getFontData()[0];
24
                                    = SWTAxisEditor.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 the same method
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() {...});
    53
    selectTickLabelFontButton.addSelectionListener(new SelectionAdapter() {...});
    Differences
    Expression1Expression2Difference
    labelFonttickLabelFontVARIABLE_NAME_MISMATCH
    labelFontFieldtickLabelFontFieldVARIABLE_NAME_MISMATCH
    labelFonttickLabelFontVARIABLE_NAME_MISMATCH
    selectFontButtonselectTickLabelFontButtonVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression SWTAxisEditor.this.labelFont cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression SWTAxisEditor.this.tickLabelFont cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression SWTAxisEditor.this.labelFont cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression SWTAxisEditor.this.tickLabelFont 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 SWTAxisEditor.this.tickLabelFont is a field being modified, and thus it cannot be parameterized
    53
    selectTickLabelFontButton.addSelectionListener(new SelectionAdapter() {...});
    Precondition Violations (6)
    Row Violation
    1Expression SWTAxisEditor.this.labelFont cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression SWTAxisEditor.this.tickLabelFont cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression SWTAxisEditor.this.labelFont cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression SWTAxisEditor.this.tickLabelFont cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression SWTAxisEditor.this.labelFont is a field being modified, and thus it cannot be parameterized
    6Expression SWTAxisEditor.this.tickLabelFont is a field being modified, and thus it cannot be parameterized