Ignore:
Timestamp:
2016-05-11T02:44:10+02:00 (8 years ago)
Author:
Don-vip
Message:

sonar - squid:AssignmentInSubExpressionCheck - Assignments should not be made from within sub-expressions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java

    r10035 r10179  
    3737public class PreferenceDialog extends JDialog {
    3838
    39     private PreferenceTabbedPane tpPreferences;
     39    private final PreferenceTabbedPane tpPreferences = new PreferenceTabbedPane();
    4040    private boolean canceled;
     41
     42    /**
     43     * Constructs a new {@code PreferenceDialog}.
     44     * @param parent parent component
     45     */
     46    public PreferenceDialog(Component parent) {
     47        super(GuiHelper.getFrameForComponent(parent), tr("Preferences"), ModalityType.DOCUMENT_MODAL);
     48        build();
     49        this.setMinimumSize(new Dimension(600, 350));
     50        // set the maximum width to the current screen. If the dialog is opened on a
     51        // smaller screen than before, this will reset the stored preference.
     52        this.setMaximumSize(GuiHelper.getScreenSize());
     53    }
    4154
    4255    protected JPanel buildActionPanel() {
     
    6578        Container c = getContentPane();
    6679        c.setLayout(new BorderLayout());
    67         c.add(tpPreferences = new PreferenceTabbedPane(), BorderLayout.CENTER);
     80        c.add(tpPreferences, BorderLayout.CENTER);
    6881        tpPreferences.buildGui();
    6982        tpPreferences.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
     
    7588        getRootPane().getActionMap().put("cancel", new CancelAction());
    7689        HelpUtil.setHelpContext(getRootPane(), HelpUtil.ht("/Action/Preferences"));
    77     }
    78 
    79     public PreferenceDialog(Component parent) {
    80         super(GuiHelper.getFrameForComponent(parent), tr("Preferences"), ModalityType.DOCUMENT_MODAL);
    81         build();
    82         this.setMinimumSize(new Dimension(600, 350));
    83         // set the maximum width to the current screen. If the dialog is opened on a
    84         // smaller screen than before, this will reset the stored preference.
    85         this.setMaximumSize(GuiHelper.getScreenSize());
    8690    }
    8791
     
    126130    }
    127131
     132    /**
     133     * Select preferences tab by name.
     134     * @param name preferences tab name (icon)
     135     */
    128136    public void selectPreferencesTabByName(String name) {
    129137        tpPreferences.selectTabByName(name);
    130138    }
    131139
     140    /**
     141     * Select preferences tab by class.
     142     * @param clazz preferences tab class
     143     */
    132144    public void selectPreferencesTabByClass(Class<? extends TabPreferenceSetting> clazz) {
    133145        tpPreferences.selectTabByPref(clazz);
    134146    }
    135147
     148    /**
     149     * Select preferences sub-tab by class.
     150     * @param clazz preferences sub-tab class
     151     */
    136152    public void selectSubPreferencesTabByClass(Class<? extends SubPreferenceSetting> clazz) {
    137153        tpPreferences.selectSubTabByPref(clazz);
Note: See TracChangeset for help on using the changeset viewer.