Java Code Examples for org.eclipse.core.commands.ParameterizedCommand#getId()

The following examples show how to use org.eclipse.core.commands.ParameterizedCommand#getId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KeyController2.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("restriction")
public void filterDupliteBind(){
	IWorkbench workbench = PlatformUI.getWorkbench();
	IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class);
	BindingService service =(BindingService)bindingService;
	BindingManager bindingManager = service.getBindingManager();
	//service.getBindingManager().
	Binding[] bindings = bindingManager.getBindings();
     List<Binding> bindTemp = new ArrayList<Binding>();
     List<String> ids = new ArrayList<String>();
     for(Binding bind : bindings){
		if(null ==bind){
			continue;
		}
		ParameterizedCommand command = bind.getParameterizedCommand();
		if(null == command){
			continue;
		}
		String id = command.getId();
		if(!ids.contains(id)){
			ids.add(id);
			bindTemp.add(bind);
		}
	}
   
     bindingManager.setBindings(bindTemp.toArray(new Binding[ids.size()]));
}
 
Example 2
Source File: KeyController2.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("restriction")
public void filterDupliteBind(){
	IWorkbench workbench = PlatformUI.getWorkbench();
	IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class);
	BindingService service =(BindingService)bindingService;
	BindingManager bindingManager = service.getBindingManager();
	//service.getBindingManager().
	Binding[] bindings = bindingManager.getBindings();
     List<Binding> bindTemp = new ArrayList<Binding>();
     List<String> ids = new ArrayList<String>();
     for(Binding bind : bindings){
		if(null ==bind){
			continue;
		}
		ParameterizedCommand command = bind.getParameterizedCommand();
		if(null == command){
			continue;
		}
		String id = command.getId();
		if(!ids.contains(id)){
			ids.add(id);
			bindTemp.add(bind);
		}
	}
   
     bindingManager.setBindings(bindTemp.toArray(new Binding[ids.size()]));
}
 
Example 3
Source File: KeyController2.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("restriction")
public void filterDupliteBind(){
	IWorkbench workbench = PlatformUI.getWorkbench();
	IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class);
	BindingService service =(BindingService)bindingService;
	BindingManager bindingManager = service.getBindingManager();
	//service.getBindingManager().
	Binding[] bindings = bindingManager.getBindings();
     List<Binding> bindTemp = new ArrayList<Binding>();
     List<String> ids = new ArrayList<String>();
     for(Binding bind : bindings){
		if(null ==bind){
			continue;
		}
		ParameterizedCommand command = bind.getParameterizedCommand();
		if(null == command){
			continue;
		}
		String id = command.getId();
		if(!ids.contains(id)){
			ids.add(id);
			bindTemp.add(bind);
		}
	}
   
     bindingManager.setBindings(bindTemp.toArray(new Binding[ids.size()]));
}
 
Example 4
Source File: EclBinding.java    From workspacemechanic with Eclipse Public License 1.0 4 votes vote down vote up
private static String calculateCid(Binding b) {
  ParameterizedCommand parameterizedCommand = b.getParameterizedCommand();
  return parameterizedCommand == null ? null : parameterizedCommand.getId();
}
 
Example 5
Source File: FindBarActions.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * @return a map with the commands -> bindings available.
 */
public HashMap<String, List<TriggerSequence>> getCommandToBindings()
{
	HashMap<String, List<TriggerSequence>> commandToBinding = new HashMap<String, List<TriggerSequence>>();

	IWorkbenchPartSite site = textEditor.getSite();
	IBindingService service = (IBindingService) site.getService(IBindingService.class);
	Binding[] bindings = service.getBindings();

	for (int i = 0; i < bindings.length; i++)
	{
		Binding binding = bindings[i];
		ParameterizedCommand command = binding.getParameterizedCommand();
		if (command != null)
		{
			String id = command.getId();
			// Filter only the actions we decided would be active.
			//
			// Note: we don't just make all actions active because they conflict with the find bar
			// expected accelerators, so, things as Alt+W don't work -- even a second Ctrl+F isn't properly
			// treated as specified in the options.
			// A different option could be filtering those out and let everything else enabled,
			// but this would need to be throughly tested to know if corner-cases work.
			if (fCommandToHandler.containsKey(id))
			{
				List<TriggerSequence> list = commandToBinding.get(id);
				if (list == null)
				{
					list = new ArrayList<TriggerSequence>();
					commandToBinding.put(id, list);
				}
				list.add(binding.getTriggerSequence());
			}

			// Uncomment to know which actions will be disabled
			// else
			// {
			// try
			// {
			// System.out.println("Command disabled: " + id + ": " + command.getName());
			// }
			// catch (NotDefinedException e)
			// {
			//
			// }
			// }
		}
	}
	return commandToBinding;
}