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(); } } });
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 addToolbarColorComponents(GridBagConstraints) Method name: void addObjectTreeColorComponents(GridBagConstraints)
Number of AST nodes: 20 Number of AST nodes: 20
1
toolbarBackgroundColorChk.setSelected(_props.isOverrideToolbarBackgroundColor());
1
objectTreeBackgroundColorChk.setSelected(_props.isOverrideObjectTreeBackgroundColor());
2
		add(toolbarBackgroundColorChk, gbc);
2
		add(objectTreeBackgroundColorChk, gbc);
3
		// Set toolbar color button
3
		// Set object tree color button
4
		++gbc.gridx;
4
		++gbc.gridx;
5
		toolbarBackgroundColorBtn = new JButton(i18n.TOOLBAR_BACKGROUND_COLOR_BUTTON_LABEL);
5
		objectTreeBackgroundColorBtn = new JButton(i18n.OBJECT_TREE_BACKGROUND_COLOR_BUTTON_LABEL);
6
		add(toolbarBackgroundColorBtn, gbc);
6
		add(objectTreeBackgroundColorBtn, gbc);
7
		// Set toolbar 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
		toolbarBackgroundColorChk.setSelected(_props.isOverrideToolbarBackgroundColor());
11
		objectTreeBackgroundColorChk.setSelected(_props.isOverrideObjectTreeBackgroundColor());
12
		toolbarBackgroundColorBtn.setEnabled(_props.isOverrideToolbarBackgroundColor());
12
		objectTreeBackgroundColorBtn.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
13
		toolBarBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL);
13
		objectTreeBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL);
14
		toolbarBackgroundColorPnl.add(toolBarBackgroundLbl);
14
		objectTreeBackgroundColorPnl.add(objectTreeBackgroundLbl);
15
		toolbarBackgroundColorPnl.setEnabled(_props.isOverrideToolbarBackgroundColor());
15
		objectTreeBackgroundColorPnl.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
16
		toolBarBackgroundLbl.setEnabled(_props.isOverrideToolbarBackgroundColor());
16
		objectTreeBackgroundLbl.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
17
		if (_props.isOverrideToolbarBackgroundColor())
17
		if (_props.isOverrideObjectTreeBackgroundColor())
18
		{
18
		{
19
			toolbarBackgroundColor = new Color(_props.getToolbarBackgroundColorRgbValue());
19
			objectTreeBackgroundColor = new Color(_props.getObjectTreeBackgroundColorRgbValue());
20
			toolbarBackgroundColorPnl.setBackground(toolbarBackgroundColor);
20
			objectTreeBackgroundColorPnl.setBackground(objectTreeBackgroundColor);
21
		}
21
		}
22
		add(toolbarBackgroundColorPnl, gbc);
22
		add(objectTreeBackgroundColorPnl, gbc);
23
		toolbarBackgroundColorChk.addActionListener(new ActionListener()
23
		objectTreeBackgroundColorChk.addActionListener(new ActionListener()
24
		{
24
		{
25
			@Override
25
			@Override
26
			public void actionPerformed(ActionEvent e)
26
			public void actionPerformed(ActionEvent e)
27
			{
27
			{
28
				if (toolbarBackgroundColorChk.isSelected())
28
				if (objectTreeBackgroundColorChk.isSelected())
29
				{
29
				{
30
					toolbarBackgroundColorBtn.setEnabled(true);
30
					objectTreeBackgroundColorBtn.setEnabled(true);
31
					toolbarBackgroundColorPnl.setEnabled(true);
31
					objectTreeBackgroundColorPnl.setEnabled(true);
32
					toolBarBackgroundLbl.setEnabled(true);
32
					objectTreeBackgroundLbl.setEnabled(true);
33
				}
33
				}
34
				else
34
				else
35
				{
35
				{
36
					toolbarBackgroundColorBtn.setEnabled(false);
36
					objectTreeBackgroundColorBtn.setEnabled(false);
37
					toolbarBackgroundColorPnl.setEnabled(false);
37
					objectTreeBackgroundColorPnl.setEnabled(false);
38
					toolBarBackgroundLbl.setEnabled(false);
38
					objectTreeBackgroundLbl.setEnabled(false);
39
				}
39
				}
40
			}
40
			}
41
		});
41
		});
