本文整理汇总了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;
}
示例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;
}
示例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);
}