当前位置: 首页>>代码示例>>Java>>正文


Java KeySequence.getKeyStrokes方法代码示例

本文整理汇总了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;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:21,代码来源:KeyBindingHelper.java

示例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();
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:16,代码来源:AbstractKeyFormatter.java

示例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;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:14,代码来源:KeyBindingHelper.java

示例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;
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:8,代码来源:AbstractEditFormTest.java

示例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;
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:11,代码来源:AbstractEditForm.java

示例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);
						}
					}
				}
			}
		}
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:57,代码来源:KeybindingsManager.java


注:本文中的org.eclipse.jface.bindings.keys.KeySequence.getKeyStrokes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。