JList list = new JList(pluginHandler.getPluginIdList()); list.setCellRenderer(new PluginListCellRenderer()); descriptionLabel = new MultiLineLabel("description"); JComponent component = new JPanel(new BorderLayout()); component.setLayout(new BorderLayout(0, 30)); component.add(new MultiLineLabel(AddressbookResourceLoader.getString( "dialog", "addressbookimport", "plugin_text")), BorderLayout.NORTH); JPanel middlePanel = new JPanel(); middlePanel.setAlignmentX(1); GridBagLayout layout = new GridBagLayout(); middlePanel.setLayout(layout); Method method = null; try { method = list.getClass().getMethod("getSelectedValue", null); } catch (NoSuchMethodException nsme) { } data.registerDataLookup("Plugin.ID", new DefaultDataLookup(list, method, null)); list.addListSelectionListener(this); list.setSelectedIndex(0); JScrollPane scrollPane = new JScrollPane(list); scrollPane .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); // scrollPane.setPreferredSize( new Dimension(200,200) ); GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.NORTHWEST; c.gridx = 0; c.fill = GridBagConstraints.BOTH; c.weightx = 0.4; // c.gridwidth = GridBagConstraints.RELATIVE; c.weighty = 1.0; layout.setConstraints(scrollPane, c); middlePanel.add(scrollPane); c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 0.6; c.gridx = 1; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new Insets(0, 10, 0, 0); JScrollPane scrollPane2 = new JScrollPane(descriptionLabel); scrollPane2 .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); layout.setConstraints(scrollPane2, c); middlePanel.add(scrollPane2); component.add(middlePanel); return component;
descriptionLabel = new MultiLineLabel("description"); JList list = new JList(pluginHandler.getPluginIdList()); list.setCellRenderer(new PluginListCellRenderer()); JComponent component = new JPanel(new BorderLayout(0, 30)); component.add(new MultiLineLabel(MailResourceLoader.getString("dialog", "mailboximport", "plugin_text")), BorderLayout.NORTH); JPanel middlePanel = new JPanel(); middlePanel.setAlignmentX(1); GridBagLayout layout = new GridBagLayout(); middlePanel.setLayout(layout); Method method = null; try { method = list.getClass().getMethod("getSelectedValue", null); } catch (NoSuchMethodException nsme) { } data.registerDataLookup("Plugin.ID", new DefaultDataLookup(list, method, null)); list.addListSelectionListener(this); list.setSelectedIndex(0); JScrollPane scrollPane = new JScrollPane(list); scrollPane .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.NORTHWEST; c.gridx = 0; c.fill = GridBagConstraints.BOTH; c.weightx = 0.4; // c.gridwidth = GridBagConstraints.RELATIVE; c.weighty = 1.0; layout.setConstraints(scrollPane, c); middlePanel.add(scrollPane); c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 0.6; c.gridx = 1; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new Insets(0, 10, 0, 0); JScrollPane scrollPane2 = new JScrollPane(descriptionLabel); scrollPane2 .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); layout.setConstraints(scrollPane2, c); middlePanel.add(scrollPane2); component.add(middlePanel); return component;
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/gui/dialog/importfilter/PluginStep.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/config/mailboximport/PluginStep.java
Method name: JComponent createComponent() Method name: JComponent createComponent()
Number of AST nodes: 37 Number of AST nodes: 36
1
descriptionLabel = new MultiLineLabel("description");
1
JList list = new JList(pluginHandler.getPluginIdList());
2
		JList list = new JList(pluginHandler.getPluginIdList());
2
		list.setCellRenderer(new PluginListCellRenderer());
3
		list.setCellRenderer(new PluginListCellRenderer());
3
		descriptionLabel = new MultiLineLabel("description");
4
		JComponent component = new JPanel(new BorderLayout());
