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


Java TriggerSequence.getTriggers方法代码示例

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


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

示例1: getHotKey

import org.eclipse.jface.bindings.TriggerSequence; //导入方法依赖的package包/类
public static KeyStroke getHotKey(String commondID) throws ParseException {
    IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
    if (bindingService != null) {
        TriggerSequence trigger = bindingService.getBestActiveBindingFor(commondID);
        if (trigger != null) {
            Trigger[] tiggers = trigger.getTriggers();
            if (tiggers.length > 0) {
                Trigger tigger = tiggers[0];
                if (tigger instanceof KeyStroke) {
                    return (KeyStroke) tigger;
                }
            }
        }
    }
    return KeyStroke.getInstance("Ctrl+Space");
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:17,代码来源:HotKeyUtil.java

示例2: getAccelerator

import org.eclipse.jface.bindings.TriggerSequence; //导入方法依赖的package包/类
/**
 * @see org.eclipse.jface.action.ExternalActionManager.ICallback#getAccelerator(String)
 */
public final Integer getAccelerator(final String commandId) {
	final TriggerSequence triggerSequence = bindingManager
			.getBestActiveBindingFor(commandId);
	if (triggerSequence != null) {
		final Trigger[] triggers = triggerSequence.getTriggers();
		if (triggers.length == 1) {
			final Trigger trigger = triggers[0];
			if (trigger instanceof KeyStroke) {
				final KeyStroke keyStroke = (KeyStroke) trigger;
				final int accelerator = SWTKeySupport
						.convertKeyStrokeToAccelerator(keyStroke);
				return new Integer(accelerator);
			}
		}
	}

	return null;
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:22,代码来源:ExternalActionManager.java

示例3: execute

import org.eclipse.jface.bindings.TriggerSequence; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {

	EmacsPlusConsole console = EmacsPlusConsole.getInstance();
	console.clear();
	console.activate();
	IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
	String id = (event.getCommand() != null ? event.getCommand().getId() : null);
	if (id != null) {
		try {
			TriggerSequence trigger = bindingService.getBestActiveBindingFor(event.getCommand().getId());
			Trigger[] trigs = trigger.getTriggers();
			KeyStroke key = (KeyStroke)trigs[0];
			Collection<Binding> partials = EmacsPlusUtils.getPartialMatches(bindingService,KeySequence.getInstance(key)).values();

			for (Binding bind : partials) {
				ParameterizedCommand cmd = bind.getParameterizedCommand();
				if (cmd.getId().startsWith(EmacsPlusUtils.MULGASOFT)) {
					console.printBold(bind.getTriggerSequence().toString());
					console.print(SWT.TAB + cmd.getCommand().getName());
					String desc =  cmd.getCommand().getDescription();
					if (desc != null) {
						desc = desc.replaceAll(CR, EMPTY_STR);
						console.print(" - " + desc + CR);	//$NON-NLS-1$ 
					} else {
						console.print(CR);
					}
				}
			}
		} catch (Exception e) {}
		console.setFocus(true);
	}
	return null;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:35,代码来源:EmacsHelpHandler.java

示例4: getKeyStrokeForCommand

import org.eclipse.jface.bindings.TriggerSequence; //导入方法依赖的package包/类
/**
 * Gets the KeyStroke that triggers the command with the
 * given id, if any.
 * @param id The id of the command.
 * @return The KeyStroke that triggers the command with the
 * given id.
 */
private static KeyStroke getKeyStrokeForCommand(String id) {
	IBindingService bindingService = (IBindingService)PlatformUI.getWorkbench().getAdapter(IBindingService.class);
	TriggerSequence seq = bindingService.getBestActiveBindingFor(id);
	if (seq.getTriggers().length == 1 && seq.getTriggers()[0] instanceof KeyStroke)
		return (KeyStroke)seq.getTriggers()[0];
	else
		return null;
}
 
开发者ID:jgalenson,项目名称:codehint,代码行数:16,代码来源:SynthesisDialog.java


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