+
Index: core/src/org/netbeans/core/ShortcutsFolder.java
===================================================================
RCS file: /cvs/core/src/org/netbeans/core/ShortcutsFolder.java,v
retrieving revision 1.19
diff -u -u -r1.19 ShortcutsFolder.java
--- core/src/org/netbeans/core/ShortcutsFolder.java 27 Jul 2004 04:19:45 -0000 1.19
+++ core/src/org/netbeans/core/ShortcutsFolder.java 30 Aug 2004 22:36:46 -0000
@@ -17,6 +17,8 @@
import java.awt.*;
import java.awt.event.*;
import java.util.*;
+import java.util.Collection;
+import java.util.List;
import javax.swing.text.Keymap;
import javax.swing.*;
@@ -69,7 +71,7 @@
/** Creates new ShortcutsFolder */
- private ShortcutsFolder(DataFolder f) {
+ ShortcutsFolder(DataFolder f) {
super(f);
recreate();
}
@@ -444,7 +446,19 @@
}
}
} else {
- InstanceDataObject.remove(f, r.instanceName(), r.instanceClass());
+ String instanceName = r.instanceName();
+ if (!InstanceDataObject.remove(f, instanceName, r.instanceClass())) {
+ //We may be deleting a wildcard keystroke, and/or the
+ //order defined in the layer may not be the same as
+ //what we were fed by the shortcuts editor, so search
+ //all the possible variants
+ String[] permutations = getPermutations(instanceName);
+ for (int i=0; i < permutations.length; i++) {
+ if (InstanceDataObject.remove(f, permutations[i], r.instanceClass())) {
+ break;
+ }
+ }
+ }
}
} else { // It is '.shadow' file
FileObject root = f.getPrimaryFile();
@@ -459,6 +473,18 @@
if(foRemove != null) {
foRemove.delete();
}
+ String[] permutations = getPermutations(r.instanceName());
+ //We may be deleting a wildcard keystroke, and/or the
+ //order defined in the layer may not be the same as
+ //what we were fed by the shortcuts editor, so search
+ //all the possible variants
+ for (int i=0; i < permutations.length; i++) {
+ foRemove = root.getFileObject(permutations[i], "shadow");
+ if (foRemove != null) {
+ foRemove.delete();
+ break;
+ }
+ }
}
}
} catch (ClassNotFoundException ex) {
@@ -468,6 +494,107 @@
}
}
}
+
+ /**
+ * There is no required ordering of key modifiers (C, M, S, A), and the
+ * D (default) wildcard character can map to either C or M depending on
+ * the platform. So when we need to delete a keybinding, the editor has
+ * given us one possible ordering, but not necessarily the correct one; it
+ * has also given us a hard keybinding, but the key may really be bound to
+ * D. So, for "MAS-F5" (meta-alt-shift F5) on the pc, we need to check
+ * MSA-F5, SMA-F5, SAM-F5, AMS-F5, ASM-F5; on the mac, we also need to check
+ * the same permutations of DAS-F5, since it may be registered with the
+ * wildcard character.
+ *
+ * Finally, for each permutation, it is legal to separate characters with
+ * dashes - so for each permutation, we must also check for a hyphenated
+ * variant - i.e. for MAS-F5, we must check M-A-S-F5. Note that mixed
+ * hyphenation (M-AS-F5) is not supported. It either is or it isn't.
+ *
+ */
+ static String[] getPermutations (String name) {
+ String key = KeyEvent.META_MASK == Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() ?
+ "M" : "C"; //NOI18N
+
+ int pos = name.lastIndexOf ("-"); //NOI18N
+ String keyPart = name.substring (pos);
+ String modsPart = Utilities.replaceString (name.substring (0, pos), "-", "");
+ if (modsPart.length() > 1) {
+ Collection perms = new HashSet(modsPart.length() * modsPart.length());
+ int idx = name.indexOf(key);
+ if (idx != -1) {
+ //First, try with the wildcard key. Remove all hyphens - we'll
+ //put them back later
+ StringBuffer sb = new StringBuffer(modsPart);
+ sb.replace(idx, idx+1, "D");
+ perms.add (sb.toString() + keyPart);
+ getAllPossibleOrderings (sb.toString(), keyPart, perms);
+ createHyphenatedPermutation(sb.toString().toCharArray(), perms, keyPart);
+ } else {
+ idx = name.indexOf ("D"); //NOI18N
+ if (idx != -1) {
+ StringBuffer sb = new StringBuffer(modsPart);
+ sb.replace(idx, idx+1, key);
+ perms.add (sb.toString() + keyPart);
+ getAllPossibleOrderings (sb.toString(), keyPart, perms);
+ createHyphenatedPermutation(sb.toString().toCharArray(), perms, keyPart);
+ }
+ }
+ getAllPossibleOrderings (modsPart, keyPart, perms);
+ createHyphenatedPermutation(modsPart.toCharArray(), perms, keyPart);
+ return (String[]) perms.toArray(new String[perms.size()]);
+ } else {
+ return key.equals (modsPart) ?
+ new String[] {"D" + keyPart} : new String[0];
+ }
+ }
+
+ /**
+ * Retrieves all the possible orders for the passed in string, and puts them
+ * in the passed collection, appending toAppend
to each.
+ */
+ static void getAllPossibleOrderings (String s, String toAppend, final Collection store) {
+ char[] c = s.toCharArray();
+ mutate (c, store, 0, toAppend);
+ String[] result = (String[]) store.toArray(new String[store.size()]);
+ }
+
+ /**
+ * Recursively generates all possible orderings of the passed char array
+ */
+ private static void mutate(char[] c, Collection l, int n, String toAppend) {
+ if (n == c.length) {
+ l.add (new String(c) + toAppend);
+ createHyphenatedPermutation(c, l, toAppend);
+ return;
+ }
+ //XXX could be optimized to eliminate duplicates
+ for (int i=0; i < c.length; i++) {
+ char x = c[i];
+ c[i] = c[n];
+ c[n] = x;
+ if (n < c.length) {
+ mutate (c, l, n+1, toAppend);
+ }
+ }
+ }
+
+ /**
+ * Inserts "-" characters between each character in the char array and
+ * adds the result + toAppend to the collection.
+ */
+ static void createHyphenatedPermutation (char[] c, Collection l, String toAppend) {
+ if (c.length == 1) {
+ return;
+ }
+ StringBuffer sb = new StringBuffer (new String(c));
+ for (int i=c.length-1; i >= 1; i-=1) {
+ sb.insert (i, '-');
+ }
+ sb.append (toAppend);
+ l.add (sb.toString());
+ }
+
private static DataObject findForAction (DataFolder actionsFolder, Action a) {
if (actionsFolder == null) {
Index: core/ui/src/org/netbeans/core/ui/MenuWarmUpTask.java
===================================================================
RCS file: /cvs/core/ui/src/org/netbeans/core/ui/MenuWarmUpTask.java,v
retrieving revision 1.9
diff -u -u -r1.9 MenuWarmUpTask.java
--- core/ui/src/org/netbeans/core/ui/MenuWarmUpTask.java 19 Aug 2004 12:45:01 -0000 1.9
+++ core/ui/src/org/netbeans/core/ui/MenuWarmUpTask.java 30 Aug 2004 22:36:48 -0000
@@ -43,35 +43,6 @@
private Component[] comps;
- /**
- * Issue 32733 - the keyboard shortcut for FIND will use this method to
- * determine its visibility. For non-solaris operating systems, there is
- * no find key (XXX ask the HP folks about VMS), so that shouldn't be the
- * shortcut displayed in the menu.
- *
- * While this method doesn't really belong in a warmup task, it's silly to
- * create an extra class just for this sort of thing.
- */
- public static boolean isNotSolaris() {
- return Utilities.getOperatingSystem() != Utilities.OS_SOLARIS;
- }
-
- /**
- * Used to determine whether to bind Delete or Backspace to DeleteAction -
- * mac keyboards don't have a delete key.
- */
- public static boolean isMac() {
- return Utilities.getOperatingSystem() == Utilities.OS_MAC;
- }
-
- /**
- * Used to determine whether to bind Delete or Backspace to DeleteAction -
- * mac keyboards don't have a delete key.
- */
- public static boolean isNotMac() {
- return !isMac();
- }
-
/** Actually performs pre-heat.
*/
public void run() {
Index: core/ui/src/org/netbeans/core/ui/resources/layer.xml
===================================================================
RCS file: /cvs/core/ui/src/org/netbeans/core/ui/resources/layer.xml,v
retrieving revision 1.72
diff -u -u -r1.72 layer.xml
--- core/ui/src/org/netbeans/core/ui/resources/layer.xml 20 Aug 2004 08:34:31 -0000 1.72
+++ core/ui/src/org/netbeans/core/ui/resources/layer.xml 30 Aug 2004 22:36:50 -0000
@@ -243,7 +243,7 @@
-
+
@@ -253,21 +253,13 @@
-
-
-
-
-
-
-
-
-
+
-
+
@@ -279,7 +271,7 @@
-
+
@@ -287,22 +279,20 @@
-
+
-
-
-
+
-
+
@@ -314,14 +304,14 @@
-
+
-
+
Index: core/windows/src/org/netbeans/core/windows/actions/RecentViewListAction.java
===================================================================
RCS file: /cvs/core/windows/src/org/netbeans/core/windows/actions/RecentViewListAction.java,v
retrieving revision 1.6
diff -u -u -r1.6 RecentViewListAction.java
--- core/windows/src/org/netbeans/core/windows/actions/RecentViewListAction.java 2 Aug 2004 14:39:35 -0000 1.6
+++ core/windows/src/org/netbeans/core/windows/actions/RecentViewListAction.java 30 Aug 2004 22:36:50 -0000
@@ -113,7 +113,7 @@
* not pointing to anything by returning null
*/
public static String getStringRep4Unixes() {
- if (Utilities.isUnix()) {
+ if (Utilities.isUnix() || (Utilities.getOperatingSystem() & Utilities.OS_MAC) != 0) {
return "Actions/Window/org-netbeans-core-windows-actions-RecentViewListAction.instance"; //NOI18N
}
return null;
Index: core/windows/src/org/netbeans/core/windows/resources/layer.xml
===================================================================
RCS file: /cvs/core/windows/src/org/netbeans/core/windows/resources/layer.xml,v
retrieving revision 1.32
diff -u -u -r1.32 layer.xml
--- core/windows/src/org/netbeans/core/windows/resources/layer.xml 27 Jul 2004 15:47:11 -0000 1.32
+++ core/windows/src/org/netbeans/core/windows/resources/layer.xml 30 Aug 2004 22:36:50 -0000
@@ -136,8 +136,8 @@
-
-
+
+
@@ -148,18 +148,18 @@
-
+
-
+
-
+
-
+
Index: debuggerjpda/ui/src/org/netbeans/modules/debugger/jpda/resources/mf-layer.xml
===================================================================
RCS file: /cvs/debuggerjpda/ui/src/org/netbeans/modules/debugger/jpda/resources/mf-layer.xml,v
retrieving revision 1.21
diff -u -u -r1.21 mf-layer.xml
--- debuggerjpda/ui/src/org/netbeans/modules/debugger/jpda/resources/mf-layer.xml 27 Jul 2004 06:29:12 -0000 1.21
+++ debuggerjpda/ui/src/org/netbeans/modules/debugger/jpda/resources/mf-layer.xml 30 Aug 2004 22:37:02 -0000
@@ -188,13 +188,13 @@
-
+
-
+
-
+
@@ -209,16 +209,16 @@
-
+
-
+
-
+
Index: editor/libsrc/org/netbeans/editor/SettingsDefaults.java
===================================================================
RCS file: /cvs/editor/libsrc/org/netbeans/editor/SettingsDefaults.java,v
retrieving revision 1.36
diff -u -u -r1.36 SettingsDefaults.java
--- editor/libsrc/org/netbeans/editor/SettingsDefaults.java 18 Aug 2004 17:22:18 -0000 1.36
+++ editor/libsrc/org/netbeans/editor/SettingsDefaults.java 30 Aug 2004 22:37:04 -0000
@@ -196,21 +196,37 @@
SettingsNames.STATUS_BAR_BOLD_COLORING
};
- public static final MultiKeyBinding[] defaultKeyBindings
+
+ private static final int FIND_NEXT_KEY =
+ System.getProperty("mrj.version") == null ?
+ KeyEvent.VK_F3 : KeyEvent.VK_G;
+
+ private static final int FIND_NEXT_MASK =
+ System.getProperty("mrj.version") == null ?
+ 0 : KeyEvent.META_DOWN_MASK;
+
+ //#26854 - use Command, not Ctrl, on mac
+ private static final int MENU_MASK = java.awt.Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
+
+ //Default behavior on mac is that alt+arrows is word jumps
+ private static final int WORD_SELECT_MASK = System.getProperty("mrj.version") == null ?
+ InputEvent.CTRL_DOWN_MASK : InputEvent.ALT_DOWN_MASK;
+
+ public static MultiKeyBinding[] defaultKeyBindings
= new MultiKeyBinding[] {
- new MultiKeyBinding(
+ new MultiKeyBinding( //0
(KeyStroke)null, // this assigns the default action to keymap
BaseKit.defaultKeyTypedAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //1
KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
BaseKit.insertBreakAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //2
+ KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, MENU_MASK),
BaseKit.splitLineAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //3
KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_MASK),
BaseKit.startNewLineAction
),
@@ -222,299 +238,299 @@
// KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_MASK),
// BaseKit.startNewLineAction
// ),
- new MultiKeyBinding(
+ new MultiKeyBinding( //4
KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0),
BaseKit.insertTabAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //5
KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK),
BaseKit.removeTabAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //6
KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0),
BaseKit.deletePrevCharAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //7
KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, InputEvent.SHIFT_MASK),
BaseKit.deletePrevCharAction
),
/* new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
+ KeyStroke.getKeyStroke(KeyEvent.VK_H, MENU_MASK | InputEvent.SHIFT_MASK),
BaseKit.deletePrevCharAction
),
-*/ new MultiKeyBinding(
+*/ new MultiKeyBinding( //8
KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),
BaseKit.deleteNextCharAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //9
KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0),
BaseKit.forwardAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //10
KeyStroke.getKeyStroke(KeyEvent.VK_KP_RIGHT, 0), // keypad right
BaseKit.forwardAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //11
KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.SHIFT_MASK),
BaseKit.selectionForwardAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //12
+ KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, WORD_SELECT_MASK),
BaseKit.nextWordAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //13
+ KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.SHIFT_MASK | WORD_SELECT_MASK),
BaseKit.selectionNextWordAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //14
KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0),
BaseKit.backwardAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //15
KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT, 0), // keypad left
BaseKit.backwardAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.SHIFT_MASK),
+ new MultiKeyBinding( //16
+ KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.SHIFT_MASK),
BaseKit.selectionBackwardAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //17
+ KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, WORD_SELECT_MASK),
BaseKit.previousWordAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //18
+ KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.SHIFT_MASK | WORD_SELECT_MASK),
BaseKit.selectionPreviousWordAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //19
KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0),
BaseKit.downAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //20
KeyStroke.getKeyStroke(KeyEvent.VK_KP_DOWN, 0), // keypad down
BaseKit.downAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //21
KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.SHIFT_MASK),
BaseKit.selectionDownAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //22
KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.CTRL_MASK),
BaseKit.scrollUpAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //23
KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0),
BaseKit.upAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //24
KeyStroke.getKeyStroke(KeyEvent.VK_KP_UP, 0), // keypad up
BaseKit.upAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //25
KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.SHIFT_MASK),
BaseKit.selectionUpAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //26
KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.CTRL_MASK),
BaseKit.scrollDownAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //27
KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0),
BaseKit.pageDownAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //28
KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, InputEvent.SHIFT_MASK),
BaseKit.selectionPageDownAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //29
KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0),
BaseKit.pageUpAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //30
KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, InputEvent.SHIFT_MASK),
BaseKit.selectionPageUpAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //31
KeyStroke.getKeyStroke(KeyEvent.VK_HOME, 0),
BaseKit.beginLineAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //32
KeyStroke.getKeyStroke(KeyEvent.VK_HOME, InputEvent.SHIFT_MASK),
BaseKit.selectionBeginLineAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_HOME, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //33
+ KeyStroke.getKeyStroke(KeyEvent.VK_HOME, MENU_MASK),
BaseKit.beginAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_HOME, InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //34
+ KeyStroke.getKeyStroke(KeyEvent.VK_HOME, InputEvent.SHIFT_MASK | MENU_MASK),
BaseKit.selectionBeginAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //35
KeyStroke.getKeyStroke(KeyEvent.VK_END, 0),
BaseKit.endLineAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //36
KeyStroke.getKeyStroke(KeyEvent.VK_END, InputEvent.SHIFT_MASK),
BaseKit.selectionEndLineAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_END, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //37
+ KeyStroke.getKeyStroke(KeyEvent.VK_END, MENU_MASK),
BaseKit.endAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_END, InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //38
+ KeyStroke.getKeyStroke(KeyEvent.VK_END, InputEvent.SHIFT_MASK | MENU_MASK),
BaseKit.selectionEndAction
),
// clipboard bindings
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //39
+ KeyStroke.getKeyStroke(KeyEvent.VK_C, MENU_MASK),
BaseKit.copyAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //40
+ KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, MENU_MASK),
BaseKit.copyAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //41
KeyStroke.getKeyStroke(KeyEvent.VK_COPY, 0),
BaseKit.copyAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //42
KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, InputEvent.SHIFT_MASK),
BaseKit.cutAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //43
+ KeyStroke.getKeyStroke(KeyEvent.VK_X, MENU_MASK),
BaseKit.cutAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //44
KeyStroke.getKeyStroke(KeyEvent.VK_CUT, 0),
BaseKit.cutAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //45
+ KeyStroke.getKeyStroke(KeyEvent.VK_V, MENU_MASK),
BaseKit.pasteAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //46
KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, InputEvent.SHIFT_MASK),
BaseKit.pasteAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //47
KeyStroke.getKeyStroke(KeyEvent.VK_PASTE, 0),
BaseKit.pasteAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
+ new MultiKeyBinding( //48
+ KeyStroke.getKeyStroke(KeyEvent.VK_V, MENU_MASK | InputEvent.SHIFT_MASK),
BaseKit.pasteFormatedAction
),
// undo and redo bindings - handled at system level
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //49
+ KeyStroke.getKeyStroke(KeyEvent.VK_Z, MENU_MASK),
BaseKit.undoAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //50
KeyStroke.getKeyStroke(KeyEvent.VK_UNDO, 0),
BaseKit.undoAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_Y, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //51
+ KeyStroke.getKeyStroke(KeyEvent.VK_Y, MENU_MASK),
BaseKit.redoAction
),
// other bindings
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //52
+ KeyStroke.getKeyStroke(KeyEvent.VK_A, MENU_MASK),
BaseKit.selectAllAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //53
new KeyStroke[] {
KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.ALT_MASK),
KeyStroke.getKeyStroke(KeyEvent.VK_E, 0),
},
BaseKit.endWordAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //54
+ KeyStroke.getKeyStroke(KeyEvent.VK_W, MENU_MASK),
BaseKit.removeWordAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //55
+ KeyStroke.getKeyStroke(KeyEvent.VK_U, MENU_MASK),
BaseKit.removeLineBeginAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //56
+ KeyStroke.getKeyStroke(KeyEvent.VK_E, MENU_MASK),
BaseKit.removeLineAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //57
KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, 0),
BaseKit.toggleTypingModeAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_F2, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //58
+ KeyStroke.getKeyStroke(KeyEvent.VK_F2, MENU_MASK),
BaseKit.toggleBookmarkAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //59
KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0),
BaseKit.gotoNextBookmarkAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0),
+ new MultiKeyBinding( //60
+ KeyStroke.getKeyStroke(FIND_NEXT_KEY, FIND_NEXT_MASK),
BaseKit.findNextAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_F3, InputEvent.SHIFT_MASK),
+ new MultiKeyBinding( //61
+ KeyStroke.getKeyStroke(FIND_NEXT_KEY, FIND_NEXT_MASK | InputEvent.SHIFT_MASK),
BaseKit.findPreviousAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_F3, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //62
+ KeyStroke.getKeyStroke(FIND_NEXT_KEY, FIND_NEXT_MASK | InputEvent.CTRL_MASK),
BaseKit.findSelectionAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //63
KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK),
BaseKit.toggleHighlightSearchAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //64
+ KeyStroke.getKeyStroke(KeyEvent.VK_L, MENU_MASK),
BaseKit.wordMatchNextAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_K, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //65
+ KeyStroke.getKeyStroke(KeyEvent.VK_K, MENU_MASK),
BaseKit.wordMatchPrevAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //66
+ KeyStroke.getKeyStroke(KeyEvent.VK_T, MENU_MASK),
BaseKit.shiftLineRightAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //67
+ KeyStroke.getKeyStroke(KeyEvent.VK_D, MENU_MASK),
BaseKit.shiftLineLeftAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //68
KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, InputEvent.SHIFT_MASK),
BaseKit.abbrevResetAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
+ new MultiKeyBinding( //69
+ KeyStroke.getKeyStroke(KeyEvent.VK_C, MENU_MASK | InputEvent.SHIFT_MASK),
BaseKit.annotationsCyclingAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //70
new KeyStroke[] {
KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.ALT_MASK),
KeyStroke.getKeyStroke(KeyEvent.VK_T, 0),
},
BaseKit.adjustWindowTopAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //71
new KeyStroke[] {
KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.ALT_MASK),
KeyStroke.getKeyStroke(KeyEvent.VK_M, 0),
},
BaseKit.adjustWindowCenterAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //72
new KeyStroke[] {
KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.ALT_MASK),
KeyStroke.getKeyStroke(KeyEvent.VK_B, 0),
@@ -522,58 +538,58 @@
BaseKit.adjustWindowBottomAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //73
KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.SHIFT_MASK | InputEvent.ALT_MASK),
BaseKit.adjustCaretTopAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //74
KeyStroke.getKeyStroke(KeyEvent.VK_M, InputEvent.SHIFT_MASK | InputEvent.ALT_MASK),
BaseKit.adjustCaretCenterAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //75
KeyStroke.getKeyStroke(KeyEvent.VK_B, InputEvent.SHIFT_MASK | InputEvent.ALT_MASK),
BaseKit.adjustCaretBottomAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK ),
+ new MultiKeyBinding( //76
+ KeyStroke.getKeyStroke(KeyEvent.VK_F, MENU_MASK | InputEvent.SHIFT_MASK ),
BaseKit.formatAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //77
KeyStroke.getKeyStroke(KeyEvent.VK_J, InputEvent.ALT_MASK),
BaseKit.selectIdentifierAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //78
KeyStroke.getKeyStroke(KeyEvent.VK_K, InputEvent.ALT_MASK),
BaseKit.jumpListPrevAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //79
KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.ALT_MASK),
BaseKit.jumpListNextAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //80
KeyStroke.getKeyStroke(KeyEvent.VK_K, InputEvent.SHIFT_MASK | InputEvent.ALT_MASK),
BaseKit.jumpListPrevComponentAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //81
KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.SHIFT_MASK | InputEvent.ALT_MASK),
BaseKit.jumpListNextComponentAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //82
new KeyStroke[] {
KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.ALT_MASK),
KeyStroke.getKeyStroke(KeyEvent.VK_U, 0),
},
BaseKit.toUpperCaseAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //83
new KeyStroke[] {
KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.ALT_MASK),
KeyStroke.getKeyStroke(KeyEvent.VK_L, 0),
},
BaseKit.toLowerCaseAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //84
new KeyStroke[] {
KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.ALT_MASK),
KeyStroke.getKeyStroke(KeyEvent.VK_R, 0),
@@ -581,81 +597,133 @@
BaseKit.switchCaseAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_M, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //85
+ KeyStroke.getKeyStroke(KeyEvent.VK_M, MENU_MASK),
BaseKit.selectNextParameterAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //86
new KeyStroke[] {
- KeyStroke.getKeyStroke(KeyEvent.VK_J, InputEvent.CTRL_MASK),
+ KeyStroke.getKeyStroke(KeyEvent.VK_J, MENU_MASK),
KeyStroke.getKeyStroke(KeyEvent.VK_S, 0),
},
BaseKit.startMacroRecordingAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //87
new KeyStroke[] {
- KeyStroke.getKeyStroke(KeyEvent.VK_J, InputEvent.CTRL_MASK),
+ KeyStroke.getKeyStroke(KeyEvent.VK_J, MENU_MASK),
KeyStroke.getKeyStroke(KeyEvent.VK_E, 0),
},
BaseKit.stopMacroRecordingAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //88
+ KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, MENU_MASK),
BaseKit.collapseFoldAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_ADD, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //89
+ KeyStroke.getKeyStroke(KeyEvent.VK_ADD, MENU_MASK),
BaseKit.expandFoldAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
+ new MultiKeyBinding( //90
+ KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, MENU_MASK | InputEvent.SHIFT_MASK),
BaseKit.collapseAllFoldsAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_ADD, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
+ new MultiKeyBinding( //91
+ KeyStroke.getKeyStroke(KeyEvent.VK_ADD, MENU_MASK | InputEvent.SHIFT_MASK),
BaseKit.expandAllFoldsAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //92
+ KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, MENU_MASK),
BaseKit.collapseFoldAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //93
+ KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, MENU_MASK),
BaseKit.expandFoldAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, InputEvent.CTRL_MASK),
+ new MultiKeyBinding( //94
+ KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, MENU_MASK),
BaseKit.expandFoldAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
+ new MultiKeyBinding( //95
+ KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, MENU_MASK | InputEvent.SHIFT_MASK),
BaseKit.collapseAllFoldsAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
+ new MultiKeyBinding( //96
+ KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, MENU_MASK | InputEvent.SHIFT_MASK),
BaseKit.expandAllFoldsAction
),
- new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
+ new MultiKeyBinding( //97
+ KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, MENU_MASK | InputEvent.SHIFT_MASK),
BaseKit.expandAllFoldsAction
),
- new MultiKeyBinding(
+ new MultiKeyBinding( //98
KeyStroke.getKeyStroke(KeyEvent.VK_Q, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK),
"dump-view-hierarchy" // NOI18N
)
};
+
+ //#46811 - Install mac specific key handling
+ static {
+ int end = 8;
+ if (System.getProperty("mrj.version") != null) { //NOI18N
+ MultiKeyBinding[] nue = new MultiKeyBinding[defaultKeyBindings.length + end];
+
+ nue[0] = new MultiKeyBinding(
+ KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.META_MASK),
+ BaseKit.endLineAction
+ );
+
+ nue[1] = new MultiKeyBinding(
+ KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.META_MASK),
+ BaseKit.beginLineAction
+ );
+
+ nue[2] = new MultiKeyBinding(
+ KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.META_MASK),
+ BaseKit.beginAction
+ );
+
+ nue[3] = new MultiKeyBinding(
+ KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.META_MASK),
+ BaseKit.endAction
+ );
+
+ nue[4] = new MultiKeyBinding(
+ KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.META_MASK | InputEvent.SHIFT_MASK),
+ BaseKit.selectionEndAction
+ );
+
+ nue[5] = new MultiKeyBinding(
+ KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.META_MASK | InputEvent.SHIFT_MASK),
+ BaseKit.selectionBeginAction
+ );
+
+ nue[6] = new MultiKeyBinding( //36
+ KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.SHIFT_MASK | InputEvent.META_MASK),
+ BaseKit.selectionEndLineAction
+ );
+
+ nue[7] = new MultiKeyBinding( //32
+ KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.SHIFT_MASK | InputEvent.META_MASK),
+ BaseKit.selectionBeginLineAction
+ );
+
+
+ System.arraycopy(defaultKeyBindings, 0, nue, end, defaultKeyBindings.length);
+ defaultKeyBindings = nue;
+ }
+ }
}
Index: editor/libsrc/org/netbeans/editor/ext/ExtSettingsDefaults.java
===================================================================
RCS file: /cvs/editor/libsrc/org/netbeans/editor/ext/ExtSettingsDefaults.java,v
retrieving revision 1.34
diff -u -u -r1.34 ExtSettingsDefaults.java
--- editor/libsrc/org/netbeans/editor/ext/ExtSettingsDefaults.java 12 Aug 2004 12:05:19 -0000 1.34
+++ editor/libsrc/org/netbeans/editor/ext/ExtSettingsDefaults.java 30 Aug 2004 22:37:04 -0000
@@ -72,6 +72,7 @@
public static final Integer defaultJavaDocAutoPopupDelay = new Integer(200);
public static final Dimension defaultJavaDocPreferredSize = new Dimension(500, 300);
public static final Boolean defaultJavaDocAutoPopup = Boolean.TRUE;
+ private static int MENU_MASK = java.awt.Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
public static final MultiKeyBinding[] defaultExtKeyBindings
= new MultiKeyBinding[] {
@@ -81,7 +82,7 @@
),
*/
new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_MASK),
+ KeyStroke.getKeyStroke(KeyEvent.VK_F, MENU_MASK),
ExtKit.findAction
),
new MultiKeyBinding(
@@ -89,7 +90,7 @@
ExtKit.findAction
),
new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.CTRL_MASK),
+ KeyStroke.getKeyStroke(KeyEvent.VK_H, MENU_MASK),
ExtKit.replaceAction
),
new MultiKeyBinding(
@@ -109,11 +110,11 @@
ExtKit.escapeAction
),
new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, InputEvent.CTRL_MASK),
+ KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, MENU_MASK),
ExtKit.matchBraceAction
),
new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
+ KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, MENU_MASK | InputEvent.SHIFT_MASK),
ExtKit.selectionMatchBraceAction
),
new MultiKeyBinding(
@@ -121,8 +122,8 @@
ExtKit.showPopupMenuAction
),
/* new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_MASK),
- // KeyStroke.getKeyStroke(KeyEvent.VK_BRACELEFT, InputEvent.CTRL_MASK),
+ KeyStroke.getKeyStroke(KeyEvent.VK_U, MENU_MASK),
+ // KeyStroke.getKeyStroke(KeyEvent.VK_BRACELEFT, MENU_MASK),
ExtKit.braceCodeSelectAction
),
*/
Index: editor/libsrc/org/netbeans/editor/ext/java/JavaSettingsDefaults.java
===================================================================
RCS file: /cvs/editor/libsrc/org/netbeans/editor/ext/java/JavaSettingsDefaults.java,v
retrieving revision 1.25
diff -u -u -r1.25 JavaSettingsDefaults.java
--- editor/libsrc/org/netbeans/editor/ext/java/JavaSettingsDefaults.java 18 Aug 2004 17:22:27 -0000 1.25
+++ editor/libsrc/org/netbeans/editor/ext/java/JavaSettingsDefaults.java 30 Aug 2004 22:37:05 -0000
@@ -154,20 +154,22 @@
}
public static MultiKeyBinding[] getJavaKeyBindings() {
+ int MENU_MASK = java.awt.Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
+
return new MultiKeyBinding[] {
new MultiKeyBinding(
new KeyStroke[] {
- KeyStroke.getKeyStroke(KeyEvent.VK_J, InputEvent.CTRL_MASK),
+ KeyStroke.getKeyStroke(KeyEvent.VK_J, MENU_MASK),
KeyStroke.getKeyStroke(KeyEvent.VK_D, 0)
},
"macro-debug-var" // NOI18N
),
new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
+ KeyStroke.getKeyStroke(KeyEvent.VK_T, MENU_MASK | InputEvent.SHIFT_MASK),
ExtKit.commentAction
),
new MultiKeyBinding(
- KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
+ KeyStroke.getKeyStroke(KeyEvent.VK_D, MENU_MASK | InputEvent.SHIFT_MASK),
ExtKit.uncommentAction
)
};
Index: editor/src/org/netbeans/modules/editor/java/NbJavaSettingsInitializer.java
===================================================================
RCS file: /cvs/editor/src/org/netbeans/modules/editor/java/NbJavaSettingsInitializer.java,v
retrieving revision 1.30
diff -u -u -r1.30 NbJavaSettingsInitializer.java
--- editor/src/org/netbeans/modules/editor/java/NbJavaSettingsInitializer.java 18 Aug 2004 17:22:33 -0000 1.30
+++ editor/src/org/netbeans/modules/editor/java/NbJavaSettingsInitializer.java 30 Aug 2004 22:37:05 -0000
@@ -13,6 +13,7 @@
package org.netbeans.modules.editor.java;
+import java.awt.Toolkit;
import java.awt.event.KeyEvent;
import java.awt.event.InputEvent;
import java.util.Map;
@@ -98,6 +99,7 @@
}
public MultiKeyBinding[] getJavaKeyBindings() {
+ int mask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
return new MultiKeyBinding[] {
new MultiKeyBinding(
new KeyStroke[] {
@@ -127,7 +129,7 @@
),
new MultiKeyBinding(
KeyStroke.getKeyStroke(KeyEvent.VK_B,
- InputEvent.CTRL_MASK),
+ mask),
JavaKit.gotoSuperImplementationAction
),
new MultiKeyBinding(
@@ -137,7 +139,7 @@
),
// new MultiKeyBinding(
// KeyStroke.getKeyStroke(KeyEvent.VK_S,
-// InputEvent.ALT_MASK | InputEvent.CTRL_MASK),
+// InputEvent.ALT_MASK | mask),
// JavaKit.tryCatchAction
// ),
new MultiKeyBinding(
@@ -146,19 +148,19 @@
),
new MultiKeyBinding(
KeyStroke.getKeyStroke(KeyEvent.VK_SPACE,
- InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
+ mask | InputEvent.SHIFT_MASK),
JavaKit.javaDocShowAction
),
new MultiKeyBinding(
KeyStroke.getKeyStroke(KeyEvent.VK_A,
- InputEvent.CTRL_MASK | InputEvent.ALT_MASK),
+ mask | InputEvent.ALT_MASK),
JavaKit.selectNextElementAction
),
new MultiKeyBinding(
KeyStroke.getKeyStroke(KeyEvent.VK_A,
- InputEvent.CTRL_MASK | InputEvent.ALT_MASK | InputEvent.SHIFT_MASK),
+ mask | InputEvent.ALT_MASK | InputEvent.SHIFT_MASK),
JavaKit.selectPreviousElementAction
)
Index: editor/src/org/netbeans/modules/editor/options/KeyBindingsMIMEOptionFile.java
===================================================================
RCS file: /cvs/editor/src/org/netbeans/modules/editor/options/KeyBindingsMIMEOptionFile.java,v
retrieving revision 1.8
diff -u -u -r1.8 KeyBindingsMIMEOptionFile.java
--- editor/src/org/netbeans/modules/editor/options/KeyBindingsMIMEOptionFile.java 15 Sep 2002 20:23:03 -0000 1.8
+++ editor/src/org/netbeans/modules/editor/options/KeyBindingsMIMEOptionFile.java 30 Aug 2004 22:37:06 -0000
@@ -13,9 +13,13 @@
package org.netbeans.modules.editor.options;
+import java.awt.Toolkit;
+import java.awt.event.KeyEvent;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
@@ -168,18 +172,14 @@
for( Iterator i = properties.keySet().iterator(); i.hasNext(); ) {
String key = (String)i.next();
// Process deleted properties
+
if (properties.get(key) instanceof String){
- // if deleted property is in default set, mark it as deleted
- if (defaultKeybs.containsKey(key)){
- Element keybElem = doc.createElement(TAG_BIND);
- keybElem.setAttribute(ATTR_KEY, key);
- keybElem.setAttribute(ATTR_REMOVE, Boolean.TRUE.toString());
- rootElem.appendChild(keybElem);
- }else{
- // put removed keybindings to deleted Map
- removed.add(key);
+ String realKey = tryRemoveKeyFromMap(doc, properties, key, defaultKeybs, rootElem);
+ if (realKey != null) {
+ removed.add(realKey);
+ key = realKey;
}
-
+
// if property is not in default set, it will not be written and will be deleted
continue;
}
@@ -192,8 +192,22 @@
boolean save = true;
if (defaultKeybs.get(key) instanceof MultiKeyBinding){
String defActionName = ((MultiKeyBinding)defaultKeybs.get(key)).actionName;
+
+ boolean hasKey = defaultKeybs.containsKey(key);
+ //Also look for permutations, i.e. CA-F5 may be DA-F5, AD-F5 or AC-F5
+ if (!hasKey) {
+ String[] s = getPermutations (key);
+ for (int j=0; j < s.length && !hasKey; j++) {
+ hasKey |= defaultKeybs.containsKey(s[j]);
+ if (hasKey) {
+ key = s[j];
+ break;
+ }
+ }
+ }
+
// if property is in default set and the action names are the same we don't have to write it
- if (defaultKeybs.containsKey(key) && curActionName.equals(defActionName)) save = false;
+ if (hasKey && curActionName.equals(defActionName)) save = false;
}
if (save){
@@ -214,5 +228,129 @@
saveSettings(doc);
}
+
+ private static String tryRemoveKeyFromMap (Document doc, Map props, String key, Map defaultKeybs, Element root) {
+ // if deleted property is in default set, mark it as deleted
+ if (defaultKeybs.containsKey(key)){
+ removeKeyFromMap (doc, props, key, root);
+ return key;
+ } else {
+ String[] s = getPermutations(key);
+ for (int i=0; i < s.length; i++) {
+ if (defaultKeybs.containsKey(s[i])){
+ removeKeyFromMap (doc, props, key, root);
+ return s[i];
+ }
+ }
+ }
+ return null;
+ }
+
+ private static void removeKeyFromMap(Document doc, Map props, String key, Element root) {
+ Element keybElem = doc.createElement(TAG_BIND);
+ keybElem.setAttribute(ATTR_KEY, key);
+ keybElem.setAttribute(ATTR_REMOVE, Boolean.TRUE.toString());
+ root.appendChild(keybElem);
+ }
+
+ /**
+ * There is no required ordering of key modifiers (C, M, S, A), and the
+ * D (default) wildcard character can map to either C or M depending on
+ * the platform. So when we need to delete a keybinding, the editor has
+ * given us one possible ordering, but not necessarily the correct one; it
+ * has also given us a hard keybinding, but the key may really be bound to
+ * D. So, for "MAS-F5" (meta-alt-shift F5) on the pc, we need to check
+ * MSA-F5, SMA-F5, SAM-F5, AMS-F5, ASM-F5; on the mac, we also need to check
+ * the same permutations of DAS-F5, since it may be registered with the
+ * wildcard character.
+ *
+ * Finally, for each permutation, it is legal to separate characters with
+ * dashes - so for each permutation, we must also check for a hyphenated
+ * variant - i.e. for MAS-F5, we must check M-A-S-F5. Note that mixed
+ * hyphenation (M-AS-F5) is not supported. It either is or it isn't.
+ *
+ */
+ static String[] getPermutations (String name) {
+ String key = KeyEvent.META_MASK == Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() ?
+ "M" : "C"; //NOI18N
+
+ int pos = name.lastIndexOf ("-"); //NOI18N
+ String keyPart = name.substring (pos);
+ String modsPart = org.openide.util.Utilities.replaceString (name.substring (0, pos), "-", "");
+ if (modsPart.length() > 1) {
+ Collection perms = new HashSet(modsPart.length() * modsPart.length());
+ int idx = name.indexOf(key);
+ if (idx != -1) {
+ //First, try with the wildcard key. Remove all hyphens - we'll
+ //put them back later
+ StringBuffer sb = new StringBuffer(modsPart);
+ sb.replace(idx, idx+1, "D");
+ perms.add (sb.toString() + keyPart);
+ getAllPossibleOrderings (sb.toString(), keyPart, perms);
+ createHyphenatedPermutation(sb.toString().toCharArray(), perms, keyPart);
+ } else {
+ idx = name.indexOf ("D"); //NOI18N
+ if (idx != -1) {
+ StringBuffer sb = new StringBuffer(modsPart);
+ sb.replace(idx, idx+1, key);
+ perms.add (sb.toString() + keyPart);
+ getAllPossibleOrderings (sb.toString(), keyPart, perms);
+ createHyphenatedPermutation(sb.toString().toCharArray(), perms, keyPart);
+ }
+ }
+ getAllPossibleOrderings (modsPart, keyPart, perms);
+ createHyphenatedPermutation(modsPart.toCharArray(), perms, keyPart);
+ return (String[]) perms.toArray(new String[perms.size()]);
+ } else {
+ return key.equals (modsPart) ?
+ new String[] {"D" + keyPart} : new String[0];
+ }
+ }
+
+ /**
+ * Retrieves all the possible orders for the passed in string, and puts them
+ * in the passed collection, appending toAppend
to each.
+ */
+ static void getAllPossibleOrderings (String s, String toAppend, final Collection store) {
+ char[] c = s.toCharArray();
+ mutate (c, store, 0, toAppend);
+ String[] result = (String[]) store.toArray(new String[store.size()]);
+ }
+
+ /**
+ * Recursively generates all possible orderings of the passed char array
+ */
+ private static void mutate(char[] c, Collection l, int n, String toAppend) {
+ if (n == c.length) {
+ l.add (new String(c) + toAppend);
+ createHyphenatedPermutation(c, l, toAppend);
+ return;
+ }
+ //XXX could be optimized to eliminate duplicates
+ for (int i=0; i < c.length; i++) {
+ char x = c[i];
+ c[i] = c[n];
+ c[n] = x;
+ if (n < c.length) {
+ mutate (c, l, n+1, toAppend);
+ }
+ }
+ }
+
+ /**
+ * Inserts "-" characters between each character in the char array and
+ * adds the result + toAppend to the collection.
+ */
+ static void createHyphenatedPermutation (char[] c, Collection l, String toAppend) {
+ if (c.length == 1) {
+ return;
+ }
+ StringBuffer sb = new StringBuffer (new String(c));
+ for (int i=c.length-1; i >= 1; i-=1) {
+ sb.insert (i, '-');
+ }
+ sb.append (toAppend);
+ l.add (sb.toString());
+ }
}
Index: editor/src/org/netbeans/modules/editor/resources/XMLs/DefaultGlobalKeyBindings.xml
===================================================================
RCS file: /cvs/editor/src/org/netbeans/modules/editor/resources/XMLs/DefaultGlobalKeyBindings.xml,v
retrieving revision 1.10
diff -u -u -r1.10 DefaultGlobalKeyBindings.xml
--- editor/src/org/netbeans/modules/editor/resources/XMLs/DefaultGlobalKeyBindings.xml 12 Aug 2004 12:05:20 -0000 1.10
+++ editor/src/org/netbeans/modules/editor/resources/XMLs/DefaultGlobalKeyBindings.xml 30 Aug 2004 22:37:06 -0000
@@ -1,6 +1,10 @@
+
+
@@ -16,37 +20,37 @@
-
-
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
+
-
+
@@ -58,29 +62,29 @@
-
+
-
-
-
+
+
+
-
-
+
+
-
+
-
+
-
+
@@ -89,25 +93,25 @@
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
Index: editor/src/org/netbeans/modules/editor/resources/XMLs/DefaultKeyBindings.xml
===================================================================
RCS file: /cvs/editor/src/org/netbeans/modules/editor/resources/XMLs/DefaultKeyBindings.xml,v
retrieving revision 1.9
diff -u -u -r1.9 DefaultKeyBindings.xml
--- editor/src/org/netbeans/modules/editor/resources/XMLs/DefaultKeyBindings.xml 12 Aug 2004 12:05:20 -0000 1.9
+++ editor/src/org/netbeans/modules/editor/resources/XMLs/DefaultKeyBindings.xml 30 Aug 2004 22:37:06 -0000
@@ -1,20 +1,24 @@
+
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
Index: form/src/org/netbeans/modules/form/resources/layer.xml
===================================================================
RCS file: /cvs/form/src/org/netbeans/modules/form/resources/layer.xml,v
retrieving revision 1.77
diff -u -u -r1.77 layer.xml
--- form/src/org/netbeans/modules/form/resources/layer.xml 9 Jul 2004 09:28:54 -0000 1.77
+++ form/src/org/netbeans/modules/form/resources/layer.xml 30 Aug 2004 22:37:10 -0000
@@ -460,7 +460,7 @@
-
+
Index: i18n/src/org/netbeans/modules/i18n/Layer.xml
===================================================================
RCS file: /cvs/i18n/src/org/netbeans/modules/i18n/Layer.xml,v
retrieving revision 1.21
diff -u -u -r1.21 Layer.xml
--- i18n/src/org/netbeans/modules/i18n/Layer.xml 16 Mar 2004 15:29:41 -0000 1.21
+++ i18n/src/org/netbeans/modules/i18n/Layer.xml 30 Aug 2004 22:37:12 -0000
@@ -16,7 +16,7 @@
-
+
Index: ide/applemenu/nbproject/project.xml
===================================================================
RCS file: /cvs/ide/applemenu/nbproject/project.xml,v
retrieving revision 1.2
diff -u -u -r1.2 project.xml
--- ide/applemenu/nbproject/project.xml 15 Jun 2004 11:38:17 -0000 1.2
+++ ide/applemenu/nbproject/project.xml 30 Aug 2004 22:37:12 -0000
@@ -33,6 +33,15 @@
+
Index: ide/applemenu/src/org/netbeans/modules/applemenu/layer.xml
===================================================================
RCS file: /cvs/ide/applemenu/src/org/netbeans/modules/applemenu/layer.xml,v
retrieving revision 1.1
diff -u -u -r1.1 layer.xml
--- ide/applemenu/src/org/netbeans/modules/applemenu/layer.xml 8 Jun 2004 12:46:10 -0000 1.1
+++ ide/applemenu/src/org/netbeans/modules/applemenu/layer.xml 30 Aug 2004 22:37:12 -0000
@@ -37,6 +37,43 @@
-->
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: java/src/org/netbeans/modules/java/resources/mf-layer.xml
===================================================================
RCS file: /cvs/java/src/org/netbeans/modules/java/resources/mf-layer.xml,v
retrieving revision 1.50
diff -u -u -r1.50 mf-layer.xml
--- java/src/org/netbeans/modules/java/resources/mf-layer.xml 2 Aug 2004 09:39:52 -0000 1.50
+++ java/src/org/netbeans/modules/java/resources/mf-layer.xml 30 Aug 2004 22:37:28 -0000
@@ -145,7 +145,7 @@
-
+
Index: junit/src/org/netbeans/modules/junit/resources/layer.xml
===================================================================
RCS file: /cvs/junit/src/org/netbeans/modules/junit/resources/layer.xml,v
retrieving revision 1.22
diff -u -u -r1.22 layer.xml
--- junit/src/org/netbeans/modules/junit/resources/layer.xml 21 Jun 2004 07:20:01 -0000 1.22
+++ junit/src/org/netbeans/modules/junit/resources/layer.xml 30 Aug 2004 22:37:37 -0000
@@ -80,10 +80,10 @@
-
+
-
+
Index: monitor/src/org/netbeans/modules/web/monitor/resources/layer.xml
===================================================================
RCS file: /cvs/monitor/src/org/netbeans/modules/web/monitor/resources/layer.xml,v
retrieving revision 1.14
diff -u -u -r1.14 layer.xml
--- monitor/src/org/netbeans/modules/web/monitor/resources/layer.xml 26 May 2004 13:01:53 -0000 1.14
+++ monitor/src/org/netbeans/modules/web/monitor/resources/layer.xml 30 Aug 2004 22:37:40 -0000
@@ -33,7 +33,7 @@
-
+
Index: openide/src/org/openide/filesystems/FileUtil.java
===================================================================
RCS file: /cvs/openide/src/org/openide/filesystems/FileUtil.java,v
retrieving revision 1.112
diff -u -u -r1.112 FileUtil.java
--- openide/src/org/openide/filesystems/FileUtil.java 27 Aug 2004 12:45:54 -0000 1.112
+++ openide/src/org/openide/filesystems/FileUtil.java 30 Aug 2004 22:37:46 -0000
@@ -951,7 +951,8 @@
if (Utilities.isWindows()) {
file = normalizeFileOnWindows(file);
} else if (Utilities.getOperatingSystem() == Utilities.OS_MAC) {
- file = normalizeFileOnMac(file);
+// file = normalizeFileOnMac(file);
+ file = normalizeFileOnUnixAlike(file);
} else {
file = normalizeFileOnUnixAlike(file);
}
Index: openide/src/org/openide/util/Utilities.java
===================================================================
RCS file: /cvs/openide/src/org/openide/util/Utilities.java,v
retrieving revision 1.142
diff -u -u -r1.142 Utilities.java
--- openide/src/org/openide/util/Utilities.java 30 Jul 2004 14:33:20 -0000 1.142
+++ openide/src/org/openide/util/Utilities.java 30 Aug 2004 22:37:50 -0000
@@ -1252,7 +1252,22 @@
} else {
// last text must be the key code
Integer i = (Integer)names.get (el);
+ boolean wildcard = (needed & WILDCARD_MASK) != 0;
+ //Strip out the explicit mask - KeyStroke won't know
+ //what to do with it
+ needed = needed & ~WILDCARD_MASK;
+
if (i != null) {
+ //#26854 - Default accelerator should be Command on mac
+ if (wildcard) {
+ needed |= Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
+ if ((getOperatingSystem() & OS_MAC) != 0) {
+ if (!usableKeyOnMac(i.intValue(), needed)) {
+ needed &= ~Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
+ needed |= KeyEvent.CTRL_MASK;
+ }
+ }
+ }
return KeyStroke.getKeyStroke (i.intValue (), needed);
} else {
return null;
@@ -1263,6 +1278,30 @@
return null;
}
}
+
+ private static final boolean usableKeyOnMac (int key, int mask) {
+ //All permutations fail for Q except ctrl
+ if (key == KeyEvent.VK_Q) return false;
+
+ boolean isMeta = ((mask & KeyEvent.META_MASK) != 0) ||
+ ((mask & KeyEvent.CTRL_DOWN_MASK) != 0);
+
+ boolean isAlt = ((mask & KeyEvent.ALT_MASK) != 0) ||
+ ((mask & KeyEvent.ALT_DOWN_MASK) != 0);
+
+ boolean isOnlyMeta = isMeta && (mask & ~(KeyEvent.META_DOWN_MASK | KeyEvent.META_MASK)) == 0;
+
+ //Mac OS consumes keys Command+ these keys - the app will never see
+ //them, so CTRL should not be remapped for these
+ if (isOnlyMeta) {
+ return key != KeyEvent.VK_H && key !=
+ KeyEvent.VK_SPACE && key != KeyEvent.VK_TAB;
+ } else if (key == KeyEvent.VK_D && isMeta && isAlt) {
+ return false;
+ } else {
+ return true;
+ }
+ }
/** Convert a space-separated list of user-friendly key binding names to a list of Swing key strokes.
* @param s the string with keys
@@ -1283,6 +1322,7 @@
return (KeyStroke[])arr.toArray (new KeyStroke[arr.size ()]);
}
+ private static final int WILDCARD_MASK = 32768;
/** Adds characters for modifiers to the buffer.
* @param buf buffer to add to
@@ -1308,6 +1348,10 @@
buf.append("M"); // NOI18N
b = true;
}
+ if ((modif & WILDCARD_MASK) != 0) {
+ buf.append("D");
+ b = true;
+ }
return b;
}
@@ -1332,6 +1376,9 @@
break;
case 'S':
m |= KeyEvent.SHIFT_MASK;
+ break;
+ case 'D':
+ m |= WILDCARD_MASK;
break;
default:
throw new NoSuchElementException ();
Index: projects/projectui/src/org/netbeans/modules/project/ui/resources/layer.xml
===================================================================
RCS file: /cvs/projects/projectui/src/org/netbeans/modules/project/ui/resources/layer.xml,v
retrieving revision 1.37
diff -u -u -r1.37 layer.xml
--- projects/projectui/src/org/netbeans/modules/project/ui/resources/layer.xml 17 Aug 2004 11:24:59 -0000 1.37
+++ projects/projectui/src/org/netbeans/modules/project/ui/resources/layer.xml 30 Aug 2004 22:38:03 -0000
@@ -490,31 +490,31 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -538,15 +538,15 @@
-
+
-
+
-
+
Index: vcscore/src/org/netbeans/modules/vcscore/resources/mf-layer.xml
===================================================================
RCS file: /cvs/vcscore/src/org/netbeans/modules/vcscore/resources/mf-layer.xml,v
retrieving revision 1.43
diff -u -u -r1.43 mf-layer.xml
--- vcscore/src/org/netbeans/modules/vcscore/resources/mf-layer.xml 17 Aug 2004 15:14:10 -0000 1.43
+++ vcscore/src/org/netbeans/modules/vcscore/resources/mf-layer.xml 30 Aug 2004 22:38:16 -0000
@@ -52,13 +52,13 @@
-
+
-
+
-
+