source: josm/trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java@ 4897

Last change on this file since 4897 was 4897, checked in by stoecker, 12 years ago

cleanup shortcut handling a lot, fix some more deprecations

  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1// License: GPL. Copyright 2007 by Immanuel Scholz and others
2package org.openstreetmap.josm.tools;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.awt.GraphicsEnvironment;
7import java.awt.event.KeyEvent;
8import java.io.File;
9import java.io.IOException;
10
11import org.openstreetmap.josm.Main;
12
13/**
14 * see PlatformHook.java
15 */
16public class PlatformHookWindows extends PlatformHookUnixoid implements PlatformHook {
17 public void openUrl(String url) throws IOException {
18 Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
19 }
20
21 public void initSystemShortcuts() {
22 // This list if far from complete!
23 Shortcut.registerSystemShortcut("system:exit", tr("unused"), KeyEvent.VK_F4, KeyEvent.ALT_DOWN_MASK).setAutomatic(); // items with automatic shortcuts will not be added to the menu bar at all
24 Shortcut.registerSystemShortcut("system:menuexit", tr("unused"), KeyEvent.VK_Q, KeyEvent.CTRL_DOWN_MASK);
25 Shortcut.registerSystemShortcut("system:copy", tr("unused"), KeyEvent.VK_C, KeyEvent.CTRL_DOWN_MASK);
26 Shortcut.registerSystemShortcut("system:paste", tr("unused"), KeyEvent.VK_V, KeyEvent.CTRL_DOWN_MASK);
27 Shortcut.registerSystemShortcut("system:cut", tr("unused"), KeyEvent.VK_X, KeyEvent.CTRL_DOWN_MASK);
28 Shortcut.registerSystemShortcut("system:duplicate", tr("unused"), KeyEvent.VK_D, KeyEvent.CTRL_DOWN_MASK); // not really system, but to avoid odd results
29 Shortcut.registerSystemShortcut("system:help", tr("unused"), KeyEvent.VK_F1, 0);
30 }
31
32 public String getDefaultStyle()
33 {
34 return "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
35 }
36
37 @Override
38 public boolean rename(File from, File to)
39 {
40 if(to.exists())
41 to.delete();
42 return from.renameTo(to);
43 }
44}
Note: See TracBrowser for help on using the repository browser.