source: josm/src/org/openstreetmap/josm/actions/PreferencesAction.java@ 168

Last change on this file since 168 was 168, checked in by imi, 18 years ago
  • added plugin-support for preferences
  • added advanced tab to preferences dialog
File size: 1.3 KB
Line 
1package org.openstreetmap.josm.actions;
2
3import static org.openstreetmap.josm.tools.I18n.tr;
4
5import java.awt.GridBagLayout;
6import java.awt.event.ActionEvent;
7import java.awt.event.KeyEvent;
8
9import javax.swing.JDialog;
10import javax.swing.JOptionPane;
11import javax.swing.JPanel;
12
13import org.openstreetmap.josm.Main;
14import org.openstreetmap.josm.gui.preferences.PreferenceDialog;
15import org.openstreetmap.josm.tools.GBC;
16
17/**
18 * Open the Preferences dialog.
19 *
20 * @author imi
21 */
22public class PreferencesAction extends JosmAction {
23
24 /**
25 * Create the preference action with "&Preferences" as label.
26 */
27 public PreferencesAction() {
28 super(tr("Preferences"), "preference", tr("Open a preferences page for global settings."), KeyEvent.VK_F12, 0);
29 }
30
31 /**
32 * Launch the preferences dialog.
33 */
34 public void actionPerformed(ActionEvent e) {
35 PreferenceDialog prefDlg = new PreferenceDialog();
36 JPanel prefPanel = new JPanel(new GridBagLayout());
37 prefPanel.add(prefDlg, GBC.eol().fill(GBC.BOTH));
38
39 JOptionPane pane = new JOptionPane(prefPanel, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
40 JDialog dlg = pane.createDialog(Main.parent, tr("Preferences"));
41 dlg.setVisible(true);
42 if (pane.getValue() instanceof Integer && (Integer)pane.getValue() == JOptionPane.OK_OPTION)
43 prefDlg.ok();
44 }
45}
Note: See TracBrowser for help on using the repository browser.