4
		JComponent component = new JPanel(new 
5
		component.setLayout(new BorderLayout(0, 30));
5
BorderLayout(0, 30));
6
		component.add(new MultiLineLabel(AddressbookResourceLoader.getString(
6
		component.add(new MultiLineLabel(MailResourceLoader.getString(
7
				"dialog", "addressbook
7
"dialog",
8
import", "plugin_text")),
8
				"mailboximport", "plugin_text")),
9
				BorderLayout.NORTH);
9
 BorderLayout.NORTH);
10
		JPanel middlePanel = new JPanel();
10
		JPanel middlePanel = new JPanel();
11
		middlePanel.setAlignmentX(1);
11
		middlePanel.setAlignmentX(1);
12
		GridBagLayout layout = new GridBagLayout();
12
		GridBagLayout layout = new GridBagLayout();
13
		middlePanel.setLayout(layout);
13
		middlePanel.setLayout(layout);
14
		Method method = null;
14
		Method method = null;
15
		try {
15
		try {
16
			method = list.getClass().getMethod("getSelectedValue", null);
16
			method = list.getClass().getMethod("getSelectedValue", null);
17
		} catch (NoSuchMethodException nsme) {
17
		} catch (NoSuchMethodException nsme) {
18
		}
18
		}
19
		data.registerDataLookup("Plugin.ID", new DefaultDataLookup(list,
19
		data.registerDataLookup("Plugin.ID", new DefaultDataLookup(list,
20
				method, null));
20
				method, null));
21
		list.addListSelectionListener(this);
21
		list.addListSelectionListener(this);
22
		list.setSelectedIndex(0);
22
		list.setSelectedIndex(0);
23
		JScrollPane scrollPane = new JScrollPane(list);
23
		JScrollPane scrollPane = new JScrollPane(list);
24
		scrollPane
24
		scrollPane
25
				.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
25
				.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
26
		// scrollPane.setPreferredSize( new Dimension(200,200) );
27
		GridBagConstraints c = new GridBagConstraints();
26
		GridBagConstraints c = new GridBagConstraints();
28
		c.anchor = GridBagConstraints.NORTHWEST;
27
		c.anchor = GridBagConstraints.NORTHWEST;
29
		c.gridx = 0;
28
		c.gridx = 0;
30
		c.fill = GridBagConstraints.BOTH;
29
		c.fill = GridBagConstraints.BOTH;
31
		c.weightx = 0.4;
30
		c.weightx = 0.4;
32
		// c.gridwidth = GridBagConstraints.RELATIVE;
31
		// c.gridwidth = GridBagConstraints.RELATIVE;
33
		c.weighty = 1.0;
32
		c.weighty = 1.0;
34
		layout.setConstraints(scrollPane, c);
33
		layout.setConstraints(scrollPane, c);
35
		middlePanel.add(scrollPane);
34
		middlePanel.add(scrollPane);
36
		c.gridwidth = GridBagConstraints.REMAINDER;
35
		c.gridwidth = GridBagConstraints.REMAINDER;
37
		c.weightx = 0.6;
36
		c.weightx = 0.6;
38
		c.gridx = 1;
37
		c.gridx = 1;
39
		c.anchor = GridBagConstraints.NORTHWEST;
38
		c.anchor = GridBagConstraints.NORTHWEST;
40
		c.insets = new Insets(0, 10, 0, 0);
39
		c.insets = new Insets(0, 10, 0, 0);
41
		JScrollPane scrollPane2 = new JScrollPane(descriptionLabel);
40
		JScrollPane scrollPane2 = new JScrollPane(descriptionLabel);
42
		scrollPane2
41
		scrollPane2
43
				.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
42
				.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
44
		layout.setConstraints(scrollPane2, c);
43
		layout.setConstraints(scrollPane2, c);
45
		middlePanel.add(scrollPane2);
44
		middlePanel.add(scrollPane2);
46
		component.add(middlePanel);
45
		component.add(middlePanel);
47
		return component;
46
		return component;
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.2
Clones locationClones are in different classes having the same super class
Number of node comparisons484
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements36
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)135.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    JList list = new JList(pluginHandler.getPluginIdList());
    2
    JList list = new JList(pluginHandler.getPluginIdList());
    2
    list.setCellRenderer(new PluginListCellRenderer());
    2
    list.setCellRenderer(new PluginListCellRenderer());
    3
    list.setCellRenderer(new PluginListCellRenderer());
    Differences
    Expression1Expression2Difference
    org.columba.addressbook.gui.dialog.importfilter.PluginListCellRendererorg.columba.mail.gui.config.mailboximport.PluginListCellRendererSUBCLASS_TYPE_MISMATCH
    3
    list.setCellRenderer(new PluginListCellRenderer());
    3
    descriptionLabel = new MultiLineLabel("description");
    1
    descriptionLabel = new MultiLineLabel("description");
    4
    JComponent component = new JPanel(new BorderLayout());
    4
    JComponent component = new JPanel(new BorderLayout());
    4
    JComponent component = new JPanel(new BorderLayout(0, 30));
    Differences
    Expression1Expression2Difference
    new BorderLayout()new BorderLayout(0,30)ARGUMENT_NUMBER_MISMATCH
    4
    JComponent component = new JPanel(new BorderLayout(0, 30));
    5
    component.setLayout(new BorderLayout(0, 30));
    5
    component.setLayout(new BorderLayout(0, 30));
    Preondition Violations
    Unmatched statement component.setLayout(new BorderLayout(0,30)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                  
    6
    component.add(new MultiLineLabel(AddressbookResourceLoader.getString("dialog", "addressbookimport", "plugin_text")), BorderLayout.NORTH);
    6
    component.add(new MultiLineLabel(AddressbookResourceLoader.getString("dialog", "addressbookimport", "plugin_text")), BorderLayout.NORTH);
    5
    component.add(new MultiLineLabel(MailResourceLoader.getString("dialog", "mailboximport", "plugin_text")), BorderLayout.NORTH);
    Differences
    Expression1Expression2Difference
    "addressbookimport""mailboximport"LITERAL_VALUE_MISMATCH
    org.columba.addressbook.util.AddressbookResourceLoaderorg.columba.mail.util.MailResourceLoaderSUBCLASS_TYPE_MISMATCH
    5
    component.add(new MultiLineLabel(MailResourceLoader.getString("dialog", "mailboximport", "plugin_text")), BorderLayout.NORTH);
    7
    JPanel middlePanel = new JPanel();
    6
    JPanel middlePanel = new JPanel();
    8
    middlePanel.setAlignmentX(1);
    7
    middlePanel.setAlignmentX(1);
    9
    GridBagLayout layout = new GridBagLayout();
    8
    GridBagLayout layout = new GridBagLayout();
    10
    middlePanel.setLayout(layout);
    9
    middlePanel.setLayout(layout);
    11
    Method method = null;
    10
    Method method = null;
    12
    try
    11
    try
    13
    method = list.getClass().getMethod("getSelectedValue", null);
    12
    method = list.getClass().getMethod("getSelectedValue", null);
    14
    data.registerDataLookup("Plugin.ID", new DefaultDataLookup(list, method, null));
    13
    data.registerDataLookup("Plugin.ID", new DefaultDataLookup(list, method, null));
    15
    list.addListSelectionListener(this);
    14
    list.addListSelectionListener(this);
    16
    list.setSelectedIndex(0);
    15
    list.setSelectedIndex(0);
    17
    JScrollPane scrollPane = new JScrollPane(list);
    16
    JScrollPane scrollPane = new JScrollPane(list);
    18
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    17
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    19
    GridBagConstraints c = new GridBagConstraints();
    18
    GridBagConstraints c = new GridBagConstraints();
    20
    c.anchor = GridBagConstraints.NORTHWEST;
    19
    c.anchor = GridBagConstraints.NORTHWEST;
    21
    c.gridx = 0;
    20
    c.gridx = 0;
    22
    c.fill = GridBagConstraints.BOTH;
    21
    c.fill = GridBagConstraints.BOTH;
    23
    c.weightx = 0.4;
    22
    c.weightx = 0.4;
    24
    c.weighty = 1.0;
    23
    c.weighty = 1.0;
    25
    layout.setConstraints(scrollPane, c);
    24
    layout.setConstraints(scrollPane, c);
    26
    middlePanel.add(scrollPane);
    25
    middlePanel.add(scrollPane);
    27
    c.gridwidth = GridBagConstraints.REMAINDER;
    26
    c.gridwidth = GridBagConstraints.REMAINDER;
    28
    c.weightx = 0.6;
    27
    c.weightx = 0.6;
    29
    c.gridx = 1;
    28
    c.gridx = 1;
    30
    c.anchor = GridBagConstraints.NORTHWEST;
    29
    c.anchor = GridBagConstraints.NORTHWEST;
    31
    c.insets = new Insets(0, 10, 0, 0);
    30
    c.insets = new Insets(0, 10, 0, 0);
    32
    JScrollPane scrollPane2 = new JScrollPane(descriptionLabel);
    31
    JScrollPane scrollPane2 = new JScrollPane(descriptionLabel);
    33
    scrollPane2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    32
    scrollPane2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    34
    layout.setConstraints(scrollPane2, c);
    33
    layout.setConstraints(scrollPane2, c);
    35
    middlePanel.add(scrollPane2);
    34
    middlePanel.add(scrollPane2);
    36
    component.add(middlePanel);
    35
    component.add(middlePanel);
    37
    return component;
    36
    return component;
    Precondition Violations (1)
    Row Violation
    1Unmatched statement component.setLayout(new BorderLayout(0,30)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted