本文整理汇总了Java中org.eclipse.jface.bindings.keys.IKeyLookup类的典型用法代码示例。如果您正苦于以下问题:Java IKeyLookup类的具体用法?Java IKeyLookup怎么用?Java IKeyLookup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IKeyLookup类属于org.eclipse.jface.bindings.keys包,在下文中一共展示了IKeyLookup类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sortModifierKeys
import org.eclipse.jface.bindings.keys.IKeyLookup; //导入依赖的package包/类
protected int[] sortModifierKeys(int modifierKeys) {
final IKeyLookup lookup = KeyLookupFactory.getDefault();
final int[] sortedKeys = new int[4];
int index = 0;
if ((modifierKeys & lookup.getAlt()) != 0) {
sortedKeys[index++] = lookup.getAlt();
}
if ((modifierKeys & lookup.getCommand()) != 0) {
sortedKeys[index++] = lookup.getCommand();
}
if ((modifierKeys & lookup.getCtrl()) != 0) {
sortedKeys[index++] = lookup.getCtrl();
}
if ((modifierKeys & lookup.getShift()) != 0) {
sortedKeys[index++] = lookup.getShift();
}
return sortedKeys;
}
示例2: sortModifierKeys
import org.eclipse.jface.bindings.keys.IKeyLookup; //导入依赖的package包/类
protected int[] sortModifierKeys(final int modifierKeys) {
final IKeyLookup lookup = KeyLookupFactory.getDefault();
final int[] sortedKeys = new int[4];
int index = 0;
if ((modifierKeys & lookup.getAlt()) != 0) {
sortedKeys[index++] = lookup.getAlt();
}
if ((modifierKeys & lookup.getCommand()) != 0) {
sortedKeys[index++] = lookup.getCommand();
}
if ((modifierKeys & lookup.getCtrl()) != 0) {
sortedKeys[index++] = lookup.getCtrl();
}
if ((modifierKeys & lookup.getShift()) != 0) {
sortedKeys[index++] = lookup.getShift();
}
return sortedKeys;
}
示例3: countStrokes
import org.eclipse.jface.bindings.keys.IKeyLookup; //导入依赖的package包/类
/**
* Returns the number of strokes in an array of triggers. It is assumed that
* there is one natural key per trigger. The strokes are counted based on
* the type of key. Natural keys are worth one; ctrl is worth two; shift is
* worth four; and alt is worth eight.
*
* @param triggers
* The triggers on which to count strokes; must not be
* <code>null</code>.
* @return The value of the strokes in the triggers.
* @since 3.2
*/
private final int countStrokes(final Trigger[] triggers) {
int strokeCount = triggers.length;
for (int i = 0; i < triggers.length; i++) {
final Trigger trigger = triggers[i];
if (trigger instanceof KeyStroke) {
final KeyStroke keyStroke = (KeyStroke) trigger;
final int modifierKeys = keyStroke.getModifierKeys();
final IKeyLookup lookup = KeyLookupFactory.getDefault();
if ((modifierKeys & lookup.getAlt()) != 0) {
strokeCount += 8;
}
if ((modifierKeys & lookup.getCtrl()) != 0) {
strokeCount += 2;
}
if ((modifierKeys & lookup.getShift()) != 0) {
strokeCount += 4;
}
if ((modifierKeys & lookup.getCommand()) != 0) {
strokeCount += 2;
}
} else {
strokeCount += 99;
}
}
return strokeCount;
}
示例4: format
import org.eclipse.jface.bindings.keys.IKeyLookup; //导入依赖的package包/类
/**
* Formats an individual key into a human readable format. This converts the
* key into a format similar to Xemacs.
*
* @param key
* The key to format; must not be <code>null</code>.
* @return The key formatted as a string; should not be <code>null</code>.
*/
public String format(final int key) {
final IKeyLookup lookup = KeyLookupFactory.getDefault();
if (lookup.isModifierKey(key)) {
// String formattedName = Util.translateString(RESOURCE_BUNDLE,
// lookup
// .formalNameLookup(key), null);
// if (formattedName != null) {
// return formattedName;
// }
}
return super.format(key).toLowerCase();
}
示例5: format
import org.eclipse.jface.bindings.keys.IKeyLookup; //导入依赖的package包/类
/**
* Formats an individual key into a human readable format. This uses an
* internationalization resource bundle to look up the key. This does the
* platform-specific formatting for Carbon.
*
* @param key
* The key to format.
* @return The key formatted as a string; should not be <code>null</code>.
*/
public final String format(final int key) {
final IKeyLookup lookup = KeyLookupFactory.getDefault();
final String name = lookup.formalNameLookup(key);
// TODO consider platform-specific resource bundles
if (Util.isMac()) {
String formattedName = (String) CARBON_KEY_LOOK_UP.get(name);
if (formattedName != null) {
return formattedName;
}
}
return super.format(key);
}
示例6: format
import org.eclipse.jface.bindings.keys.IKeyLookup; //导入依赖的package包/类
public String format(final int key) {
final IKeyLookup lookup = KeyLookupFactory.getDefault();
final String name = lookup.formalNameLookup(key);
if (resourceBundleKeys.contains(name)) {
// return Util.translateString(RESOURCE_BUNDLE, name, name);
}
return name;
}
示例7: getEnterBinding
import org.eclipse.jface.bindings.keys.IKeyLookup; //导入依赖的package包/类
private static String getEnterBinding() {
return KeyStroke.getInstance(KeyLookupFactory.getDefault().formalKeyLookup(IKeyLookup.CR_NAME)).format();
}
示例8: shouldSkipNext
import org.eclipse.jface.bindings.keys.IKeyLookup; //导入依赖的package包/类
private boolean shouldSkipNext(int keyCode) {
IKeyLookup lookUp = KeyLookupFactory.getDefault();
return lookUp.getCommand() == keyCode || lookUp.getCtrl() == keyCode;
}
示例9: getEnterBinding
import org.eclipse.jface.bindings.keys.IKeyLookup; //导入依赖的package包/类
protected static String getEnterBinding() {
return KeyStroke.getInstance(KeyLookupFactory.getDefault().formalKeyLookup(IKeyLookup.CR_NAME)).format();
}
示例10: sortModifierKeys
import org.eclipse.jface.bindings.keys.IKeyLookup; //导入依赖的package包/类
protected int[] sortModifierKeys(final int modifierKeys) {
final IKeyLookup lookup = KeyLookupFactory.getDefault();
final int[] sortedKeys = new int[4];
int index = 0;
if (Util.isWindows()) {
if ((modifierKeys & lookup.getCtrl()) != 0) {
sortedKeys[index++] = lookup.getCtrl();
}
if ((modifierKeys & lookup.getAlt()) != 0) {
sortedKeys[index++] = lookup.getAlt();
}
if ((modifierKeys & lookup.getShift()) != 0) {
sortedKeys[index++] = lookup.getShift();
}
} else if (Util.isGtk() || Util.isMotif()) {
if ((modifierKeys & lookup.getShift()) != 0) {
sortedKeys[index++] = lookup.getShift();
}
if ((modifierKeys & lookup.getCtrl()) != 0) {
sortedKeys[index++] = lookup.getCtrl();
}
if ((modifierKeys & lookup.getAlt()) != 0) {
sortedKeys[index++] = lookup.getAlt();
}
} else if (Util.isMac()) {
if ((modifierKeys & lookup.getShift()) != 0) {
sortedKeys[index++] = lookup.getShift();
}
if ((modifierKeys & lookup.getCtrl()) != 0) {
sortedKeys[index++] = lookup.getCtrl();
}
if ((modifierKeys & lookup.getAlt()) != 0) {
sortedKeys[index++] = lookup.getAlt();
}
if ((modifierKeys & lookup.getCommand()) != 0) {
sortedKeys[index++] = lookup.getCommand();
}
}
return sortedKeys;
}
示例11: format
import org.eclipse.jface.bindings.keys.IKeyLookup; //导入依赖的package包/类
public String format(final int key) {
final IKeyLookup lookup = KeyLookupFactory.getDefault();
return lookup.formalNameLookup(key);
}