Author: mvw
Date: 2007-06-21 08:40:29-0700
New Revision: 12887
Modified:
trunk/src_new/org/argouml/ui/cmd/ShortcutMgr.java
trunk/src_new/org/argouml/util/KeyEventUtils.java
Log:
Remove cyclic dependency between org.argouml.util and org.argouml.ui.cmd.
Modified: trunk/src_new/org/argouml/ui/cmd/ShortcutMgr.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/cmd/ShortcutMgr.java?view=diff&rev=12887&p1=trunk/src_new/org/argouml/ui/cmd/ShortcutMgr.java&p2=trunk/src_new/org/argouml/ui/cmd/ShortcutMgr.java&r1=12886&r2=12887
==============================================================================
--- trunk/src_new/org/argouml/ui/cmd/ShortcutMgr.java (original)
+++ trunk/src_new/org/argouml/ui/cmd/ShortcutMgr.java 2007-06-21 08:40:29-0700
@@ -292,36 +292,6 @@
/** Action key for reorder to back */
public static final String ACTION_REORDER_TO_BACK = "reorderToBack";
- /**
- * The expression between modifier/modifier and between modifier/text
- */
- public static final String MODIFIER_JOINER = " + ";
-
- /**
- * The text for the shift modifier
- */
- public static final String SHIFT_MODIFIER = "SHIFT";
-
- /**
- * The text for the ctrl modifier
- */
- public static final String CTRL_MODIFIER = "CTRL";
-
- /**
- * The text for the meta modifier
- */
- public static final String META_MODIFIER = "META";
-
- /**
- * The text for the alt modifier
- */
- public static final String ALT_MODIFIER = "ALT";
-
- /**
- * The text for the alt-gr modifier
- */
- public static final String ALT_GRAPH_MODIFIER = "altGraph";
-
/**
* Logger.
*/
@@ -484,7 +454,7 @@
assert (strKeyStroke != null);
StringTokenizer tokenizer = new StringTokenizer(strKeyStroke,
- MODIFIER_JOINER);
+ KeyEventUtils.MODIFIER_JOINER);
int modifiers = 0;
while (tokenizer.hasMoreElements()) {
String nextElement = (String) tokenizer.nextElement();
@@ -538,15 +508,15 @@
private static int decodeModifier(String modifier) {
if (modifier == null || modifier.length() == 0) {
return 0;
- } else if (modifier.equals(CTRL_MODIFIER)) {
+ } else if (modifier.equals(KeyEventUtils.CTRL_MODIFIER)) {
return InputEvent.CTRL_DOWN_MASK;
- } else if (modifier.equals(ALT_MODIFIER)) {
+ } else if (modifier.equals(KeyEventUtils.ALT_MODIFIER)) {
return InputEvent.ALT_DOWN_MASK;
- } else if (modifier.equals(ALT_GRAPH_MODIFIER)) {
+ } else if (modifier.equals(KeyEventUtils.ALT_GRAPH_MODIFIER)) {
return InputEvent.ALT_GRAPH_DOWN_MASK;
- } else if (modifier.equals(META_MODIFIER)) {
+ } else if (modifier.equals(KeyEventUtils.META_MODIFIER)) {
return InputEvent.META_DOWN_MASK;
- } else if (modifier.equals(SHIFT_MODIFIER)) {
+ } else if (modifier.equals(KeyEventUtils.SHIFT_MODIFIER)) {
return InputEvent.SHIFT_DOWN_MASK;
} else {
// it should never go here!
Modified: trunk/src_new/org/argouml/util/KeyEventUtils.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/util/KeyEventUtils.java?view=diff&rev=12887&p1=trunk/src_new/org/argouml/util/KeyEventUtils.java&p2=trunk/src_new/org/argouml/util/KeyEventUtils.java&r1=12886&r2=12887
==============================================================================
--- trunk/src_new/org/argouml/util/KeyEventUtils.java (original)
+++ trunk/src_new/org/argouml/util/KeyEventUtils.java 2007-06-21 08:40:29-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 2006 The Regents of the University of California. All
+// Copyright (c) 2006-2007 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
@@ -31,8 +31,6 @@
import javax.swing.KeyStroke;
-import org.argouml.ui.cmd.ShortcutMgr;
-
/**
* Utility class for KeyEvents
*
@@ -40,6 +38,32 @@
*/
public class KeyEventUtils {
+ /**
+ * The expression between modifier/modifier and between modifier/text
+ */
+ public static final String MODIFIER_JOINER = " + ";
+ /**
+ * The text for the shift modifier
+ */
+ public static final String SHIFT_MODIFIER = "SHIFT";
+ /**
+ * The text for the ctrl modifier
+ */
+ public static final String CTRL_MODIFIER = "CTRL";
+ /**
+ * The text for the meta modifier
+ */
+ public static final String META_MODIFIER = "META";
+ /**
+ * The text for the alt modifier
+ */
+ public static final String ALT_MODIFIER = "ALT";
+ /**
+ * The text for the alt-gr modifier
+ */
+ public static final String ALT_GRAPH_MODIFIER = "altGraph";
+
+
/**
* Returns whether the key in this event is an "action" key. This is a
* customization of KeyEvent#isActionKey()
@@ -179,24 +203,19 @@
StringBuffer buf = new StringBuffer();
if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
- buf.append(ShortcutMgr.SHIFT_MODIFIER).append(
- ShortcutMgr.MODIFIER_JOINER);
+ buf.append(SHIFT_MODIFIER).append(MODIFIER_JOINER);
}
if ((modifiers & InputEvent.CTRL_MASK) != 0) {
- buf.append(ShortcutMgr.CTRL_MODIFIER).append(
- ShortcutMgr.MODIFIER_JOINER);
+ buf.append(CTRL_MODIFIER).append(MODIFIER_JOINER);
}
if ((modifiers & InputEvent.META_MASK) != 0) {
- buf.append(ShortcutMgr.META_MODIFIER).append(
- ShortcutMgr.MODIFIER_JOINER);
+ buf.append(META_MODIFIER).append(MODIFIER_JOINER);
}
if ((modifiers & InputEvent.ALT_MASK) != 0) {
- buf.append(ShortcutMgr.ALT_MODIFIER).append(
- ShortcutMgr.MODIFIER_JOINER);
+ buf.append(ALT_MODIFIER).append(MODIFIER_JOINER);
}
if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
- buf.append(ShortcutMgr.ALT_GRAPH_MODIFIER).append(
- ShortcutMgr.MODIFIER_JOINER);
+ buf.append(ALT_GRAPH_MODIFIER).append(MODIFIER_JOINER);
}
return buf.toString();
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.