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(); } } });
toolbarBackgroundColorChk.setSelected(_props.isOverrideToolbarBackgroundColor()); add(toolbarBackgroundColorChk, gbc); // Set toolbar color button ++gbc.gridx; toolbarBackgroundColorBtn = new JButton(i18n.TOOLBAR_BACKGROUND_COLOR_BUTTON_LABEL); add(toolbarBackgroundColorBtn, gbc); // Set toolbar color panel ++gbc.gridx; gbc.anchor = GridBagConstraints.EAST; gbc.fill = GridBagConstraints.HORIZONTAL; toolbarBackgroundColorChk.setSelected(_props.isOverrideToolbarBackgroundColor()); toolbarBackgroundColorBtn.setEnabled(_props.isOverrideToolbarBackgroundColor()); toolBarBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL); toolbarBackgroundColorPnl.add(toolBarBackgroundLbl); toolbarBackgroundColorPnl.setEnabled(_props.isOverrideToolbarBackgroundColor()); toolBarBackgroundLbl.setEnabled(_props.isOverrideToolbarBackgroundColor()); if (_props.isOverrideToolbarBackgroundColor()) { toolbarBackgroundColor = new Color(_props.getToolbarBackgroundColorRgbValue()); toolbarBackgroundColorPnl.setBackground(toolbarBackgroundColor); } add(toolbarBackgroundColorPnl, gbc); toolbarBackgroundColorChk.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (toolbarBackgroundColorChk.isSelected()) { toolbarBackgroundColorBtn.setEnabled(true); toolbarBackgroundColorPnl.setEnabled(true); toolBarBackgroundLbl.setEnabled(true); } else { toolbarBackgroundColorBtn.setEnabled(false); toolbarBackgroundColorPnl.setEnabled(false); toolBarBackgroundLbl.setEnabled(false); } } }); toolbarBackgroundColorBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color startColor = toolbarBackgroundColor == null ? Color.WHITE : toolbarBackgroundColor; Color newColor = JColorChooser.showDialog(null, i18n.TOOLBAR_BACKGROUND_COLOR_CHOOSER_DIALOG_TITLE, startColor); if (newColor != null) { toolbarBackgroundColor = newColor; toolbarBackgroundColorPnl.setBackground(newColor); toolbarBackgroundColorPnl.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 addToolbarColorComponents(GridBagConstraints)
Number of AST nodes: 20 Number of AST nodes: 20
1
statusBarBackgroundColorChk.setSelected(_props.isOverrideStatusBarBackgroundColor());
1
toolbarBackgroundColorChk.setSelected(_props.isOverrideToolbarBackgroundColor());
2
		add(statusBarBackgroundColorChk, gbc);
2
		add(toolbarBackgroundColorChk, gbc);
3
		// Set object tree color button
3
		// Set toolbar color button
4
		++gbc.gridx;
4
		++gbc.gridx;
5
		statusBarBackgroundColorBtn = new JButton(i18n.STATUS_BAR_BACKGROUND_COLOR_BUTTON_LABEL);
5
		toolbarBackgroundColorBtn = new JButton(i18n.TOOLBAR_BACKGROUND_COLOR_BUTTON_LABEL);
6
		add(statusBarBackgroundColorBtn, gbc);
6
		add(toolbarBackgroundColorBtn, gbc);
7
		// Set object tree color panel
7
		// Set toolbar 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
		toolbarBackgroundColorChk.setSelected(_props.isOverrideToolbarBackgroundColor());
12
		statusBarBackgroundColorBtn.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
12
		toolbarBackgroundColorBtn.setEnabled(_props.isOverrideToolbarBackgroundColor());
13
		statusBarBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL);
13
		toolBarBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL);
14
		statusBarBackgroundLbl.setEnabled(_props.isOverrideStatusBarBackgroundColor());
14
		toolbarBackgroundColorPnl.add(toolBarBackgroundLbl);
15
		statusBarBackgroundColorPnl.add(statusBarBackgroundLbl);
15
		toolbarBackgroundColorPnl.setEnabled(_props.isOverrideToolbarBackground
16
		status
16
Color());
17
BarBackgroundColorPnl.setEnabled(_props.isOverrideStatusBarBackgroundColor());
17
		toolBarBackgroundLbl.setEnabled(_props.isOverrideToolbarBackgroundColor());
18
		if (_props.isOverrideStatusBarBackgroundColor())
