Search in sources :

Example 16 with Binding

use of org.eclipse.jface.bindings.Binding 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)

Aggregations

Binding (org.eclipse.jface.bindings.Binding)16 ParameterizedCommand (org.eclipse.core.commands.ParameterizedCommand)12 KeyBinding (org.eclipse.jface.bindings.keys.KeyBinding)9 BindingElement (org.eclipse.ui.internal.keys.model.BindingElement)9 ArrayList (java.util.ArrayList)5 Collection (java.util.Collection)5 Iterator (java.util.Iterator)5 IBindingService (org.eclipse.ui.keys.IBindingService)5 NotDefinedException (org.eclipse.core.commands.common.NotDefinedException)4 TriggerSequence (org.eclipse.jface.bindings.TriggerSequence)4 HashMap (java.util.HashMap)3 Command (org.eclipse.core.commands.Command)3 ICommandService (org.eclipse.ui.commands.ICommandService)3 HashSet (java.util.HashSet)2 Map (java.util.Map)2 Entry (java.util.Map.Entry)2 Set (java.util.Set)2 IWorkbench (org.eclipse.ui.IWorkbench)2 BindingService (org.eclipse.ui.internal.keys.BindingService)2 ModelElement (org.eclipse.ui.internal.keys.model.ModelElement)2