Example usage for org.eclipse.jface.bindings.keys.formatting KeyFormatterFactory getFormalKeyFormatter

List of usage examples for org.eclipse.jface.bindings.keys.formatting KeyFormatterFactory getFormalKeyFormatter

Introduction

In this page you can find the example usage for org.eclipse.jface.bindings.keys.formatting KeyFormatterFactory getFormalKeyFormatter.

Prototype

public static final IKeyFormatter getFormalKeyFormatter() 

Source Link

Document

Provides an instance of FormalKeyFormatter.

Usage

From source file:org.eclipse.rcptt.core.swt.internal.ui.DefaultKeyStrokeManagerExtension.java

License:Open Source License

@Override
public String formatKeyWithMeta(int mask, int keyCode, int meta) {
    if (meta == 0) {
        return KeyFormatterFactory.getFormalKeyFormatter().format(KeyStroke.getInstance(mask, keyCode));
    } else {//from   w ww  .  j a  va2  s.  com
        String strKey = getMeta(meta);
        if (!strKey.equals(""))
            strKey += "+";
        strKey += KeyFormatterFactory.getFormalKeyFormatter().format(keyCode);
        return strKey;
    }
}

From source file:org.eclipse.rcptt.core.swt.internal.ui.DefaultKeyStrokeManagerExtension.java

License:Open Source License

private static String formatKey(KeyStroke key) {
    return KeyFormatterFactory.getFormalKeyFormatter().format(key);
}

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

License:Open Source License

public static String formatKeyWithMeta(int mask, int keyCode, int meta) {
    if (meta == 0) {
        return KeyFormatterFactory.getFormalKeyFormatter().format(KeyStroke.getInstance(mask, keyCode));
    } else {/*from ww w. ja v  a 2 s.co m*/
        String strKey = getMeta(meta);
        if (!strKey.equals(""))
            strKey += "+";
        strKey += KeyFormatterFactory.getFormalKeyFormatter().format(keyCode);
        return strKey;
    }
}

From source file:org.eclipse.rcptt.tesla.ecl.internal.impl.commands.KeyStrokeUtil.java

License:Open Source License

public static String formatKey(KeyStroke key) {
    return KeyFormatterFactory.getFormalKeyFormatter().format(key);
}

From source file:org.eclipse.rcptt.tesla.ecl.internal.impl.commands.KeyStrokeUtil.java

License:Open Source License

public static String formatKeyWithMeta(int mask, int keyCode, int meta) {
    if (meta == 0) {
        return KeyFormatterFactory.getFormalKeyFormatter().format(KeyStroke.getInstance(mask, keyCode));
    } else {//from   w  w  w  .ja va  2 s .  co m
        String strKey = "";

        final int M1 = 1;
        final int M2 = 2;
        final int M3 = 4;
        final int M4 = 8;

        if ((meta & M1) != 0)
            strKey += "M1";
        if ((meta & M2) != 0) {
            if (!strKey.equals(""))
                strKey += "+";
            strKey += "M2";
        }
        if ((meta & M3) != 0) {
            if (!strKey.equals(""))
                strKey += "+";
            strKey += "M3";
        }
        if ((meta & M4) != 0) {
            if (!strKey.equals(""))
                strKey += "+";
            strKey += "M4";
        }
        if (!strKey.equals(""))
            strKey += "+";
        strKey += KeyFormatterFactory.getFormalKeyFormatter().format(keyCode);
        return strKey;
    }
}