001 // License: GPL. Copyright 2007 by Immanuel Scholz and others
002 package org.openstreetmap.josm.actions;
003
004 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
005 import static org.openstreetmap.josm.tools.I18n.tr;
006
007 import java.awt.event.ActionEvent;
008 import java.awt.event.KeyEvent;
009
010 import org.openstreetmap.josm.Main;
011 import org.openstreetmap.josm.gui.preferences.PreferenceDialog;
012 import org.openstreetmap.josm.tools.Shortcut;
013
014 /**
015 * Open the Preferences dialog.
016 *
017 * @author imi
018 */
019 public class PreferencesAction extends JosmAction implements Runnable {
020
021 /**
022 * Create the preference action with "&Preferences" as label.
023 */
024 public PreferencesAction() {
025 super(tr("Preferences..."), "preference", tr("Open a preferences dialog for global settings."),
026 Shortcut.registerShortcut("system:preferences", tr("Preferences"), KeyEvent.VK_F12, Shortcut.DIRECT), true);
027 putValue("help", ht("/Action/Preferences"));
028 }
029
030 /**
031 * Launch the preferences dialog.
032 */
033 public void actionPerformed(ActionEvent e) {
034 run();
035 }
036
037 public void run() {
038 new PreferenceDialog(Main.parent).setVisible(true);
039 }
040 }