本文整理汇总了Java中org.eclipse.jface.bindings.keys.KeySequence.getKeyStrokes方法的典型用法代码示例。如果您正苦于以下问题:Java KeySequence.getKeyStrokes方法的具体用法?Java KeySequence.getKeyStrokes怎么用?Java KeySequence.getKeyStrokes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.bindings.keys.KeySequence
的用法示例。
在下文中一共展示了KeySequence.getKeyStrokes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: internalMatchesKeybinding
import org.eclipse.jface.bindings.keys.KeySequence; //导入方法依赖的package包/类
private static boolean internalMatchesKeybinding(int keyCode, int stateMask, TriggerSequence seq)
{
KeySequence keySequence = (KeySequence) seq;
KeyStroke[] keyStrokes = keySequence.getKeyStrokes();
if (keyStrokes.length > 1)
{
return false; // Only handling one step binding... the code below does not support things as "CTRL+X R" for
// redo.
}
for (KeyStroke keyStroke : keyStrokes)
{
if (keyStroke.getNaturalKey() == keyCode && keyStroke.getModifierKeys() == stateMask)
{
return true;
}
}
return false;
}
示例2: format
import org.eclipse.jface.bindings.keys.KeySequence; //导入方法依赖的package包/类
public String format(KeySequence keySequence) {
StringBuffer stringBuffer = new StringBuffer();
final KeyStroke[] keyStrokes = keySequence.getKeyStrokes();
final int keyStrokesLength = keyStrokes.length;
for (int i = 0; i < keyStrokesLength; i++) {
stringBuffer.append(format(keyStrokes[i]));
if (i + 1 < keyStrokesLength) {
stringBuffer.append(getKeyStrokeDelimiter());
}
}
return stringBuffer.toString();
}
示例3: matchesKeybinding
import org.eclipse.jface.bindings.keys.KeySequence; //导入方法依赖的package包/类
public static boolean matchesKeybinding(int keyCode, int stateMask, KeySequence keySequence) {
KeyStroke[] keyStrokes = keySequence.getKeyStrokes();
for (KeyStroke keyStroke : keyStrokes) {
if (keyStroke.getNaturalKey() == keyCode
&& ((keyStroke.getModifierKeys() & stateMask) != 0 || keyStroke.getModifierKeys() == stateMask)) {
return true;
}
}
return false;
}
示例4: getKeyCode
import org.eclipse.jface.bindings.keys.KeySequence; //导入方法依赖的package包/类
private int getKeyCode(final KeySequence inSequence) {
int out = 0;
for (final KeyStroke lStroke : inSequence.getKeyStrokes()) {
out |= lStroke.getModifierKeys() | lStroke.getNaturalKey();
}
return out;
}
示例5: getKeyCode
import org.eclipse.jface.bindings.keys.KeySequence; //导入方法依赖的package包/类
private int getKeyCode(final KeySequence inSequence) {
int out = 0;
if (inSequence == null) {
return out;
}
for (final KeyStroke lStroke : inSequence.getKeyStrokes()) {
out |= lStroke.getModifierKeys() | lStroke.getNaturalKey();
}
return out;
}
示例6: loadbindings
import org.eclipse.jface.bindings.keys.KeySequence; //导入方法依赖的package包/类
private void loadbindings()
{
resetState();
// Collect unique key sequences
uniqueKeySequences.clear();
uniqueKeySequencesPrefixes.clear();
// Filter to commands with bindings
IModelFilter filter = new IModelFilter()
{
public boolean include(AbstractElement element)
{
boolean result = false;
if (element instanceof CommandElement)
{
CommandElement node = (CommandElement) element;
String[] bindings = node.getKeyBindings();
result = (bindings != null && bindings.length > 0);
}
return result;
}
};
// Get all commands with bindings
List<CommandElement> commands = bundleManager.getExecutableCommands(filter);
for (CommandElement commandElement : commands)
{
// Get key sequences
KeySequence[] keySequences = KeyBindingUtil.getKeySequences(commandElement);
if (keySequences != null && keySequences.length > 0)
{
// Add to the set
for (KeySequence keySequence : keySequences)
{
boolean added = uniqueKeySequences.add(keySequence);
if (added && keySequence.getKeyStrokes().length > 1)
{
// Collect prefixes - used to determine prefix matching of key sequences
TriggerSequence[] prefixes = keySequence.getPrefixes();
for (TriggerSequence triggerSequence : prefixes)
{
KeySequence prefixKeySequence = (KeySequence) triggerSequence;
if (prefixKeySequence.getKeyStrokes().length > 0)
{
uniqueKeySequencesPrefixes.add(prefixKeySequence);
}
}
}
}
}
}
}