18
		if (_props.isOverrideToolbarBackgroundColor())
19
		{
19
		{
20
			statusBarBackgroundColor = new Color(_props.getStatusBarBackgroundColorRgbValue());
20
			toolbarBackgroundColor = new Color(_props.getToolbarBackgroundColorRgbValue());
21
			statusBarBackgroundColorPnl.setBackground(statusBarBackgroundColor);
21
			toolbarBackgroundColorPnl.setBackground(toolbarBackgroundColor);
22
		}
22
		}
23
		add(statusBarBackgroundColorPnl, gbc);
23
		add(toolbarBackgroundColorPnl, gbc);
24
		statusBarBackgroundColorChk.addActionListener(new ActionListener()
24
		toolbarBackgroundColorChk.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 (toolbarBackgroundColorChk.isSelected())
30
				{
30
				{
31
					statusBarBackgroundColorBtn.setEnabled(true);
31
					toolbarBackgroundColorBtn.setEnabled(true);
32
					statusBarBackgroundColorPnl.setEnabled(true);
32
					toolbarBackgroundColorPnl.setEnabled(true);
33
					statusBarBackgroundLbl.setEnabled(true);
33
					toolBarBackgroundLbl.setEnabled(true);
34
				}
34
				}
35
				else
35
				else
36
				{
36
				{
37
					statusBarBackgroundColorBtn.setEnabled(false);
37
					toolbarBackgroundColorBtn.setEnabled(false);
38
					statusBarBackgroundColorPnl.setEnabled(false);
38
					toolbarBackgroundColorPnl.setEnabled(false);
39
					statusBarBackgroundLbl.setEnabled(false);
39
					toolBarBackgroundLbl.setEnabled(false);
40
				}
40
				}
41
			}
41
			}
42
		});
42
		});
