statusBarBackgroundColorChk.setSelected(_props.isOverrideStatusBarBackgroundColor()); add(statusBarBackgroundColorChk, gbc); // Set object tree color button ++gbc.gridx; statusBarBackgroundColorBtn = new JButton(i18n.STATUS_BAR_BACKGROUND_COLOR_BUTTON_LABEL); add(statusBarBackgroundColorBtn, gbc); // Set object tree color panel ++gbc.gridx; gbc.anchor = GridBagConstraints.EAST; gbc.fill = GridBagConstraints.HORIZONTAL; statusBarBackgroundColorChk.setSelected(_props.isOverrideStatusBarBackgroundColor()); statusBarBackgroundColorBtn.setEnabled(_props.isOverrideObjectTreeBackgroundColor()); statusBarBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL); statusBarBackgroundLbl.setEnabled(_props.isOverrideStatusBarBackgroundColor()); statusBarBackgroundColorPnl.add(statusBarBackgroundLbl); statusBarBackgroundColorPnl.setEnabled(_props.isOverrideStatusBarBackgroundColor()); if (_props.isOverrideStatusBarBackgroundColor()) { statusBarBackgroundColor = new Color(_props.getStatusBarBackgroundColorRgbValue()); statusBarBackgroundColorPnl.setBackground(statusBarBackgroundColor); } add(statusBarBackgroundColorPnl, gbc); statusBarBackgroundColorChk.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (statusBarBackgroundColorChk.isSelected()) { statusBarBackgroundColorBtn.setEnabled(true); statusBarBackgroundColorPnl.setEnabled(true); statusBarBackgroundLbl.setEnabled(true); } else { statusBarBackgroundColorBtn.setEnabled(false); statusBarBackgroundColorPnl.setEnabled(false); statusBarBackgroundLbl.setEnabled(false); } } }); statusBarBackgroundColorBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color startColor = statusBarBackgroundColor == null ? Color.WHITE : statusBarBackgroundColor; Color newColor = JColorChooser.showDialog(null, i18n.STATUS_BAR_BACKGROUND_COLOR_CHOOSER_DIALOG_TITLE, startColor); if (newColor != null) { statusBarBackgroundColor = newColor; statusBarBackgroundColorPnl.setBackground(newColor); statusBarBackgroundColorPnl.validate(); } } });
objectTreeBackgroundColorChk.setSelected(_props.isOverrideObjectTreeBackgroundColor()); add(objectTreeBackgroundColorChk, gbc); // Set object tree color button ++gbc.gridx; objectTreeBackgroundColorBtn = new JButton(i18n.OBJECT_TREE_BACKGROUND_COLOR_BUTTON_LABEL); add(objectTreeBackgroundColorBtn, gbc); // Set object tree color panel ++gbc.gridx; gbc.anchor = GridBagConstraints.EAST; gbc.fill = GridBagConstraints.HORIZONTAL; objectTreeBackgroundColorChk.setSelected(_props.isOverrideObjectTreeBackgroundColor()); objectTreeBackgroundColorBtn.setEnabled(_props.isOverrideObjectTreeBackgroundColor()); objectTreeBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL); objectTreeBackgroundColorPnl.add(objectTreeBackgroundLbl); objectTreeBackgroundColorPnl.setEnabled(_props.isOverrideObjectTreeBackgroundColor()); objectTreeBackgroundLbl.setEnabled(_props.isOverrideObjectTreeBackgroundColor()); if (_props.isOverrideObjectTreeBackgroundColor()) { objectTreeBackgroundColor = new Color(_props.getObjectTreeBackgroundColorRgbValue()); objectTreeBackgroundColorPnl.setBackground(objectTreeBackgroundColor); } add(objectTreeBackgroundColorPnl, gbc); objectTreeBackgroundColorChk.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (objectTreeBackgroundColorChk.isSelected()) { objectTreeBackgroundColorBtn.setEnabled(true); objectTreeBackgroundColorPnl.setEnabled(true); objectTreeBackgroundLbl.setEnabled(true); } else { objectTreeBackgroundColorBtn.setEnabled(false); objectTreeBackgroundColorPnl.setEnabled(false); objectTreeBackgroundLbl.setEnabled(false); } } }); objectTreeBackgroundColorBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color startColor = objectTreeBackgroundColor == null ? Color.WHITE : objectTreeBackgroundColor; Color newColor = JColorChooser.showDialog(null, i18n.OBJECT_TREE_BACKGROUND_COLOR_CHOOSER_DIALOG_TITLE, startColor); if (newColor != null) { objectTreeBackgroundColor = newColor; objectTreeBackgroundColorPnl.setBackground(newColor); objectTreeBackgroundColorPnl.validate(); } } });
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/gui/db/aliasproperties/ColorPropertiesPanel.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/gui/db/aliasproperties/ColorPropertiesPanel.java
Method name: void addStatusBarColorComponents(GridBagConstraints) Method name: void addObjectTreeColorComponents(GridBagConstraints)
Number of AST nodes: 20 Number of AST nodes: 20
1
statusBarBackgroundColorChk.setSelected(_props.isOverrideStatusBarBackgroundColor());
1
objectTreeBackgroundColorChk.setSelected(_props.isOverrideObjectTreeBackgroundColor());
2
		add(statusBarBackgroundColorChk, gbc);
