本文整理汇总了Java中org.eclipse.core.commands.CommandManager.getCommand方法的典型用法代码示例。如果您正苦于以下问题:Java CommandManager.getCommand方法的具体用法?Java CommandManager.getCommand怎么用?Java CommandManager.getCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.commands.CommandManager
的用法示例。
在下文中一共展示了CommandManager.getCommand方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.eclipse.core.commands.CommandManager; //导入方法依赖的package包/类
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
contextManager = new ContextManager();
commandManager = new CommandManager();
bindings = new ArrayList<Binding>();
command1 = commandManager.getCommand(COMMAND_IDS[0]);
command2 = commandManager.getCommand(COMMAND_IDS[1]);
command3 = commandManager.getCommand(COMMAND_IDS[2]);
bindings.add(createBinding(command1, "a", KeySequence.getInstance("M1+A")));
bindings.add(createBinding(command2, "b", KeySequence.getInstance("M1+B")));
bindings.add(createBinding(command3, "c", KeySequence.getInstance("M1+C")));
bindingManager = new BindingManager(contextManager, commandManager);
bindingManager.addBinding(bindings.get(0));
bindingManager.addBinding(bindings.get(1));
bindingManager.addBinding(bindings.get(2));
final Scheme scheme = bindingManager.getScheme("default");
scheme.define("myScheme1", "My scheme for testing", null);
bindingManager.setActiveScheme(scheme);
}
示例2: createCommand
import org.eclipse.core.commands.CommandManager; //导入方法依赖的package包/类
private ParameterizedCommand createCommand(final MCommand inCommand,
final CommandManager inCommandManager) {
return new ParameterizedCommand(
inCommandManager.getCommand(inCommand.getElementId()),
null);
}
示例3: init
import org.eclipse.core.commands.CommandManager; //导入方法依赖的package包/类
/**
* Initializes the model.
*
* @param bindingManager
* {@link BindingManager}
* @param commandManager
* {@link CommandManager}
* @param bindingTables
* List<MBindingTable>
* @param contextModel
* {@link ContextModel}
* @return {@link BindingModel} the instance
*/
@SuppressWarnings("unchecked")
public BindingModel init(BindingManager bindingManager,
CommandManager commandManager, List<MBindingTable> bindingTables,
ContextModel contextModel) {
this.bindingManager = bindingManager;
bindingToElement = new HashMap<Binding, BindingElement>();
commandToElement = new HashMap<ParameterizedCommand, BindingElement>();
bindingElements = new HashSet<BindingElement>();
final Set<ParameterizedCommand> cmdsForBindings = new HashSet<ParameterizedCommand>();
final Iterator<Binding> bindings = bindingManager
.getActiveBindingsDisregardingContextFlat().iterator();
while (bindings.hasNext()) {
final Binding binding = bindings.next();
final BindingElement element = new BindingElement(getController());
element.init(binding, contextModel);
element.setParent(this);
bindingElements.add(element);
bindingToElement.put(binding, element);
cmdsForBindings.add(binding.getParameterizedCommand());
}
final Set<String> commandIds = commandManager.getDefinedCommandIds();
allParameterizedCommands = new HashSet<ParameterizedCommand>();
final Iterator<String> commandIdItr = commandIds.iterator();
while (commandIdItr.hasNext()) {
final String currentCommandId = commandIdItr.next();
final Command currentCommand = commandManager
.getCommand(currentCommandId);
try {
allParameterizedCommands.addAll(
CommandHelper.generateCombinations(currentCommand));
}
catch (final NotDefinedException exc) {
// It is safe to just ignore undefined commands.
}
}
final Iterator<ParameterizedCommand> commands = allParameterizedCommands
.iterator();
while (commands.hasNext()) {
final ParameterizedCommand command = commands.next();
if (!cmdsForBindings.contains(command)) {
final BindingElement bindingElement = new BindingElement(
getController());
bindingElement.init(command);
bindingElement.setParent(this);
bindingElements.add(bindingElement);
commandToElement.put(command, bindingElement);
}
}
return this;
}