Example usage for org.eclipse.jface.bindings.keys SWTKeySupport convertKeyStrokeToAccelerator

List of usage examples for org.eclipse.jface.bindings.keys SWTKeySupport convertKeyStrokeToAccelerator

Introduction

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

Prototype

public static final int convertKeyStrokeToAccelerator(final KeyStroke keyStroke) 

Source Link

Document

Given a key stroke, this method provides the equivalent SWT accelerator value.

Usage

From source file:org.eclipse.tm.internal.terminal.emulator.EditActionAccelerators.java

License:Open Source License

private void addAccelerator(String commandId) {
    TriggerSequence[] bindings = bindingsFor(commandId);
    for (int i = 0; i < bindings.length; ++i) {
        if (bindings[i] instanceof KeySequence) {
            KeyStroke[] keyStrokes = ((KeySequence) bindings[i]).getKeyStrokes();
            if (keyStrokes.length != 0) {
                int accelerator = SWTKeySupport.convertKeyStrokeToAccelerator(keyStrokes[0]);
                commandIdsByAccelerator.put(new Integer(accelerator), commandId);
            }//from  ww w. j  av a 2s .  c  o  m
        }
    }
}