Example usage for org.eclipse.jface.bindings.keys KeyStroke toString

List of usage examples for org.eclipse.jface.bindings.keys KeyStroke toString

Introduction

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

Prototype

@Override
public final String toString() 

Source Link

Document

Returns the formal string representation for this key stroke.

Usage

From source file:org.eclipse.rcptt.ecl.platform.internal.ui.commands.GetCommandHotkeyService.java

License:Open Source License

public IStatus service(Command command, IProcess context) throws InterruptedException, CoreException {
    if (!(command instanceof GetHotkey)) {
        return Status.CANCEL_STATUS;
    }//from   w  w w.  j a  va  2 s  .c om
    GetHotkey getCommand = (GetHotkey) command;
    IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench()
            .getService(IBindingService.class);
    for (TriggerSequence binding : bindingService.getActiveBindingsFor(getCommand.getCommandId())) {
        for (Trigger trigger : binding.getTriggers()) {
            if (!(trigger instanceof KeyStroke)) {
                continue;
            }
            KeyStroke keyStroke = (KeyStroke) trigger;
            // context.getOutput().write(formatKeyWithMeta(0,
            // keyStroke.getNaturalKey(), keyStroke.getModifierKeys()));
            context.getOutput().write(keyStroke.toString());
            return Status.OK_STATUS;
        }
    }
    return new Status(IStatus.ERROR, PlatformUIPlugin.PLUGIN_ID,
            "No keyboard hotkey is defined for " + getCommand.getCommandId() + " in current context");
}

From source file:org.eclipse.rcptt.tesla.recording.core.swt.rap.SWTEventRecorder.java

License:Open Source License

public void addToPressed(Event event) {
    KeyStroke strk = KeyStroke.getInstance(event.stateMask, event.keyCode);
    String split = strk.toString().toLowerCase();
    String[] values = split.split("\\+");
    for (String val : values) {
        if (!pressed.contains(val))
            pressed.add(val);
    }/*from w  ww  .j  a v  a 2 s .com*/
}

From source file:org.eclipse.rcptt.tesla.recording.jface.text.WorkbenchTexteditorRecordingProcessor.java

License:Open Source License

private void addToPressed(Event event) {
    KeyStroke strk = KeyStroke.getInstance(event.stateMask, event.keyCode);
    String split = strk.toString().toLowerCase();
    String[] values = split.split("\\+");
    for (String val : values) {
        if (!pressed.contains(val))
            pressed.add(val);
    }/*  w  w w . j  ava  2 s  . c  om*/
}

From source file:org.eclipse.wb.internal.swt.model.property.editor.AcceleratorPropertyEditor.java

License:Open Source License

/**
 * @return the textual presentation of given accelerator.
 *//*from   ww  w.j av  a 2s  .  c om*/
private static String getText(int accelerator) {
    KeyStroke keyStroke = SWTKeySupport.convertAcceleratorToKeyStroke(accelerator);
    return keyStroke.toString();
}