1 | // License: GPL. Copyright 2007 by Immanuel Scholz and others
|
---|
2 | package org.openstreetmap.josm.tools;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import java.awt.GraphicsEnvironment;
|
---|
7 | import java.awt.event.KeyEvent;
|
---|
8 | import java.io.File;
|
---|
9 | import java.io.IOException;
|
---|
10 |
|
---|
11 | import org.openstreetmap.josm.Main;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * see PlatformHook.java
|
---|
15 | */
|
---|
16 | public 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 | }
|
---|