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


Java IBindingService.getPerfectMatch方法代码示例

本文整理汇总了Java中org.eclipse.ui.keys.IBindingService.getPerfectMatch方法的典型用法代码示例。如果您正苦于以下问题:Java IBindingService.getPerfectMatch方法的具体用法?Java IBindingService.getPerfectMatch怎么用?Java IBindingService.getPerfectMatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.ui.keys.IBindingService的用法示例。


在下文中一共展示了IBindingService.getPerfectMatch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBinding

import org.eclipse.ui.keys.IBindingService; //导入方法依赖的package包/类
/**
 * Return the exact binding if it exists and is enabled, else null
 * 
 * @param editor
 * @param keyCode
 * @param mode
 * @return binding if it exists and is enabled, else null
 */
private Binding getBinding(ITextEditor editor, char keyCode, int mode) {

	Binding result = null;
	// ensure key is upper case
	IBindingService bindingService = (IBindingService) editor.getSite().getService(IBindingService.class);
	KeyStroke key = KeyStroke.getInstance(mode, Character.toUpperCase(keyCode));
	result = bindingService.getPerfectMatch(KeySequence.getInstance(key));
	if (result != null && !result.getParameterizedCommand().getCommand().isEnabled()) {
		result = null;
	}
	return result;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:21,代码来源:IndentForTabHandler.java

示例2: checkKeyCode

import org.eclipse.ui.keys.IBindingService; //导入方法依赖的package包/类
/**
 * Dynamically determine the bindings for forward and reverse i-search
 * For repeat search, Emacs treats i-search and i-search-regexp identically
 * 
 * @param event
 * @return the FORWARD, REVERSE, or the source keyCode
 */
private int checkKeyCode(VerifyEvent event) {
	int result = event.keyCode;
	Integer val = keyHash.get(Integer.valueOf(event.keyCode + event.stateMask));
	if (val == null) { 
		KeyStroke keyst = KeyStroke.getInstance(event.stateMask, Character.toUpperCase(result));
		IBindingService bindingService = getBindingService();
		Binding binding = bindingService.getPerfectMatch(KeySequence.getInstance(keyst));
		if (binding != null) {
			if (ISF.equals(binding.getParameterizedCommand().getId())){
				result = FORWARD;
				keyHash.put(Integer.valueOf(event.keyCode + event.stateMask),Integer.valueOf(FORWARD));
			} else if (ISB.equals(binding.getParameterizedCommand().getId())) {
				result = REVERSE;
				keyHash.put(Integer.valueOf(event.keyCode + event.stateMask),Integer.valueOf(REVERSE));
			} else if (ISRF.equals(binding.getParameterizedCommand().getId())) {
				result = FORWARD;
				keyHash.put(Integer.valueOf(event.keyCode + event.stateMask),Integer.valueOf(FORWARD));
			} else if (ISRB.equals(binding.getParameterizedCommand().getId())) {
				result = REVERSE;
				keyHash.put(Integer.valueOf(event.keyCode + event.stateMask),Integer.valueOf(REVERSE));
			} 
		}
	} else {
		result = val;
	}
	return result;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:35,代码来源:ISearchMinibuffer.java

示例3: checkForBinding

import org.eclipse.ui.keys.IBindingService; //导入方法依赖的package包/类
/**
 * Check for perfect binding match to key sequence
 * 
 * @param editor
 * @param sequence
 * @return Binding if perfect match found, else null
 */
protected Binding checkForBinding(ITextEditor editor, KeySequence sequence) {
	IBindingService service = (editor != null) ? (IBindingService) editor.getSite().getService(IBindingService.class) :
		(IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
	return service.getPerfectMatch(sequence);
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:13,代码来源:KbdMacroDefineHandler.java


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