static {
/**
- * @j2sNative
+ * @ could do it this way:
*
- * J2S.thisApplet.__Info.args =
- * ["open","examples/uniref50.fa","features",
- * "examples/exampleFeatures.txt"];
+ * j2sNative
+ *
+ * J2S.thisApplet.__Info.args = [ "open","examples/uniref50.fa",
+ * "features","examples/exampleFeatures.txt", "noannotation" ];
*/
}
public static void main(String[] args) throws Exception
{
+ if (args.length == 0)
+ {
+ args = new String[] {
+ // "headless",
+ "open", "examples/uniref50.fa",
+ "features",
+ "examples/exampleFeatures.txt"
+ , "noannotation"
+ , "showoverview"
+ // , "png", "test-bh.png"
+ };
+ }
+
+ // String cmds = "nodisplay -open examples/uniref50.fa -sortbytree -props
+ // test/jalview/io/testProps.jvprops -colour zappo "
+ // + "-jabaws http://www.compbio.dundee.ac.uk/jabaws -nosortbytree "
+ // + "-features examples/testdata/plantfdx.features -annotations
+ // examples/testdata/plantfdx.annotations -tree
+ // examples/testdata/uniref50_test_tree";
+ // args = cmds.split(" ");
Jalview.main(args);
//showFocusTimer();
}
KeyStroke ctrlWKey = KeyStroke.getKeyStroke(KeyEvent.VK_W,
InputEvent.CTRL_DOWN_MASK);
KeyStroke cmdWKey = KeyStroke.getKeyStroke(KeyEvent.VK_W,
- ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx());
+ Platform.SHORTCUT_KEY_MASK);
InputMap inputMap = frame
.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
{
getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
.put(KeyStroke.getKeyStroke(KeyEvent.VK_Q,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx()),
+ Platform.SHORTCUT_KEY_MASK),
"Quit");
getRootPane().getActionMap().put("Quit", new AbstractAction()
{
* Ctrl-W / Cmd-W - close view or window
*/
KeyStroke key_cmdW = KeyStroke.getKeyStroke(KeyEvent.VK_W,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ Platform.SHORTCUT_KEY_MASK, false);
action = new AbstractAction()
{
@Override
* Ctrl-T / Cmd-T open new view
*/
KeyStroke key_cmdT = KeyStroke.getKeyStroke(KeyEvent.VK_T,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ Platform.SHORTCUT_KEY_MASK, false);
AbstractAction action = new AbstractAction()
{
@Override
* Ctrl-F / Cmd-F open Finder dialog, 'focused' on the right alignment
*/
KeyStroke key_cmdF = KeyStroke.getKeyStroke(KeyEvent.VK_F,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ Platform.SHORTCUT_KEY_MASK, false);
AbstractAction action = new AbstractAction()
{
@Override
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
+import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
};
// FIXME getDefaultToolkit throws an exception in Headless mode
- KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx()
- | jalview.util.ShortcutKeyMaskExWrapper.SHIFT_DOWN_MASK,
+ KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S, Platform.SHORTCUT_KEY_MASK | InputEvent.SHIFT_DOWN_MASK,
false);
addMenuActionAndAccelerator(keyStroke, saveAs, al);
closeMenuItem.setText(MessageManager.getString("action.close"));
- keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_W,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_W, Platform.SHORTCUT_KEY_MASK, false);
al = new ActionListener()
{
@Override
JMenuItem selectAllSequenceMenuItem = new JMenuItem(
MessageManager.getString("action.select_all"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_A,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ Platform.SHORTCUT_KEY_MASK, false);
al = new ActionListener()
{
@Override
JMenuItem invertSequenceMenuItem = new JMenuItem(
MessageManager.getString("action.invert_sequence_selection"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ Platform.SHORTCUT_KEY_MASK, false);
al = new ActionListener()
{
@Override
JMenuItem remove2LeftMenuItem = new JMenuItem(
MessageManager.getString("action.remove_left"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_L,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ Platform.SHORTCUT_KEY_MASK, false);
al = new ActionListener()
{
@Override
JMenuItem remove2RightMenuItem = new JMenuItem(
MessageManager.getString("action.remove_right"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_R,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ Platform.SHORTCUT_KEY_MASK, false);
al = new ActionListener()
{
@Override
JMenuItem removeGappedColumnMenuItem = new JMenuItem(
MessageManager.getString("action.remove_empty_columns"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ Platform.SHORTCUT_KEY_MASK, false);
al = new ActionListener()
{
@Override
JMenuItem removeAllGapsMenuItem = new JMenuItem(
MessageManager.getString("action.remove_all_gaps"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx()
- | jalview.util.ShortcutKeyMaskExWrapper.SHIFT_DOWN_MASK,
+ Platform.SHORTCUT_KEY_MASK
+ | InputEvent.SHIFT_DOWN_MASK,
false);
al = new ActionListener()
{
JMenuItem removeRedundancyMenuItem = new JMenuItem(
MessageManager.getString("action.remove_redundancy"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_D,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ Platform.SHORTCUT_KEY_MASK, false);
al = new ActionListener()
{
@Override
undoMenuItem.setEnabled(false);
undoMenuItem.setText(MessageManager.getString("action.undo"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Z,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ Platform.SHORTCUT_KEY_MASK, false);
al = new ActionListener()
{
@Override
redoMenuItem.setEnabled(false);
redoMenuItem.setText(MessageManager.getString("action.redo"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Y,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ Platform.SHORTCUT_KEY_MASK, false);
al = new ActionListener()
{
@Override
JMenuItem printMenuItem = new JMenuItem(
MessageManager.getString("action.print"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_P,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ Platform.SHORTCUT_KEY_MASK, false);
al = new ActionListener()
{
@Override
JMenuItem findMenuItem = new JMenuItem(
MessageManager.getString("action.find"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_F,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ Platform.SHORTCUT_KEY_MASK, false);
findMenuItem.setToolTipText(JvSwingUtils.wrapTooltip(true,
MessageManager.getString("label.find_tip")));
al = new ActionListener()
JMenuItem deleteGroups = new JMenuItem(
MessageManager.getString("action.undefine_groups"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_U,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ Platform.SHORTCUT_KEY_MASK, false);
al = new ActionListener()
{
@Override
JMenuItem createGroup = new JMenuItem(
MessageManager.getString("action.create_group"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ Platform.SHORTCUT_KEY_MASK, false);
al = new ActionListener()
{
@Override
JMenuItem unGroup = new JMenuItem(
MessageManager.getString("action.remove_group"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx()
- | jalview.util.ShortcutKeyMaskExWrapper.SHIFT_DOWN_MASK,
+ Platform.SHORTCUT_KEY_MASK
+ | InputEvent.SHIFT_DOWN_MASK,
false);
al = new ActionListener()
{
copy.setText(MessageManager.getString("action.copy"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_C,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ Platform.SHORTCUT_KEY_MASK, false);
al = new ActionListener()
{
cut.setText(MessageManager.getString("action.cut"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ Platform.SHORTCUT_KEY_MASK, false);
al = new ActionListener()
{
@Override
JMenuItem pasteNew = new JMenuItem(
MessageManager.getString("label.to_new_alignment"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx()
- | jalview.util.ShortcutKeyMaskExWrapper.SHIFT_DOWN_MASK,
+ Platform.SHORTCUT_KEY_MASK
+ | InputEvent.SHIFT_DOWN_MASK,
false);
al = new ActionListener()
{
JMenuItem pasteThis = new JMenuItem(
MessageManager.getString("label.to_this_alignment"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ Platform.SHORTCUT_KEY_MASK, false);
al = new ActionListener()
{
@Override
JMenuItem invertColSel = new JMenuItem(
MessageManager.getString("action.invert_column_selection"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx()
- | jalview.util.ShortcutKeyMaskExWrapper.ALT_DOWN_MASK,
+ Platform.SHORTCUT_KEY_MASK
+ | InputEvent.ALT_DOWN_MASK,
false);
al = new ActionListener()
{
JMenuItem save = new JMenuItem(MessageManager.getString("action.save"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ Platform.SHORTCUT_KEY_MASK, false);
al = new ActionListener()
{
@Override
JMenuItem newView = new JMenuItem(
MessageManager.getString("action.new_view"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_T,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false);
+ Platform.SHORTCUT_KEY_MASK, false);
al = new ActionListener()
{
@Override
import jalview.gui.JvSwingUtils;
import jalview.util.MessageManager;
+import jalview.util.Platform;
import java.awt.BorderLayout;
import java.awt.Font;
});
close.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
java.awt.event.KeyEvent.VK_W,
- jalview.util.ShortcutKeyMaskExWrapper
- .getMenuShortcutKeyMaskEx(),
+ Platform.SHORTCUT_KEY_MASK,
false));
selectAll.setText(MessageManager.getString("action.select_all"));
selectAll.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
java.awt.event.KeyEvent.VK_A,
- jalview.util.ShortcutKeyMaskExWrapper
- .getMenuShortcutKeyMaskEx(),
+ Platform.SHORTCUT_KEY_MASK,
false));
selectAll.addActionListener(new ActionListener()
{
save.setText(MessageManager.getString("action.save"));
save.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
java.awt.event.KeyEvent.VK_S,
- jalview.util.ShortcutKeyMaskExWrapper
- .getMenuShortcutKeyMaskEx(),
+ Platform.SHORTCUT_KEY_MASK,
false));
save.addActionListener(new ActionListener()
{
});
copyItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
java.awt.event.KeyEvent.VK_C,
- jalview.util.ShortcutKeyMaskExWrapper
- .getMenuShortcutKeyMaskEx(),
+ Platform.SHORTCUT_KEY_MASK,
false));
editMenubar.add(jMenu1);
import jalview.gui.JvSwingUtils;
import jalview.util.MessageManager;
+import jalview.util.Platform;
import java.awt.BorderLayout;
import java.awt.Font;
selectAll.setText(MessageManager.getString("action.select_all"));
selectAll.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
java.awt.event.KeyEvent.VK_A,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false));
+ Platform.SHORTCUT_KEY_MASK, false));
selectAll.addActionListener(new ActionListener()
{
@Override
save.setText(MessageManager.getString("action.save"));
save.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
java.awt.event.KeyEvent.VK_S,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false));
+ Platform.SHORTCUT_KEY_MASK, false));
save.addActionListener(new ActionListener()
{
@Override
});
copyItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
java.awt.event.KeyEvent.VK_C,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false));
+ Platform.SHORTCUT_KEY_MASK, false));
pasteMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
java.awt.event.KeyEvent.VK_V,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(), false));
+ Platform.SHORTCUT_KEY_MASK, false));
editMenubar.add(jMenu1);
editMenubar.add(editMenu);
textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 12));
.setText(MessageManager.getString("label.load_tree_from_file"));
inputLocalFileMenuItem.setAccelerator(
javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(),
+ Platform.SHORTCUT_KEY_MASK,
false));
inputLocalFileMenuItem
.addActionListener(new java.awt.event.ActionListener()
*/
package jalview.util;
-import jalview.javascript.json.JSON;
-
import java.awt.Component;
import java.awt.Dimension;
+import java.awt.GraphicsEnvironment;
import java.awt.Toolkit;
+import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
+import java.lang.reflect.Method;
import java.net.URL;
import java.util.Properties;
import java.util.logging.ConsoleHandler;
import com.stevesoft.pat.Regex;
+import jalview.javascript.json.JSON;
import swingjs.api.JSUtilI;
/**
*
* @author Jim Procter
*/
+
public class Platform
{
isWin = null;
private static Boolean isHeadless = null;
-
+
private static swingjs.api.JSUtilI jsutil;
+
- static {
- if (isJS) {
+ static
+ {
+ if (isJS)
+ {
try
{
jsutil = ((JSUtilI) Class.forName("swingjs.JSUtil").newInstance());
{
e.printStackTrace();
}
- }
+ }
}
// private static Boolean isHeadless = null;
: isMac);
}
+ public static int SHIFT_DOWN_MASK = KeyEvent.SHIFT_DOWN_MASK;
+
+ public static int ALT_DOWN_MASK = KeyEvent.ALT_DOWN_MASK;
+
+ public static int SHORTCUT_KEY_MASK = (Platform.isMac() ? KeyEvent.META_DOWN_MASK : KeyEvent.CTRL_DOWN_MASK);
+
+ static
+ {
+ if (!GraphicsEnvironment.isHeadless())
+ {
+ try
+ {
+
+ Class<? extends Toolkit> tk = Toolkit.getDefaultToolkit().getClass();
+ Method method = tk.getMethod("getMenuShortcutKeyMaskEx");
+ if (method == null)
+ method = tk.getMethod("getMenuShortcutKeyMask");
+ SHORTCUT_KEY_MASK = ((int) method.invoke(tk, new Object[0]));
+ if (SHORTCUT_KEY_MASK <= 0xF)
+ {
+ // shift this into the extended region (was Java 8)
+ SHORTCUT_KEY_MASK = SHORTCUT_KEY_MASK << 6;
+ }
+ } catch (Exception e)
+ {
+ }
+ }
+ }
+
/**
* added to group mouse events into Windows and nonWindows (mac, unix, linux)
*
return (isNoJSWin == null ? (isNoJSWin = !isJS && isWin()) : isNoJSWin);
}
- /**
- *
- * @return true if we are running in non-interactive no UI mode
- */
- public static boolean isHeadless()
- {
- if (isHeadless == null)
- {
- isHeadless = "true".equals(System.getProperty("java.awt.headless"));
- }
- return isHeadless;
- }
+ /**
+ *
+ * @return true if we are running in non-interactive no UI mode
+ */
+ public static boolean isHeadless()
+ {
+ if (isHeadless == null)
+ {
+ isHeadless = "true".equals(System.getProperty("java.awt.headless"));
+ }
+ return isHeadless;
+ }
/**
*
{
return s == null ? null : s.replace("\\", "\\\\");
}
-
+
/**
* Answers true if the mouse event has Meta-down (Command key on Mac) or
* Ctrl-down (on other o/s). Note this answers _false_ if the Ctrl key is
*/
protected static boolean isControlDown(MouseEvent e, boolean aMac)
{
- if (!aMac)
- {
- return e.isControlDown();
-
- // Jalview 2.11 code below: above is as amended for JalviewJS
- // /*
- // * answer false for right mouse button
- // */
- // if (e.isPopupTrigger())
- // {
- // return false;
- // }
- // return
- // (jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx() //
- // .getMenuShortcutKeyMaskEx()
- // & jalview.util.ShortcutKeyMaskExWrapper
- // .getModifiersEx(e)) != 0; // getModifiers()) != 0;
+
+ System.out.println(e.isPopupTrigger()
+ + " " + ((SHORTCUT_KEY_MASK & e.getModifiersEx()) != 0)
+ + " " + e.isControlDown());
+ return (aMac ? !e.isPopupTrigger()
+ && (SHORTCUT_KEY_MASK & e.getModifiersEx()) != 0
+ : e.isControlDown());
}
- // answer false for right mouse button
- // shortcut key will be META for a Mac
- return !e.isPopupTrigger()
- && (Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
- & e.getModifiers()) != 0;
- // could we use e.isMetaDown() here?
- }
// BH: I don't know about that previous method. Here is what SwingJS uses.
// Notice the distinction in mouse events. (BUTTON3_MASK == META)
}
}
-
public static void cacheFileData(File file)
{
if (isJS)
}
return null;
}
-
+
public static String getFileAsString(String url)
{
if (isJS && url != null)
return false;
}
-
public static void addJ2SBinaryType(String ext)
{
if (isJS)
jsutil.addBinaryFileType(ext);
}
}
-
+
/**
* Encode the URI using JavaScript encodeURIComponent
*
return (isJS ? (String) jsutil.getAppletAttribute("_uniqueId") : null);
}
-
/**
* Read the Info block for this applet.
*
public static Object parseJSON(String json) throws ParseException
{
- return (isJS() ? JSON.parse(json)
- : new JSONParser().parse(json));
+ return (isJS() ? JSON.parse(json) : new JSONParser().parse(json));
}
public static Object parseJSON(Reader r)
* @param is
* @param outFile
* @throws IOException
- * if the file cannot be created or there is a problem
- * reading the input stream.
+ * if the file cannot be created or there is a problem reading the
+ * input stream.
*/
public static void streamToFile(InputStream is, File outFile)
throws IOException
jsutil.addDirectDatabaseCall(domain);
System.out.println(
- "Platform adding known access-control-allow-origin * for domain "
- + domain);
+ "Platform adding known access-control-allow-origin * for domain "
+ + domain);
}
}
}
/**
- * A (case sensitive) file path comparator that ignores the difference between /
- * and \
+ * A (case sensitive) file path comparator that ignores the difference between
+ * / and \
*
* @param path1
* @param path2
return p1.equals(p2);
}
+ ///////////// JAL-3253 Applet additions //////////////
-
-///////////// JAL-3253 Applet additions //////////////
-
-
/**
* Retrieve the object's embedded size from a div's style on a page if
* embedded in SwingJS.
}
}
-
/**
* load a resource -- probably a core file -- if and only if a particular
* class has not been instantialized. We use a String here because if we used
return (isJS ? jsutil.getCodeBase() : null);
}
-
}
*/
package jalview.util;
-import java.awt.event.MouseEvent;
+import java.awt.GraphicsEnvironment;
+import java.awt.Toolkit;
+import java.awt.event.KeyEvent;
+import java.lang.reflect.Method;
public class ShortcutKeyMaskExWrapper
{
-
- private static final Float specversion;
-
- private static final float modern;
-
- public static final int SHIFT_DOWN_MASK;
-
- public static final int ALT_DOWN_MASK;
-
- private static final ShortcutKeyMaskExWrapperI wrapper;
-
- static
- {
- specversion = Platform.isJS() ? Float.valueOf(8)
- : Float.parseFloat(
- System.getProperty("java.specification.version"));
- modern = 11;
-
- if (specversion >= modern)
- {
- wrapper = new jalview.util.ShortcutKeyMaskExWrapper11();
- SHIFT_DOWN_MASK = jalview.util.ShortcutKeyMaskExWrapper11.SHIFT_DOWN_MASK;
- ALT_DOWN_MASK = jalview.util.ShortcutKeyMaskExWrapper11.ALT_DOWN_MASK;
- }
- else
- {
- wrapper = new jalview.util.ShortcutKeyMaskExWrapper8();
- SHIFT_DOWN_MASK = jalview.util.ShortcutKeyMaskExWrapper8.SHIFT_DOWN_MASK;
- ALT_DOWN_MASK = jalview.util.ShortcutKeyMaskExWrapper8.ALT_DOWN_MASK;
- }
- }
-
- public static int getMenuShortcutKeyMaskEx()
- {
- return wrapper.getMenuShortcutKeyMaskEx();
- }
-
- public static int getModifiersEx(MouseEvent e)
- {
- return wrapper.getModifiersEx(e);
- }
+//
+// public static int SHIFT_DOWN_MASK = KeyEvent.SHIFT_DOWN_MASK;
+//
+// public static int ALT_DOWN_MASK = KeyEvent.ALT_DOWN_MASK;
+//
+// public static int SHORTCUT_KEY_MASK = (Platform.isMac() ? KeyEvent.META_DOWN_MASK : KeyEvent.CTRL_DOWN_MASK);
+//
+// static
+// {
+// if (!GraphicsEnvironment.isHeadless())
+// {
+// try
+// {
+//
+// Class<? extends Toolkit> tk = Toolkit.getDefaultToolkit().getClass();
+// Method method = tk.getMethod("getMenuShortcutKeyMaskEx");
+// if (method == null)
+// method = tk.getMethod("getMenuShortcutKeyMask");
+// SHORTCUT_KEY_MASK = ((int) method.invoke(tk, new Object[0]));
+// if (SHORTCUT_KEY_MASK <= 0xF)
+// {
+// // shift this into the extended region (was Java 8)
+// SHORTCUT_KEY_MASK = SHORTCUT_KEY_MASK << 6;
+// }
+// } catch (Exception e)
+// {
+// }
+// }
+// }
+//
+// public static int getMenuShortcutKeyMaskEx()
+// {
+// return SHORTCUT_KEY_MASK;
+// }
}
public interface ShortcutKeyMaskExWrapperI
{
- public static int SHIFT_DOWN_MASK = 0;
-
- public static int ALT_DOWN_MASK = 0;
public int getMenuShortcutKeyMaskEx();