FontButton btn = (FontButton) evt.getSource(); FontInfo fi = btn.getFontInfo(); Font font = null; if (fi != null) { font = fi.createFont(); } font = new FontChooser().showDialog(font); if (font != null) { btn.setSelectedFont(font); btn._lbl.setText(new FontInfo(font).toString()); }
FontButton btn = (FontButton) evt.getSource(); FontInfo fi = btn.getFontInfo(); Font font = null; if (fi != null) { font = fi.createFont(); } font = new FontChooser().showDialog(font); if (font != null) { btn.setSelectedFont(font); btn._lbl.setText(new FontInfo(font).toString()); }
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/session/properties/SessionSQLPropertiesPanel.java File path: /sql12/plugins/laf/src/net/sourceforge/squirrel_sql/plugins/laf/LAFFontsTab.java
Method name: void actionPerformed(ActionEvent) Method name: void actionPerformed(ActionEvent)
Number of AST nodes: 9 Number of AST nodes: 9
1
FontButton btn = (FontButton) evt.getSource();
1
FontButton btn = (FontButton) evt.getSource();
2
					FontInfo fi = btn.getFontInfo();
2
					FontInfo fi = btn.getFontInfo();
3
					Font font = null;
3
					Font font = null;
4
					if (fi != null)
4
					if (fi != null)
5
					{
5
					{
6
						font = fi.createFont();
6
						font = fi.createFont();
7
					}
7
					}
8
					font = new FontChooser().showDialog(font);
8
					font = new FontChooser().showDialog(font);
9
					if (font != null)
9
					if (font != null)
10
					{
10
					{
11
						btn.setSelectedFont(font);
11
						btn.setSelectedFont(font);
12
						btn._lbl.setText(new FontInfo(font).toString());
12
						btn._lbl.setText(new FontInfo(font).toString());
13
					}
13
					}
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.7
Clones locationClones are in different classes
Number of node comparisons37
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)11.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    FontButton btn = (FontButton)evt.getSource();
    2
    FontButton btn = (FontButton)evt.getSource();
    2
    FontButton btn = (FontButton)evt.getSource();
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.client.session.properties.SessionSQLPropertiesPanel.SQLPropertiesPanel.FontButtonnet.sourceforge.squirrel_sql.plugins.laf.LAFFontsTab.FontSelectionPanel.FontButtonSUBCLASS_TYPE_MISMATCH
    net.sourceforge.squirrel_sql.client.session.properties.SessionSQLPropertiesPanel.SQLPropertiesPanel.FontButtonnet.sourceforge.squirrel_sql.plugins.laf.LAFFontsTab.FontSelectionPanel.FontButtonSUBCLASS_TYPE_MISMATCH
    net.sourceforge.squirrel_sql.client.session.properties.SessionSQLPropertiesPanel.SQLPropertiesPanel.FontButtonnet.sourceforge.squirrel_sql.plugins.laf.LAFFontsTab.FontSelectionPanel.FontButtonSUBCLASS_TYPE_MISMATCH
    2
    FontButton btn = (FontButton)evt.getSource();
    3
    FontInfo fi = btn.getFontInfo();
    3
    FontInfo fi = btn.getFontInfo();
    3
    FontInfo fi = btn.getFontInfo();
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.client.session.properties.SessionSQLPropertiesPanel.SQLPropertiesPanel.FontButtonnet.sourceforge.squirrel_sql.plugins.laf.LAFFontsTab.FontSelectionPanel.FontButtonSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression btn cannot be unified with expression btn , because common superclass javax.swing.JButton does not declare member(s) net.sourceforge.squirrel_sql.fw.gui.FontInfo getFontInfo()
    3
    FontInfo fi = btn.getFontInfo();
    4
    Font font = null;
    4
    Font font = null;
    5
    if (fi != null)
    5
    if (fi != null)
    6
    font = fi.createFont();
    6
    font = fi.createFont();
    7
    font = new FontChooser().showDialog(font);
    7
    font = new FontChooser().showDialog(font);
    8
    if (font != null)
    8
    if (font != null)
    9
    btn.setSelectedFont(font);
    9
    btn.setSelectedFont(font);
    9
    btn.setSelectedFont(font);
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.client.session.properties.SessionSQLPropertiesPanel.SQLPropertiesPanel.FontButtonnet.sourceforge.squirrel_sql.plugins.laf.LAFFontsTab.FontSelectionPanel.FontButtonSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression btn cannot be unified with expression btn , because common superclass javax.swing.JButton does not declare member(s) void setSelectedFont(java.awt.Font)
    9
    btn.setSelectedFont(font);
    10
    btn._lbl.setText(new FontInfo(font).toString());
    10
    btn._lbl.setText(new FontInfo(font).toString());
    10
    btn._lbl.setText(new FontInfo(font).toString());
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.client.session.properties.SessionSQLPropertiesPanel.SQLPropertiesPanel.FontButtonnet.sourceforge.squirrel_sql.plugins.laf.LAFFontsTab.FontSelectionPanel.FontButtonSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression btn._lbl cannot be unified with expression btn._lbl , because common superclass javax.swing.JButton does not declare member(s) private javax.swing.JLabel _lbl
    10
    btn._lbl.setText(new FontInfo(font).toString());
    Precondition Violations (3)
    Row Violation
    1Expression btn cannot be unified with expression btn , because common superclass javax.swing.JButton does not declare member(s) net.sourceforge.squirrel_sql.fw.gui.FontInfo getFontInfo()
    2Expression btn cannot be unified with expression btn , because common superclass javax.swing.JButton does not declare member(s) void setSelectedFont(java.awt.Font)
    3Expression btn._lbl cannot be unified with expression btn._lbl , because common superclass javax.swing.JButton does not declare member(s) private javax.swing.JLabel _lbl