42
		toolbarBackgroundColorBtn.addActionListener(new ActionListener()
42
		objectTreeBackgroundColorBtn.addActionListener(new ActionListener()
43
		{
43
		{
44
			@Override
44
			@Override
45
			public void actionPerformed(ActionEvent e)
45
			public void actionPerformed(ActionEvent e)
46
			{
46
			{
47
				Color startColor = toolbarBackgroundColor == null ? Color.WHITE : toolbarBackgroundColor;
47
				Color startColor = objectTreeBackgroundColor == null ? Color.WHITE : objectTreeBackgroundColor;
48
				Color newColor =
48
				Color newColor =
49
					JColorChooser.showDialog(null, i18n.TOOLBAR_BACKGROUND_COLOR_CHOOSER_DIALOG_TITLE, 
49
					JColorChooser.showDialog(null, i18n.OBJECT_TREE_BACKGROUND_COLOR_CHOOSER_DIALOG_TITLE,
50
startColor);
50
						startColor);
51
				if (newColor != null)
51
				if (newColor != null)
52
				{
52
				{
53
					toolbarBackgroundColor = newColor;
53
					objectTreeBackgroundColor = newColor;
54
					toolbarBackgroundColorPnl.setBackground(newColor);
54
					objectTreeBackgroundColorPnl.setBackground(newColor);
55
					toolbarBackgroundColorPnl.validate();
55
					objectTreeBackgroundColorPnl.validate();
56
				}
56
				}
57
			}
57
			}
58
		});
58
		});
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.4
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)54.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    toolbarBackgroundColorChk.setSelected(_props.isOverrideToolbarBackgroundColor());
    1
    toolbarBackgroundColorChk.setSelected(_props.isOverrideToolbarBackgroundColor());
    1
    objectTreeBackgroundColorChk.setSelected(_props.isOverrideObjectTreeBackgroundColor());
    Differences
    Expression1Expression2Difference
    isOverrideToolbarBackgroundColorisOverrideObjectTreeBackgroundColorMETHOD_INVOCATION_NAME_MISMATCH
    toolbarBackgroundColorChkobjectTreeBackgroundColorChkVARIABLE_NAME_MISMATCH
    1
    objectTreeBackgroundColorChk.setSelected(_props.isOverrideObjectTreeBackgroundColor());
    2
    add(toolbarBackgroundColorChk, gbc);
    2
    add(toolbarBackgroundColorChk, gbc);
    2
    add(objectTreeBackgroundColorChk, gbc);
    Differences
    Expression1Expression2Difference
    toolbarBackgroundColorChkobjectTreeBackgroundColorChkVARIABLE_NAME_MISMATCH
    2
    add(objectTreeBackgroundColorChk, gbc);
    3
    ++gbc.gridx;
    3
    ++gbc.gridx;
    4
    toolbarBackgroundColorBtn = new JButton(i18n.TOOLBAR_BACKGROUND_COLOR_BUTTON_LABEL);
    4
    toolbarBackgroundColorBtn = new JButton(i18n.TOOLBAR_BACKGROUND_COLOR_BUTTON_LABEL);
    4
    objectTreeBackgroundColorBtn = new JButton(i18n.OBJECT_TREE_BACKGROUND_COLOR_BUTTON_LABEL);
    Differences
    Expression1Expression2Difference
    toolbarBackgroundColorBtnobjectTreeBackgroundColorBtnVARIABLE_NAME_MISMATCH
    TOOLBAR_BACKGROUND_COLOR_BUTTON_LABELOBJECT_TREE_BACKGROUND_COLOR_BUTTON_LABELVARIABLE_NAME_MISMATCH
    4
    objectTreeBackgroundColorBtn = new JButton(i18n.OBJECT_TREE_BACKGROUND_COLOR_BUTTON_LABEL);
    5
    add(toolbarBackgroundColorBtn, gbc);
    5
    add(toolbarBackgroundColorBtn, gbc);
    5
    add(objectTreeBackgroundColorBtn, gbc);
    Differences
    Expression1Expression2Difference
    toolbarBackgroundColorBtnobjectTreeBackgroundColorBtnVARIABLE_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
    toolbarBackgroundColorChk.setSelected(_props.isOverrideToolbarBackgroundColor());
    9
    toolbarBackgroundColorChk.setSelected(_props.isOverrideToolbarBackgroundColor());
    9
    objectTreeBackgroundColorChk.setSelected(_props.isOverrideObjectTreeBackgroundColor());
    Differences
    Expression1Expression2Difference
    isOverrideToolbarBackgroundColorisOverrideObjectTreeBackgroundColorMETHOD_INVOCATION_NAME_MISMATCH
    toolbarBackgroundColorChkobjectTreeBackgroundColorChkVARIABLE_NAME_MISMATCH
    9
    objectTreeBackgroundColorChk.setSelected(_props.isOverrideObjectTreeBackgroundColor());
    10
    toolbarBackgroundColorBtn.setEnabled(_props.isOverrideToolbarBackgroundColor());
    10
    toolbarBackgroundColorBtn.setEnabled(_props.isOverrideToolbarBackgroundColor());
    10
    objectTreeBackgroundColorBtn.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
    Differences
    Expression1Expression2Difference
    isOverrideToolbarBackgroundColorisOverrideObjectTreeBackgroundColorMETHOD_INVOCATION_NAME_MISMATCH
    toolbarBackgroundColorBtnobjectTreeBackgroundColorBtnVARIABLE_NAME_MISMATCH
    10
    objectTreeBackgroundColorBtn.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
    11
    toolBarBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL);
    11
    toolBarBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL);
    11
    objectTreeBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL);
    Differences
    Expression1Expression2Difference
    toolBarBackgroundLblobjectTreeBackgroundLblVARIABLE_NAME_MISMATCH
    11
    objectTreeBackgroundLbl = new JLabel(i18n.BACKGROUND_COLOR_LABEL);
    12
    toolbarBackgroundColorPnl.add(toolBarBackgroundLbl);
    12
    toolbarBackgroundColorPnl.add(toolBarBackgroundLbl);
    12
    objectTreeBackgroundColorPnl.add(objectTreeBackgroundLbl);
    Differences
    Expression1Expression2Difference
    toolBarBackgroundLblobjectTreeBackgroundLblVARIABLE_NAME_MISMATCH
    toolbarBackgroundColorPnlobjectTreeBackgroundColorPnlVARIABLE_NAME_MISMATCH
    12
    objectTreeBackgroundColorPnl.add(objectTreeBackgroundLbl);
    13
    toolbarBackgroundColorPnl.setEnabled(_props.isOverrideToolbarBackgroundColor());
    13
    toolbarBackgroundColorPnl.setEnabled(_props.isOverrideToolbarBackgroundColor());
    13
    objectTreeBackgroundColorPnl.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
    Differences
    Expression1Expression2Difference
    isOverrideToolbarBackgroundColorisOverrideObjectTreeBackgroundColorMETHOD_INVOCATION_NAME_MISMATCH
    toolbarBackgroundColorPnlobjectTreeBackgroundColorPnlVARIABLE_NAME_MISMATCH
    13
    objectTreeBackgroundColorPnl.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
    14
    toolBarBackgroundLbl.setEnabled(_props.isOverrideToolbarBackgroundColor());
    14
    toolBarBackgroundLbl.setEnabled(_props.isOverrideToolbarBackgroundColor());
    14
    objectTreeBackgroundLbl.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
    Differences
    Expression1Expression2Difference
    isOverrideToolbarBackgroundColorisOverrideObjectTreeBackgroundColorMETHOD_INVOCATION_NAME_MISMATCH
    toolBarBackgroundLblobjectTreeBackgroundLblVARIABLE_NAME_MISMATCH
    14
    objectTreeBackgroundLbl.setEnabled(_props.isOverrideObjectTreeBackgroundColor());
    15
    if (_props.isOverrideToolbarBackgroundColor())
    15
    if (_props.isOverrideToolbarBackgroundColor())
    15
    if (_props.isOverrideObjectTreeBackgroundColor())
    Differences
    Expression1Expression2Difference
    isOverrideToolbarBackgroundColorisOverrideObjectTreeBackgroundColorMETHOD_INVOCATION_NAME_MISMATCH
    15
    if (_props.isOverrideObjectTreeBackgroundColor())
    16
    toolbarBackgroundColor = new Color(_props.getToolbarBackgroundColorRgbValue());
    16
    toolbarBackgroundColor = new Color(_props.getToolbarBackgroundColorRgbValue());
    16
    objectTreeBackgroundColor = new Color(_props.getObjectTreeBackgroundColorRgbValue());
    Differences
    Expression1Expression2Difference
    toolbarBackgroundColorobjectTreeBackgroundColorVARIABLE_NAME_MISMATCH
    getToolbarBackgroundColorRgbValuegetObjectTreeBackgroundColorRgbValueMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression _props.getToolbarBackgroundColorRgbValue() 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
    toolbarBackgroundColorPnl.setBackground(toolbarBackgroundColor);
    17
    toolbarBackgroundColorPnl.setBackground(toolbarBackgroundColor);
    17
    objectTreeBackgroundColorPnl.setBackground(objectTreeBackgroundColor);
    Differences
    Expression1Expression2Difference
    toolbarBackgroundColorobjectTreeBackgroundColorVARIABLE_NAME_MISMATCH
    toolbarBackgroundColorPnlobjectTreeBackgroundColorPnlVARIABLE_NAME_MISMATCH
    17
    objectTreeBackgroundColorPnl.setBackground(objectTreeBackgroundColor);
    18
    add(toolbarBackgroundColorPnl, gbc);
    18
    add(toolbarBackgroundColorPnl, gbc);
    18
    add(objectTreeBackgroundColorPnl, gbc);
    Differences
    Expression1Expression2Difference
    toolbarBackgroundColorPnlobjectTreeBackgroundColorPnlVARIABLE_NAME_MISMATCH
    18
    add(objectTreeBackgroundColorPnl, gbc);
    19
    toolbarBackgroundColorChk.addActionListener(new ActionListener() {...});
    19
    toolbarBackgroundColorChk.addActionListener(new ActionListener() {...});
    19
    objectTreeBackgroundColorChk.addActionListener(new ActionListener() {...});
    Differences
    Expression1Expression2Difference
    toolbarBackgroundColorChkobjectTreeBackgroundColorChkVARIABLE_NAME_MISMATCH
    toolbarBackgroundColorBtnobjectTreeBackgroundColorBtnVARIABLE_NAME_MISMATCH
    toolbarBackgroundColorPnlobjectTreeBackgroundColorPnlVARIABLE_NAME_MISMATCH
    toolBarBackgroundLblobjectTreeBackgroundLblVARIABLE_NAME_MISMATCH
    toolbarBackgroundColorBtnobjectTreeBackgroundColorBtnVARIABLE_NAME_MISMATCH
    toolbarBackgroundColorPnlobjectTreeBackgroundColorPnlVARIABLE_NAME_MISMATCH
    toolBarBackgroundLblobjectTreeBackgroundLblVARIABLE_NAME_MISMATCH
    toolbarBackgroundColorChkobjectTreeBackgroundColorChkVARIABLE_NAME_MISMATCH
    19
    objectTreeBackgroundColorChk.addActionListener(new ActionListener() {...});
    20
    toolbarBackgroundColorBtn.addActionListener(new ActionListener() {...});
    20
    toolbarBackgroundColorBtn.addActionListener(new ActionListener() {...});
    20
    objectTreeBackgroundColorBtn.addActionListener(new ActionListener() {...});
    Differences
    Expression1Expression2Difference
    toolbarBackgroundColorobjectTreeBackgroundColorVARIABLE_NAME_MISMATCH
    toolbarBackgroundColorobjectTreeBackgroundColorVARIABLE_NAME_MISMATCH
    TOOLBAR_BACKGROUND_COLOR_CHOOSER_DIALOG_TITLEOBJECT_TREE_BACKGROUND_COLOR_CHOOSER_DIALOG_TITLEVARIABLE_NAME_MISMATCH
    toolbarBackgroundColorobjectTreeBackgroundColorVARIABLE_NAME_MISMATCH
    toolbarBackgroundColorPnlobjectTreeBackgroundColorPnlVARIABLE_NAME_MISMATCH
    toolbarBackgroundColorPnlobjectTreeBackgroundColorPnlVARIABLE_NAME_MISMATCH
    toolbarBackgroundColorBtnobjectTreeBackgroundColorBtnVARIABLE_NAME_MISMATCH
    20
    objectTreeBackgroundColorBtn.addActionListener(new ActionListener() {...});
    Precondition Violations (2)
    Row Violation
    1Expression _props.getToolbarBackgroundColorRgbValue() 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