Example usage for org.eclipse.jface.bindings.keys IKeyLookup CTRL_NAME

List of usage examples for org.eclipse.jface.bindings.keys IKeyLookup CTRL_NAME

Introduction

In this page you can find the example usage for org.eclipse.jface.bindings.keys IKeyLookup CTRL_NAME.

Prototype

String CTRL_NAME

To view the source code for org.eclipse.jface.bindings.keys IKeyLookup CTRL_NAME.

Click Source Link

Document

The formal name of the 'Ctrl' key.

Usage

From source file:org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils.java

License:Open Source License

/**
 * Maximize a table/*from w  w w .j ava2s  . co m*/
 *
 * @param tableBot
 *            the {@link SWTBotTable} table
 */
public static void maximizeTable(SWTBotTable tableBot) {
    try {
        tableBot.pressShortcut(KeyStroke.getInstance(IKeyLookup.CTRL_NAME + "+"), KeyStroke.getInstance("M"));
    } catch (ParseException e) {
        fail();
    }
}

From source file:org.eclipse.tracecompass.tmf.ui.swtbot.tests.table.CollapseEventsInTableTest.java

License:Open Source License

private static void maximizeTable(SWTBotTable tableBot) {
    try {/*ww w. j ava 2 s .  co  m*/
        tableBot.pressShortcut(KeyStroke.getInstance(IKeyLookup.CTRL_NAME + "+"), KeyStroke.getInstance("M"));
    } catch (ParseException e) {
        fail();
    }
}

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>.
 * //from w ww  .jav a 2 s .  co 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;
}