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


Java IBindingService.getBestActiveBindingFor方法代码示例

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


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

示例1: getHotKey

import org.eclipse.ui.keys.IBindingService; //导入方法依赖的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: QuickOutline

import org.eclipse.ui.keys.IBindingService; //导入方法依赖的package包/类
public QuickOutline(Shell parent, JsonEditor editor, String fileContentType) {
      super(parent, PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE, true, true, true, true, true, null, null);
this.fileContentType = fileContentType;

      IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class);
      this.bindingKey = bindingService.getBestActiveBindingFormattedFor(COMMAND_ID);
      this.triggerSequence = bindingService.getBestActiveBindingFor(COMMAND_ID);
      this.editor = editor;

      setInfoText(statusMessage());
      create();
  }
 
开发者ID:RepreZen,项目名称:KaiZen-OpenAPI-Editor,代码行数:13,代码来源:QuickOutline.java

示例3: getIterationBinding

import org.eclipse.ui.keys.IBindingService; //导入方法依赖的package包/类
private KeySequence getIterationBinding() {
   final IBindingService bindingSvc= (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class);
TriggerSequence binding= bindingSvc.getBestActiveBindingFor(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
if (binding instanceof KeySequence)
	return (KeySequence) binding;
return null;
  }
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:ContentAssistProcessor.java

示例4: saveMacro

import org.eclipse.ui.keys.IBindingService; //导入方法依赖的package包/类
private void saveMacro(ITextEditor editor,String name, File file) {
	IBindingService service = (IBindingService) editor.getSite().getService(IBindingService.class);
	KbdMacro kbdMacro = KbdMacroSupport.getInstance().getKbdMacro(name);
	TriggerSequence sequence = service.getBestActiveBindingFor(EmacsPlusUtils.kbdMacroId(name));
	if (sequence != null && sequence instanceof KeySequence) {
		kbdMacro.setBindingKeys(((KeySequence)sequence).toString());
	}
	writeMacro(editor,file,kbdMacro);
	kbdMacro.setBindingKeys(null);
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:11,代码来源:KbdMacroSaveHandler.java

示例5: execute

import org.eclipse.ui.keys.IBindingService; //导入方法依赖的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

示例6: getBestBinding

import org.eclipse.ui.keys.IBindingService; //导入方法依赖的package包/类
/**
 * Get the best binding (as determined by Eclipse) for the Command
 * 
 * @param cmd
 * @return the binding or null
 */
public static String getBestBinding(Command cmd) {
	String result = null;
	IBindingService binder = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
	TriggerSequence bindingFor = binder.getBestActiveBindingFor(cmd.getId());
	if (bindingFor != null) {
		result = bindingFor.format(); 
	}
	return result;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:16,代码来源:CommandHelp.java

示例7: getCommandKeyBinding

import org.eclipse.ui.keys.IBindingService; //导入方法依赖的package包/类
/**
 * @param commandId the command we want to know about
 * @return the 'best' key sequence that will activate the given command
 */
public static KeySequence getCommandKeyBinding(String commandId) {
    Assert.isNotNull(commandId);
    IBindingService bindingSvc;
    try {
        bindingSvc = PlatformUI.getWorkbench()
                .getAdapter(IBindingService.class);
    } catch (IllegalStateException e) {
        return null;
    }

    TriggerSequence keyBinding = bindingSvc.getBestActiveBindingFor(commandId);
    if (keyBinding instanceof KeySequence) {
        return (KeySequence) keyBinding;
    }

    List<Tuple<Binding, ParameterizedCommand>> matches = new ArrayList<Tuple<Binding, ParameterizedCommand>>();
    //Ok, it may be that the binding we're looking for is not active, so, let's give a spin on all
    //the bindings
    Binding[] bindings = bindingSvc.getBindings();
    for (Binding binding : bindings) {
        ParameterizedCommand command = binding.getParameterizedCommand();
        if (command != null) {
            if (commandId.equals(command.getId())) {
                matches.add(new Tuple<Binding, ParameterizedCommand>(binding, command));
            }
        }
    }
    for (Tuple<Binding, ParameterizedCommand> tuple : matches) {
        if (tuple.o1.getTriggerSequence() instanceof KeySequence) {
            KeySequence keySequence = (KeySequence) tuple.o1.getTriggerSequence();
            return keySequence;
        }
    }

    return null;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:41,代码来源:KeyBindingHelper.java

示例8: getGroupingIterationBinding

import org.eclipse.ui.keys.IBindingService; //导入方法依赖的package包/类
protected KeySequence getGroupingIterationBinding() {
IBindingService bindingSvc = (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class);
TriggerSequence binding = bindingSvc.getBestActiveBindingFor(
	ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
if(binding instanceof KeySequence)
	return (KeySequence) binding;
return null;
  }
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:9,代码来源:LangContentAssistProcessor.java

示例9: getKeyStrokeForCommand

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