本文整理汇总了Java中org.eclipse.core.commands.ParameterizedCommand.getId方法的典型用法代码示例。如果您正苦于以下问题:Java ParameterizedCommand.getId方法的具体用法?Java ParameterizedCommand.getId怎么用?Java ParameterizedCommand.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.commands.ParameterizedCommand
的用法示例。
在下文中一共展示了ParameterizedCommand.getId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: filterDupliteBind
import org.eclipse.core.commands.ParameterizedCommand; //导入方法依赖的package包/类
@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()]));
}
示例2: calculateCid
import org.eclipse.core.commands.ParameterizedCommand; //导入方法依赖的package包/类
private static String calculateCid(Binding b) {
ParameterizedCommand parameterizedCommand = b.getParameterizedCommand();
return parameterizedCommand == null ? null : parameterizedCommand.getId();
}
示例3: getCommandToBindings
import org.eclipse.core.commands.ParameterizedCommand; //导入方法依赖的package包/类
/**
* @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;
}