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

The following examples show how to use org.eclipse.core.commands.ParameterizedCommand#getCommand() . 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: KeyBindings.java    From workspacemechanic with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Finds a binding in {@code list} that matches the given
 * {@code triggerSequence}, {@code scheme} and {@code cid}. If not found,
 * return {@code null}.
 */
private static Binding find(
    Scheme scheme,
    String platform,
    KeySequence triggerSequence,
    String cid,
    Map<String,String> params,
    List<Binding> list) {
  for (Binding binding : list) {
    if (binding.getSchemeId().equals(scheme.getId())
      && (binding.getTriggerSequence().equals(triggerSequence))
      && Objects.equal(binding.getPlatform(),  platform)) {
        ParameterizedCommand param = binding.getParameterizedCommand();
        if (param == null) {
          if (cid == null) {
            return binding;
          }
          continue;
        }
        Command command = param.getCommand();
        if (cid == null) {
          return command == null ? binding : null;
        }
        if (cid.equals(command.getId())) {
          Map<String,String> temp = commandParamMap(param);
          if (equalMaps(temp, params)) {
            return binding;
          }
        }
      }
  }
  return null;
}
 
Example 2
Source File: CommandDescribeHandler.java    From e4macs with Eclipse Public License 1.0 5 votes vote down vote up
Command getCommand(Binding binding) {
	Command result = null;
	ParameterizedCommand pc = binding.getParameterizedCommand();
	if (pc != null) {
		result = pc.getCommand(); 		
	}
	return result;
}