List of usage examples for org.eclipse.jface.bindings.keys IKeyLookup COMMAND_NAME
String COMMAND_NAME
To view the source code for org.eclipse.jface.bindings.keys IKeyLookup COMMAND_NAME.
Click Source Link
From source file:org.eclipse.tracecompass.tmf.remote.ui.swtbot.tests.fetch.FetchRemoteTracesTest.java
License:Open Source License
private static void openRemoteProfilePreferences() { if (SWTUtils.isMac()) { // On Mac, the Preferences menu item is under the application name. // For some reason, we can't access the application menu anymore so // we use the keyboard shortcut. try {/* w w w . ja v a 2 s. com*/ fBot.activeShell().pressShortcut(KeyStroke.getInstance(IKeyLookup.COMMAND_NAME + "+"), KeyStroke.getInstance(",")); } catch (ParseException e) { fail(); } } else { fBot.menu("Window").menu("Preferences").click(); } fBot.waitUntil(Conditions.shellIsActive("Preferences")); // The first tree is the preference "categories" on the left side SWTBotTree tree = fBot.tree(0); SWTBotTreeItem treeNode = tree.getTreeItem("Tracing"); treeNode.select(); treeNode.expand(); fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable("Remote Profiles", treeNode)); treeNode = treeNode.getNode("Remote Profiles"); treeNode.select(); }
From source file:org.eclipse.ui.internal.keys.BindingPersistence.java
License:Open Source License
/** * Parses a single 2.1.x key stroke string, as provided by * <code>parse2_1Sequence</code>. * // w w w .jav a 2 s. c o m * @param string * The string to parse; must not be <code>null</code>. * @return An single integer value representing this key stroke. */ private static final int parse2_1Stroke(final String string) { final StringTokenizer stringTokenizer = new StringTokenizer(string, KeyStroke.KEY_DELIMITER, true); // Copy out the tokens so we have random access. final int size = stringTokenizer.countTokens(); final String[] tokens = new String[size]; for (int i = 0; stringTokenizer.hasMoreTokens(); i++) { tokens[i] = stringTokenizer.nextToken(); } int value = 0; if (size % 2 == 1) { String token = tokens[size - 1]; final Integer integer = (Integer) r2_1KeysByName.get(token.toUpperCase()); if (integer != null) { value = integer.intValue(); } else if (token.length() == 1) { value = token.toUpperCase().charAt(0); } if (value != 0) { for (int i = 0; i < size - 1; i++) { token = tokens[i]; if (i % 2 == 0) { if (token.equalsIgnoreCase(IKeyLookup.CTRL_NAME)) { if ((value & SWT.CTRL) != 0) { return 0; } value |= SWT.CTRL; } else if (token.equalsIgnoreCase(IKeyLookup.ALT_NAME)) { if ((value & SWT.ALT) != 0) { return 0; } value |= SWT.ALT; } else if (token.equalsIgnoreCase(IKeyLookup.SHIFT_NAME)) { if ((value & SWT.SHIFT) != 0) { return 0; } value |= SWT.SHIFT; } else if (token.equalsIgnoreCase(IKeyLookup.COMMAND_NAME)) { if ((value & SWT.COMMAND) != 0) { return 0; } value |= SWT.COMMAND; } else { return 0; } } else if (!KeyStroke.KEY_DELIMITER.equals(token)) { return 0; } } } } return value; }