43
		statusBarBackgroundColorBtn.addActionListener(new ActionListener()
43
		toolbarBackgroundColorBtn.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 = toolbarBackgroundColor == null ? Color.WHITE : toolbarBackgroundColor;
49
				Color newColor =
49
				Color newColor =
50
					JColorChooser.showDialog(null, i18n.STATUS_BAR_BACKGROUND_COLOR_CHOOSER_DIALOG_TITLE,
50
					JColorChooser.showDialog(null, i18n.TOOLBAR_BACKGROUND_COLOR_CHOOSER_DIALOG_TITLE,
51
						startColor);
51
 startColor);
52
				if (newColor != null)
52
				if (newColor != null)
53
				{
53
				{
54
					statusBarBackgroundColor = newColor;
54
					toolbarBackgroundColor = newColor;
55
					statusBarBackgroundColorPnl.setBackground(newColor);
55
					toolbarBackgroundColorPnl.setBackground(newColor);
56
					statusBarBackgroundColorPnl.validate();
56
					toolbarBackgroundColorPnl.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)0.5
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)86.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    statusBarBackgroundColorChk.setSelected(_props.isOverrideStatusBarBackgroundColor());
    1
    statusBarBackgroundColorChk.setSelected(_props.isOverrideStatusBarBackgroundColor());
    1
    toolbarBackgroundColorChk.setSelected(_props.isOverrideToolbarBackgroundColor());
    Differences
    Expression1Expression2Difference
    isOverrideStatusBarBackgroundColorisOverrideToolbarBackgroundColorMETHOD_INVOCATION_NAME_MISMATCH
    statusBarBackgroundColorChktoolbarBackgroundColorChkVARIABLE_NAME_MISMATCH
    1
    toolbarBackgroundColorChk.setSelected(_props.isOverrideToolbarBackgroundColor());
    2
    add(statusBarBackgroundColorChk, gbc);
    2
    add(statusBarBackgroundColorChk, gbc);
    2
    add(toolbarBackgroundColorChk, gbc);
    Differences
    Expression1Expression2Difference
    statusBarBackgroundColorChktoolbarBackgroundColorChkVARIABLE_NAME_MISMATCH
    2
    add(toolbarBackgroundColorChk, 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
    toolbarBackgroundColorBtn = new JButton(i18n.TOOLBAR_BACKGROUND_COLOR_BUTTON_LABEL);
    Differences
    Expression1Expression2Difference
    statusBarBackgroundColorBtntoolbarBackgroundColorBtnVARIABLE_NAME_MISMATCH
    STATUS_BAR_BACKGROUND_COLOR_BUTTON_LABELTOOLBAR_BACKGROUND_COLOR_BUTTON_LABELVARIABLE_NAME_MISMATCH
    4
    toolbarBackgroundColorBtn = new JButton(i18n.TOOLBAR_BACKGROUND_COLOR_BUTTON_LABEL);
    5
    add(statusBarBackgroundColorBtn, gbc);
    5
    add(statusBarBackgroundColorBtn, gbc);
    5
    add(toolbarBackgroundColorBtn, gbc);
    Differences
    Expression1Expression2Difference
    statusBarBackgroundColorBtntoolbarBackgroundColorBtnVARIABLE_NAME_MISMATCH
    5
    add(toolbarBackgroundColorBtn, 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
    toolbarBackgroundColorChk.setSelected(_props.isOverrideToolbarBackgroundColor());
    Differences
    Expression1Expression2Difference
    isOverrideStatusBarBackgroundColorisOverrideToolbarBackgroundColorMETHOD_INVOCATION_NAME_MISMATCH
    statusBarBackgroundColorChktoolbarBackgroundColorChkVARIABLE_NAME_MISMATCH
    9
    toolbarBackgroundColorChk.setSelected(_props.isOverrideToolbarBackgroundColor());
    10
    statusBarBackgroundColorBtn.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
    10
    statusBarBackgroundColorBtn.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
    10
    toolbarBackgroundColorBtn.setEnabled(_props.isOverrideToolbarBackgroundColor());
    Differences
    Expression1Expression2Difference
    isOverrideObjectTreeBackgroundColorisOverrideToolbarBackgroundColorMETHOD_INVOCATION_NAME_MISMATCH
    statusBarBackgroundColorBtntoolbarBackgroundColorBtnVARIABLE_NAME_MISMATCH
    10
    toolbarBackgroundColorBtn.setEnabled(_props.isOverrideToolbarBackgroundColor());
    11
    statusBarBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL);
    11
    statusBarBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL);
    11
    toolBarBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL);
    Differences
    Expression1Expression2Difference
    statusBarBackgroundLbltoolBarBackgroundLblVARIABLE_NAME_MISMATCH
    11
    toolBarBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL);
    12
    statusBarBackgroundLbl.setEnabled(_props.isOverrideStatusBarBackgroundColor());
    12
    statusBarBackgroundLbl.setEnabled(_props.isOverrideStatusBarBackgroundColor());
    14
    toolBarBackgroundLbl.setEnabled(_props.isOverrideToolbarBackgroundColor());
    Differences
    Expression1Expression2Difference
    isOverrideStatusBarBackgroundColorisOverrideToolbarBackgroundColorMETHOD_INVOCATION_NAME_MISMATCH
    statusBarBackgroundLbltoolBarBackgroundLblVARIABLE_NAME_MISMATCH
    14
    toolBarBackgroundLbl.setEnabled(_props.isOverrideToolbarBackgroundColor());
    13
    statusBarBackgroundColorPnl.add(statusBarBackgroundLbl);
    13
    statusBarBackgroundColorPnl.add(statusBarBackgroundLbl);
    12
    toolbarBackgroundColorPnl.add(toolBarBackgroundLbl);
    Differences
    Expression1Expression2Difference
    statusBarBackgroundLbltoolBarBackgroundLblVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorPnltoolbarBackgroundColorPnlVARIABLE_NAME_MISMATCH
    12
    toolbarBackgroundColorPnl.add(toolBarBackgroundLbl);
    14
    statusBarBackgroundColorPnl.setEnabled(_props.isOverrideStatusBarBackgroundColor());
    14
    statusBarBackgroundColorPnl.setEnabled(_props.isOverrideStatusBarBackgroundColor());
    13
    toolbarBackgroundColorPnl.setEnabled(_props.isOverrideToolbarBackgroundColor());
    Differences
    Expression1Expression2Difference
    isOverrideStatusBarBackgroundColorisOverrideToolbarBackgroundColorMETHOD_INVOCATION_NAME_MISMATCH
    statusBarBackgroundColorPnltoolbarBackgroundColorPnlVARIABLE_NAME_MISMATCH
    13
    toolbarBackgroundColorPnl.setEnabled(_props.isOverrideToolbarBackgroundColor());
    15
    if (_props.isOverrideStatusBarBackgroundColor())
    15
    if (_props.isOverrideStatusBarBackgroundColor())
    15
    if (_props.isOverrideToolbarBackgroundColor())
    Differences
    Expression1Expression2Difference
    isOverrideStatusBarBackgroundColorisOverrideToolbarBackgroundColorMETHOD_INVOCATION_NAME_MISMATCH
    15
    if (_props.isOverrideToolbarBackgroundColor())
    16
    statusBarBackgroundColor = new Color(_props.getStatusBarBackgroundColorRgbValue());
    16
    statusBarBackgroundColor = new Color(_props.getStatusBarBackgroundColorRgbValue());
    16
    toolbarBackgroundColor = new Color(_props.getToolbarBackgroundColorRgbValue());
    Differences
    Expression1Expression2Difference
    statusBarBackgroundColortoolbarBackgroundColorVARIABLE_NAME_MISMATCH
    getStatusBarBackgroundColorRgbValuegetToolbarBackgroundColorRgbValueMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression _props.getStatusBarBackgroundColorRgbValue() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression _props.getToolbarBackgroundColorRgbValue() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16
    toolbarBackgroundColor = new Color(_props.getToolbarBackgroundColorRgbValue());
    17
    statusBarBackgroundColorPnl.setBackground(statusBarBackgroundColor);
    17
    statusBarBackgroundColorPnl.setBackground(statusBarBackgroundColor);
    17
    toolbarBackgroundColorPnl.setBackground(toolbarBackgroundColor);
    Differences
    Expression1Expression2Difference
    statusBarBackgroundColortoolbarBackgroundColorVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorPnltoolbarBackgroundColorPnlVARIABLE_NAME_MISMATCH
    17
    toolbarBackgroundColorPnl.setBackground(toolbarBackgroundColor);
    18
    add(statusBarBackgroundColorPnl, gbc);
    18
    add(statusBarBackgroundColorPnl, gbc);
    18
    add(toolbarBackgroundColorPnl, gbc);
    Differences
    Expression1Expression2Difference
    statusBarBackgroundColorPnltoolbarBackgroundColorPnlVARIABLE_NAME_MISMATCH
    18
    add(toolbarBackgroundColorPnl, gbc);
    19
    statusBarBackgroundColorChk.addActionListener(new ActionListener() {...});
    19
    statusBarBackgroundColorChk.addActionListener(new ActionListener() {...});
    19
    toolbarBackgroundColorChk.addActionListener(new ActionListener() {...});
    Differences
    Expression1Expression2Difference
    statusBarBackgroundColorChktoolbarBackgroundColorChkVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorBtntoolbarBackgroundColorBtnVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorPnltoolbarBackgroundColorPnlVARIABLE_NAME_MISMATCH
    statusBarBackgroundLbltoolBarBackgroundLblVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorBtntoolbarBackgroundColorBtnVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorPnltoolbarBackgroundColorPnlVARIABLE_NAME_MISMATCH
    statusBarBackgroundLbltoolBarBackgroundLblVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorChktoolbarBackgroundColorChkVARIABLE_NAME_MISMATCH
    19
    toolbarBackgroundColorChk.addActionListener(new ActionListener() {...});
    20
    statusBarBackgroundColorBtn.addActionListener(new ActionListener() {...});
    20
    statusBarBackgroundColorBtn.addActionListener(new ActionListener() {...});
    20
    toolbarBackgroundColorBtn.addActionListener(new ActionListener() {...});
    Differences
    Expression1Expression2Difference
    statusBarBackgroundColortoolbarBackgroundColorVARIABLE_NAME_MISMATCH
    statusBarBackgroundColortoolbarBackgroundColorVARIABLE_NAME_MISMATCH
    STATUS_BAR_BACKGROUND_COLOR_CHOOSER_DIALOG_TITLETOOLBAR_BACKGROUND_COLOR_CHOOSER_DIALOG_TITLEVARIABLE_NAME_MISMATCH
    statusBarBackgroundColortoolbarBackgroundColorVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorPnltoolbarBackgroundColorPnlVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorPnltoolbarBackgroundColorPnlVARIABLE_NAME_MISMATCH
    statusBarBackgroundColorBtntoolbarBackgroundColorBtnVARIABLE_NAME_MISMATCH
    20
    toolbarBackgroundColorBtn.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.getToolbarBackgroundColorRgbValue() cannot be parameterized, because it has dependencies to/from statements that will be extracted