2
		add(objectTreeBackgroundColorChk, gbc);
3
		// Set object tree color button
3
		// Set object tree color button
4
		++gbc.gridx;
4
		++gbc.gridx;
5
		statusBarBackgroundColorBtn = new JButton(i18n.STATUS_BAR_BACKGROUND_COLOR_BUTTON_LABEL);
5
		objectTreeBackgroundColorBtn = new JButton(i18n.OBJECT_TREE_BACKGROUND_COLOR_BUTTON_LABEL);
6
		add(statusBarBackgroundColorBtn, gbc);
6
		add(objectTreeBackgroundColorBtn, gbc);
7
		// Set object tree color panel
7
		// Set object tree color panel
8
		++gbc.gridx;
8
		++gbc.gridx;
9
		gbc.anchor = GridBagConstraints.EAST;
9
		gbc.anchor = GridBagConstraints.EAST;
10
		gbc.fill = GridBagConstraints.HORIZONTAL;
10
		gbc.fill = GridBagConstraints.HORIZONTAL;
11
		statusBarBackgroundColorChk.setSelected(_props.isOverrideStatusBarBackgroundColor());
11
		objectTreeBackgroundColorChk.setSelected(_props.isOverrideObjectTreeBackgroundColor());
12
		statusBarBackgroundColorBtn.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
12
		objectTreeBackgroundColorBtn.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
13
		statusBarBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL);
13
		objectTreeBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL);
14
		statusBarBackgroundLbl.setEnabled(_props.isOverrideStatusBarBackgroundColor());
14
		objectTreeBackgroundColorPnl.add(objectTreeBackgroundLbl);
15
		statusBarBackgroundColorPnl.add(statusBarBackgroundLbl);
15
		objectTreeBackgroundColorPnl.
16
		statusBar
16
setEnabled(_props.isOverrideObjectTreeBackgroundColor());
17
BackgroundColorPnl.setEnabled(_props.isOverrideStatusBarBackgroundColor());
17
		objectTreeBackgroundLbl.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
18
		if (_props.isOverrideStatusBarBackgroundColor())
18
		if (_props.isOverrideObjectTreeBackgroundColor())
19
		{
19
		{
20
			statusBarBackgroundColor = new Color(_props.getStatusBarBackgroundColorRgbValue());
20
			objectTreeBackgroundColor = new Color(_props.getObjectTreeBackgroundColorRgbValue());
21
			statusBarBackgroundColorPnl.setBackground(statusBarBackgroundColor);
21
			objectTreeBackgroundColorPnl.setBackground(objectTreeBackgroundColor);
22
		}
22
		}
23
		add(statusBarBackgroundColorPnl, gbc);
23
		add(objectTreeBackgroundColorPnl, gbc);
24
		statusBarBackgroundColorChk.addActionListener(new ActionListener()
24
		objectTreeBackgroundColorChk.addActionListener(new ActionListener()
25
		{
25
		{
26
			@Override
26
			@Override
27
			public void actionPerformed(ActionEvent e)
27
			public void actionPerformed(ActionEvent e)
28
			{
28
			{
29
				if (statusBarBackgroundColorChk.isSelected())
29
				if (objectTreeBackgroundColorChk.isSelected())
30
				{
30
				{
31
					statusBarBackgroundColorBtn.setEnabled(true);
31
					objectTreeBackgroundColorBtn.setEnabled(true);
32
					statusBarBackgroundColorPnl.setEnabled(true);
32
					objectTreeBackgroundColorPnl.setEnabled(true);
33
					statusBarBackgroundLbl.setEnabled(true);
33
					objectTreeBackgroundLbl.setEnabled(true);
34
				}
34
				}
35
				else
35
				else
36
				{
36
				{
37
					statusBarBackgroundColorBtn.setEnabled(false);
37
					objectTreeBackgroundColorBtn.setEnabled(false);
38
					statusBarBackgroundColorPnl.setEnabled(false);
38
					objectTreeBackgroundColorPnl.setEnabled(false);
39
					statusBarBackgroundLbl.setEnabled(false);
39
					objectTreeBackgroundLbl.setEnabled(false);
40
				}
40
				}
41
			}
41
			}
42
		});
42
		});
43
		statusBarBackgroundColorBtn.addActionListener(new ActionListener()
43
		objectTreeBackgroundColorBtn.addActionListener(new ActionListener()
44
		{
44
		{
45
			@Override
45
			@Override
46
			public void actionPerformed(ActionEvent e)
46
			public void actionPerformed(ActionEvent e)
47
			{
47
			{
48
				Color startColor = statusBarBackgroundColor == null ? Color.WHITE : statusBarBackgroundColor;
48
				Color startColor = objectTreeBackgroundColor == null ? Color.WHITE : objectTreeBackgroundColor;
49
				Color newColor =
49
				Color newColor =
50
					JColorChooser.showDialog(null, i18n.STATUS_BAR_BACKGROUND_COLOR_CHOOSER_DIALOG_TITLE,
50
					JColorChooser.showDialog(null, i18n.OBJECT_TREE_BACKGROUND_COLOR_CHOOSER_DIALOG_TITLE,
51
						startColor);
51
						startColor);
52
				if (newColor != null)
52
				if (newColor != null)
53
				{
53
				{
54
					statusBarBackgroundColor = newColor;
54
					objectTreeBackgroundColor = newColor;
55
					statusBarBackgroundColorPnl.setBackground(newColor);
55
					objectTreeBackgroundColorPnl.setBackground(newColor);
56
					statusBarBackgroundColorPnl.validate();
56
					objectTreeBackgroundColorPnl.validate();
57
				}
57
				}
58
			}
58
			}
59
		});
59
		});
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)2.2
Clones locationClones are declared in the same class
Number of node comparisons163
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements20
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)140.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    statusBarBackgroundColorChk.setSelected(_props.isOverrideStatusBarBackgroundColor());
    1
    statusBarBackgroundColorChk.setSelected(_props.isOverrideStatusBarBackgroundColor());
    1
    objectTreeBackgroundColorChk.setSelected(_props.isOverrideObjectTreeBackgroundColor());
    Differences
    Expression1Expression2Difference
    isOverrideStatusBarBackgroundColorisOverrideObjectTreeBackgroundColorMETHOD_INVOCATION_NAME_MISMATCH
    statusBarBackgroundColorChkobjectTreeBackgroundColorChkVARIABLE_NAME_MISMATCH
    1
    objectTreeBackgroundColorChk.setSelected(_props.isOverrideObjectTreeBackgroundColor());
    2
    add(statusBarBackgroundColorChk, gbc);
    2
    add(statusBarBackgroundColorChk, gbc);
    2
    add(objectTreeBackgroundColorChk, gbc);
    Differences
    Expression1Expression2Difference
    statusBarBackgroundColorChkobjectTreeBackgroundColorChkVARIABLE_NAME_MISMATCH
    2
    add(objectTreeBackgroundColorChk, gbc);
    3
    ++gbc.gridx;
    3
    ++gbc.gridx;
    4
    statusBarBackgroundColorBtn = new JButton(i18n.STATUS_BAR_BACKGROUND_COLOR_BUTTON_LABEL);
    4
    statusBarBackgroundColorBtn = new JButton(i18n.STATUS_BAR_BACKGROUND_COLOR_BUTTON_LABEL);
    4
    objectTreeBackgroundColorBtn = new JButton(i18n.OBJECT_TREE_BACKGROUND_COLOR_BUTTON_LABEL);
    Differences
    Expression1Expression2Difference
    statusBarBackgroundColorBtnobjectTreeBackgroundColorBtnVARIABLE_NAME_MISMATCH
    STATUS_BAR_BACKGROUND_COLOR_BUTTON_LABELOBJECT_TREE_BACKGROUND_COLOR_BUTTON_LABELVARIABLE_NAME_MISMATCH
    4
    objectTreeBackgroundColorBtn = new JButton(i18n.OBJECT_TREE_BACKGROUND_COLOR_BUTTON_LABEL);
    5
    add(statusBarBackgroundColorBtn, gbc);
    5
    add(statusBarBackgroundColorBtn, gbc);
    5
    add(objectTreeBackgroundColorBtn, gbc);
    Differences
    Expression1Expression2Difference
    statusBarBackgroundColorBtnobjectTreeBackgroundColorBtnVARIABLE_NAME_MISMATCH
    5
    add(objectTreeBackgroundColorBtn, gbc);
    6
    ++gbc.gridx;
    6
    ++gbc.gridx;
    7
    gbc.anchor = GridBagConstraints.EAST;
    7
    gbc.anchor = GridBagConstraints.EAST;
    8
    gbc.fill = GridBagConstraints.HORIZONTAL;
    8
    gbc.fill = GridBagConstraints.HORIZONTAL;
    9
    statusBarBackgroundColorChk.setSelected(_props.isOverrideStatusBarBackgroundColor());
    9
    statusBarBackgroundColorChk.setSelected(_props.isOverrideStatusBarBackgroundColor());
    9
    objectTreeBackgroundColorChk.setSelected(_props.isOverrideObjectTreeBackgroundColor());
    Differences
    Expression1Expression2Difference
    isOverrideStatusBarBackgroundColorisOverrideObjectTreeBackgroundColorMETHOD_INVOCATION_NAME_MISMATCH
    statusBarBackgroundColorChkobjectTreeBackgroundColorChkVARIABLE_NAME_MISMATCH
    9
    objectTreeBackgroundColorChk.setSelected(_props.isOverrideObjectTreeBackgroundColor());
    10
    statusBarBackgroundColorBtn.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
    10
    statusBarBackgroundColorBtn.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
    10
    objectTreeBackgroundColorBtn.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
    Differences
    Expression1Expression2Difference
    statusBarBackgroundColorBtnobjectTreeBackgroundColorBtnVARIABLE_NAME_MISMATCH
    10
    objectTreeBackgroundColorBtn.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
    11
    statusBarBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL);
    11
    statusBarBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL);
    11
    objectTreeBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL);
    Differences
    Expression1Expression2Difference
    statusBarBackgroundLblobjectTreeBackgroundLblVARIABLE_NAME_MISMATCH
    11
    objectTreeBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL);
    12
    statusBarBackgroundLbl.setEnabled(_props.isOverrideStatusBarBackgroundColor());
    12
    statusBarBackgroundLbl.setEnabled(_props.isOverrideStatusBarBackgroundColor());
    14
    objectTreeBackgroundLbl.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
    Differences
    Expression1Expression2Difference
    isOverrideStatusBarBackgroundColorisOverrideObjectTreeBackgroundColorMETHOD_INVOCATION_NAME_MISMATCH
    statusBarBackgroundLblobjectTreeBackgroundLblVARIABLE_NAME_MISMATCH
    14
    objectTreeBackgroundLbl.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
    13
    statusBarBackgroundColorPnl.add(statusBarBackgroundLbl);
    13
    statusBarBackgroundColorPnl.add(statusBarBackgroundLbl);
    12
    objectTreeBackgroundColorPnl.add(objectTreeBackgroundLbl);
    Differences
    Expression1Expression2Difference
    statusBarBackgroundLblobjectTreeBackgroundLblVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorPnlobjectTreeBackgroundColorPnlVARIABLE_NAME_MISMATCH
    12
    objectTreeBackgroundColorPnl.add(objectTreeBackgroundLbl);
    14
    statusBarBackgroundColorPnl.setEnabled(_props.isOverrideStatusBarBackgroundColor());
    14
    statusBarBackgroundColorPnl.setEnabled(_props.isOverrideStatusBarBackgroundColor());
    13
    objectTreeBackgroundColorPnl.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
    Differences
    Expression1Expression2Difference
    isOverrideStatusBarBackgroundColorisOverrideObjectTreeBackgroundColorMETHOD_INVOCATION_NAME_MISMATCH
    statusBarBackgroundColorPnlobjectTreeBackgroundColorPnlVARIABLE_NAME_MISMATCH
    13
    objectTreeBackgroundColorPnl.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
    15
    if (_props.isOverrideStatusBarBackgroundColor())
    15
    if (_props.isOverrideStatusBarBackgroundColor())
    15
    if (_props.isOverrideObjectTreeBackgroundColor())
    Differences
    Expression1Expression2Difference
    isOverrideStatusBarBackgroundColorisOverrideObjectTreeBackgroundColorMETHOD_INVOCATION_NAME_MISMATCH
    15
    if (_props.isOverrideObjectTreeBackgroundColor())
    16
    statusBarBackgroundColor = new Color(_props.getStatusBarBackgroundColorRgbValue());
    16
    statusBarBackgroundColor = new Color(_props.getStatusBarBackgroundColorRgbValue());
    16
    objectTreeBackgroundColor = new Color(_props.getObjectTreeBackgroundColorRgbValue());
    Differences
    Expression1Expression2Difference
    statusBarBackgroundColorobjectTreeBackgroundColorVARIABLE_NAME_MISMATCH
    getStatusBarBackgroundColorRgbValuegetObjectTreeBackgroundColorRgbValueMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression _props.getStatusBarBackgroundColorRgbValue() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression _props.getObjectTreeBackgroundColorRgbValue() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16
    objectTreeBackgroundColor = new Color(_props.getObjectTreeBackgroundColorRgbValue());
    17
    statusBarBackgroundColorPnl.setBackground(statusBarBackgroundColor);
    17
    statusBarBackgroundColorPnl.setBackground(statusBarBackgroundColor);
    17
    objectTreeBackgroundColorPnl.setBackground(objectTreeBackgroundColor);
    Differences
    Expression1Expression2Difference
    statusBarBackgroundColorobjectTreeBackgroundColorVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorPnlobjectTreeBackgroundColorPnlVARIABLE_NAME_MISMATCH
    17
    objectTreeBackgroundColorPnl.setBackground(objectTreeBackgroundColor);
    18
    add(statusBarBackgroundColorPnl, gbc);
    18
    add(statusBarBackgroundColorPnl, gbc);
    18
    add(objectTreeBackgroundColorPnl, gbc);
    Differences
    Expression1Expression2Difference
    statusBarBackgroundColorPnlobjectTreeBackgroundColorPnlVARIABLE_NAME_MISMATCH
    18
    add(objectTreeBackgroundColorPnl, gbc);
    19
    statusBarBackgroundColorChk.addActionListener(new ActionListener() {...});
    19
    statusBarBackgroundColorChk.addActionListener(new ActionListener() {...});
    19
    objectTreeBackgroundColorChk.addActionListener(new ActionListener() {...});
    Differences
    Expression1Expression2Difference
    statusBarBackgroundColorChkobjectTreeBackgroundColorChkVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorBtnobjectTreeBackgroundColorBtnVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorPnlobjectTreeBackgroundColorPnlVARIABLE_NAME_MISMATCH
    statusBarBackgroundLblobjectTreeBackgroundLblVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorBtnobjectTreeBackgroundColorBtnVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorPnlobjectTreeBackgroundColorPnlVARIABLE_NAME_MISMATCH
    statusBarBackgroundLblobjectTreeBackgroundLblVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorChkobjectTreeBackgroundColorChkVARIABLE_NAME_MISMATCH
    19
    objectTreeBackgroundColorChk.addActionListener(new ActionListener() {...});
    20
    statusBarBackgroundColorBtn.addActionListener(new ActionListener() {...});
    20
    statusBarBackgroundColorBtn.addActionListener(new ActionListener() {...});
    20
    objectTreeBackgroundColorBtn.addActionListener(new ActionListener() {...});
    Differences
    Expression1Expression2Difference
    statusBarBackgroundColorobjectTreeBackgroundColorVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorobjectTreeBackgroundColorVARIABLE_NAME_MISMATCH
    STATUS_BAR_BACKGROUND_COLOR_CHOOSER_DIALOG_TITLEOBJECT_TREE_BACKGROUND_COLOR_CHOOSER_DIALOG_TITLEVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorobjectTreeBackgroundColorVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorPnlobjectTreeBackgroundColorPnlVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorPnlobjectTreeBackgroundColorPnlVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorBtnobjectTreeBackgroundColorBtnVARIABLE_NAME_MISMATCH
    20
    objectTreeBackgroundColorBtn.addActionListener(new ActionListener() {...});
    Precondition Violations (2)
    Row Violation
    1Expression _props.getStatusBarBackgroundColorRgbValue() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression _props.getObjectTreeBackgroundColorRgbValue() cannot be parameterized, because it has dependencies to/from statements that will be extracted