本文整理汇总了Java中org.eclipse.jface.bindings.keys.IKeyLookup.getCommand方法的典型用法代码示例。如果您正苦于以下问题:Java IKeyLookup.getCommand方法的具体用法?Java IKeyLookup.getCommand怎么用?Java IKeyLookup.getCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.bindings.keys.IKeyLookup
的用法示例。
在下文中一共展示了IKeyLookup.getCommand方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例5: 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;
}