/** * Constructor to build new settings dialog. */ SettingsDialog() { super(Translator.localize("dialog.settings"), ArgoDialog.OK_CANCEL_OPTION, true); tabs = new JTabbedPane(); applyButton = new JButton(Translator.localize("button.apply")); String mnemonic = Translator.localize("button.apply.mnemonic"); if (mnemonic != null && mnemonic.length() > 0) { applyButton.setMnemonic(mnemonic.charAt(0)); } applyButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleSave(); } }); addButton(applyButton); // Add settings from the settings registry. settingsTabs = GUI.getInstance().getSettingsTabs(); for (GUISettingsTabInterface stp : settingsTabs) { // TODO: Only fetch names and defer fetching panels until needed tabs.addTab( Translator.localize(stp.getTabKey()), stp.getTabPanel()); } // Increase width to accommodate all tabs on one row. final int minimumWidth = 500; tabs.setPreferredSize(new Dimension(Math.max(tabs .getPreferredSize().width, minimumWidth), tabs .getPreferredSize().height)); tabs.setTabPlacement(SwingConstants.LEFT); setContent(tabs); addWindowListener(this); }
/** * The constructor for this dialog of settings with project scope. */ public ProjectSettingsDialog() { super(Translator.localize("dialog.file.properties"), ArgoDialog.OK_CANCEL_OPTION, true); tabs = new JTabbedPane(); applyButton = new JButton(Translator.localize("button.apply")); String mnemonic = Translator.localize("button.apply.mnemonic"); if (mnemonic != null && mnemonic.length() > 0) { applyButton.setMnemonic(mnemonic.charAt(0)); } applyButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleSave(); } }); addButton(applyButton); resetToDefaultButton = new JButton( Translator.localize("button.reset-to-default")); mnemonic = Translator.localize("button.reset-to-default.mnemonic"); if (mnemonic != null && mnemonic.length() > 0) { resetToDefaultButton.setMnemonic(mnemonic.charAt(0)); } resetToDefaultButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleResetToDefault(); } }); addButton(resetToDefaultButton); // Add settings from the settings registry. Iterator iter = GUI.getInstance().getProjectSettingsTabs().iterator(); while (iter.hasNext()) { GUISettingsTabInterface stp = (GUISettingsTabInterface) iter.next(); tabs.addTab( Translator.localize(stp.getTabKey()), stp.getTabPanel()); } // Increase width to accommodate all tabs on one row. final int minimumWidth = 480; tabs.setPreferredSize(new Dimension(Math.max(tabs .getPreferredSize().width, minimumWidth), tabs .getPreferredSize().height)); tabs.setTabPlacement(SwingConstants.LEFT); setContent(tabs); addWindowListener(this); }
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/ui/SettingsDialog.java File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/ui/ProjectSettingsDialog.java
Method name: void SettingsDialog() Method name: void ProjectSettingsDialog()
Number of AST nodes: 2 Number of AST nodes: 3
1
/**
1
/**
2
     * Constructor to build new settings dialog.
2
     * The constructor for this dialog of settings with project scope.
3
     */
3
     */
4
    SettingsDialog() {
4
    public ProjectSettingsDialog() {
5
        super(Translator.localize("dialog.settings"),
5
        super(Translator.localize("dialog.file.properties"),
6
              ArgoDialog.OK_CANCEL_OPTION,
6
                ArgoDialog.OK_CANCEL_OPTION,
7
              true);
7
                true);
8
8
        
9
        tabs = new JTabbedPane();
9
        tabs = new JTabbedPane();
10
10
        
11
        applyButton = new JButton(Translator.localize("button.apply"));
11
        applyButton = new JButton(Translator.localize("button.apply"));
12
        String mnemonic = Translator.localize("button.apply.mnemonic");
12
        String mnemonic = Translator.localize("button.apply.mnemonic");
13
        if (mnemonic != null && mnemonic.length() > 0) {
13
        if (mnemonic != null && mnemonic.length() > 0) {
14
            applyButton.setMnemonic(mnemonic.charAt(0));
14
            applyButton.setMnemonic(mnemonic.charAt(0));
15
        }
15
        }
16
        applyButton.addActionListener(new ActionListener() {
16
        applyButton.addActionListener(new ActionListener() {
17
            public void actionPerformed(ActionEvent e) {
17
            public void actionPerformed(ActionEvent e) {
18
                handleSave();
18
                handleSave();
19
            }
19
            }
20
        });
20
        });
21
        addButton(applyButton);
21
        addButton(applyButton);
22
22
        
23
        // Add settings from the settings registry.
23
        resetToDefaultButton = new JButton(
24
        settingsTabs = GUI.getInstance().getSettingsTabs();
24
                Translator.localize("button.reset-to-default"));
25
        for (GUISettingsTabInterface stp : settingsTabs) {
25
        mnemonic = Translator.localize("button.reset-to-default.mnemonic");
26
            // TODO: Only fetch names and defer fetching panels until needed
26
        if (mnemonic != null && mnemonic.length() > 0) {
27
            tabs.addTab(
27
            resetToDefaultButton.setMnemonic(mnemonic.charAt(0));
28
                    Translator.localize(stp.getTabKey()),
28
        }
29
                    stp.getTabPanel());
29
        resetToDefaultButton.addActionListener(new ActionListener() {
30
        }
30
            public void actionPerformed(ActionEvent e) {
31
31
                handleResetToDefault();
32
        // Increase width to accommodate all tabs on one row.
32
            }
33
        final int minimumWidth = 500;
33
        });
34
        tabs.setPreferredSize(new Dimension(Math.max(tabs
34
        addButton(resetToDefaultButton);
35
                .getPreferredSize().width, minimumWidth), tabs
35
       
36
                .getPreferredSize().height));
36
        // Add settings from the settings registry.
37
37
        Iterator iter = GUI.getInstance().getProjectSettingsTabs().iterator();
38
        tabs.setTabPlacement(SwingConstants.LEFT);
38
        while (iter.hasNext()) {
39
        setContent(tabs);
39
            GUISettingsTabInterface stp =
40
        addWindowListener(this);
40
                (GUISettingsTabInterface) iter.next();
41
    }
41
42
            tabs.addTab(
43
                    Translator.localize(stp.getTabKey()),
44
                    stp.getTabPanel());
45
        }
46
47
        // Increase width to accommodate all tabs on one row.
48
        final int minimumWidth = 480;
49
        tabs.setPreferredSize(new Dimension(Math.max(tabs
50
                .getPreferredSize().width, minimumWidth), tabs
51
                .getPreferredSize().height));
52
53
        tabs.setTabPlacement(SwingConstants.LEFT);
54
        setContent(tabs);
55
        addWindowListener(this);
56
    }
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Similarity Score1.000
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    10
    for (GUISettingsTabInterface stp : settingsTabs)
    10
    for (GUISettingsTabInterface stp : settingsTabs)
    16
    while (iter.hasNext())
    Differences
    Expression1Expression2Difference
    settingsTabsGUI.getInstance().getProjectSettingsTabs()TYPE_COMPATIBLE_REPLACEMENT
    16
    while (iter.hasNext())
                                                                                                                                              
    17
    GUISettingsTabInterface stp = (GUISettingsTabInterface)iter.next();
    11
    tabs.addTab(Translator.localize(stp.getTabKey()), stp.getTabPanel());
    18
    tabs.addTab(Translator.localize(stp.getTabKey()), stp.getTabPanel());
    Precondition Violations (0)
    Row Violation