Search in sources :

Example 6 with IBindingService

use of org.eclipse.ui.keys.IBindingService in project translationstudio8 by heartsome.

the class KeyAssistHandler method execute.

public Object execute(ExecutionEvent event) throws ExecutionException {
    final IWorkbench workbench = PlatformUI.getWorkbench();
    IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class);
    BindingService service = (BindingService) bindingService;
    ArrayList<Binding> lstBinding = new ArrayList<Binding>(Arrays.asList(bindingService.getBindings()));
    List<String> lstRemove = Constants.lstRemove;
    Iterator<Binding> it = lstBinding.iterator();
    while (it.hasNext()) {
        Binding binding = it.next();
        ParameterizedCommand pCommand = binding.getParameterizedCommand();
        if (pCommand == null || lstRemove.contains(pCommand.getCommand().getId())) {
            it.remove();
        }
    }
    service.getKeyboard().openKeyAssistShell(lstBinding);
    return null;
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) Binding(org.eclipse.jface.bindings.Binding) IBindingService(org.eclipse.ui.keys.IBindingService) BindingService(org.eclipse.ui.internal.keys.BindingService) ArrayList(java.util.ArrayList) IBindingService(org.eclipse.ui.keys.IBindingService) ParameterizedCommand(org.eclipse.core.commands.ParameterizedCommand)

Example 7 with IBindingService

use of org.eclipse.ui.keys.IBindingService in project translationstudio8 by heartsome.

the class ShieldStartup method earlyStartup.

public void earlyStartup() {
    IWorkbench workbench = PlatformUI.getWorkbench();
    // 在工作台初始化后,移除平台默认的 scheme
    IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class);
    Scheme[] schemes = bindingService.getDefinedSchemes();
    for (int i = 0; i < schemes.length; i++) {
        String id = schemes[i].getId();
        if (id.equals(platformDefaultScheme) || id.equals(platformEmacsScheme)) {
            schemes[i].undefine();
        }
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) Scheme(org.eclipse.jface.bindings.Scheme) IBindingService(org.eclipse.ui.keys.IBindingService)

Example 8 with IBindingService

use of org.eclipse.ui.keys.IBindingService in project translationstudio8 by heartsome.

the class TmMatchEditDialog method close.

@Override
public boolean close() {
    IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
    bindingService.setKeyFilterEnabled(true);
    srcSegmentViewer.reset();
    tgtSegmentViewer.reset();
    return super.close();
}
Also used : IBindingService(org.eclipse.ui.keys.IBindingService)

Example 9 with IBindingService

use of org.eclipse.ui.keys.IBindingService in project KaiZen-OpenAPI-Editor by RepreZen.

the class JsonContentAssistProcessor method initTextMessages.

protected String[] initTextMessages() {
    IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class);
    String bindingKey = bindingService.getBestActiveBindingFormattedFor(EDIT_CONTENT_ASSIST);
    ContextType contextType = referenceProposalProvider.getContextTypes().get(getCurrentPath() != null ? getCurrentPath().toString() : "");
    String context = contextType != null ? contextType.label() : "";
    return new String[] { //
    String.format(Messages.content_assist_proposal_project, bindingKey, context), String.format(Messages.content_assist_proposal_workspace, bindingKey, context), String.format(Messages.content_assist_proposal_local, bindingKey, context) };
}
Also used : TemplateContextType(org.eclipse.jface.text.templates.TemplateContextType) ContextType(com.reprezen.swagedit.core.assist.contexts.ContextType) StyledString(org.eclipse.jface.viewers.StyledString) IBindingService(org.eclipse.ui.keys.IBindingService)

Example 10 with IBindingService

use of org.eclipse.ui.keys.IBindingService in project eclipse.platform.text by eclipse.

the class IncrementalFindTarget method focusLost.

@Override
public void focusLost(FocusEvent e) {
    IBindingService bindingService = PlatformUI.getWorkbench().getAdapter(IBindingService.class);
    if (bindingService != null && !bindingService.isKeyFilterEnabled()) {
        /*
			 * Workaround for bug 492587: Autosave breaks Incremental Find:
			 * We don't want to leave when the Workbench Window temporarily disables controls to
			 * run an IRunnableWithProgress. There's no direct API to know that this happens, but
			 * we can rely on the implementation detail that WorkbenchWindow#run(..) disables the
			 * key filter (and is the only one who does this, except for the Keys preference page).
			 */
        return;
    }
    leave();
}
Also used : IBindingService(org.eclipse.ui.keys.IBindingService)

Aggregations

IBindingService (org.eclipse.ui.keys.IBindingService)14 ParameterizedCommand (org.eclipse.core.commands.ParameterizedCommand)3 Binding (org.eclipse.jface.bindings.Binding)3 IWorkbench (org.eclipse.ui.IWorkbench)3 ArrayList (java.util.ArrayList)2 NotDefinedException (org.eclipse.core.commands.common.NotDefinedException)2 IStatus (org.eclipse.core.runtime.IStatus)2 Status (org.eclipse.core.runtime.Status)2 BindingManager (org.eclipse.jface.bindings.BindingManager)2 Scheme (org.eclipse.jface.bindings.Scheme)2 TriggerSequence (org.eclipse.jface.bindings.TriggerSequence)2 BindingService (org.eclipse.ui.internal.keys.BindingService)2 ContextType (com.reprezen.swagedit.core.assist.contexts.ContextType)1 Command (org.eclipse.core.commands.Command)1 CommandManager (org.eclipse.core.commands.CommandManager)1 ContextManager (org.eclipse.core.commands.contexts.ContextManager)1 IFileInfo (org.eclipse.core.filesystem.IFileInfo)1 IFile (org.eclipse.core.resources.IFile)1 IResourceStatus (org.eclipse.core.resources.IResourceStatus)1 MultiStatus (org.eclipse.core.runtime.MultiStatus)1