• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CommandManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.core.commands.CommandManager的典型用法代码示例。如果您正苦于以下问题:Java CommandManager类的具体用法?Java CommandManager怎么用?Java CommandManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CommandManager类属于org.eclipse.core.commands包,在下文中一共展示了CommandManager类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: loadModelBackend

import org.eclipse.core.commands.CommandManager; //导入依赖的package包/类
private static BindingManager loadModelBackend(IServiceLocator locator) {
	IBindingService bindingService = (IBindingService) locator.getService(IBindingService.class);
	BindingManager bindingManager = new BindingManager(new ContextManager(), new CommandManager());
	final Scheme[] definedSchemes = bindingService.getDefinedSchemes();
	try {
		Scheme modelActiveScheme = null;
		for (int i = 0; i < definedSchemes.length; i++) {
			final Scheme scheme = definedSchemes[i];
			final Scheme copy = bindingManager.getScheme(scheme.getId());
			copy.define(scheme.getName(), scheme.getDescription(), scheme.getParentId());
			if (definedSchemes[i] == bindingService.getActiveScheme()) {
				modelActiveScheme = copy;
			}
		}
		bindingManager.setActiveScheme(modelActiveScheme);
	} catch (final NotDefinedException e) {
		StatusManager.getManager()
				.handle(new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH,
						"Keys page found an undefined scheme", e)); //$NON-NLS-1$
	}
	bindingManager.setLocale(bindingService.getLocale());
	bindingManager.setPlatform(bindingService.getPlatform());
	bindingManager.setBindings(bindingService.getBindings());
	return bindingManager;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:26,代码来源:KeyController2.java


示例2: BindingManager

import org.eclipse.core.commands.CommandManager; //导入依赖的package包/类
/**
 * <p>
 * Constructs a new instance of <code>BindingManager</code>.
 * </p>
 * <p>
 * This method completes in amortized constant time (O(1)).
 * </p>
 * 
 * @param contextManager
 *            The context manager that will support this binding manager.
 *            This value must not be <code>null</code>.
 * @param commandManager
 *            The command manager that will support this binding manager.
 *            This value must not be <code>null</code>.
 */
public BindingManager(final ContextManager contextManager,
		final CommandManager commandManager) {
	if (contextManager == null) {
		throw new NullPointerException(
				"A binding manager requires a context manager"); //$NON-NLS-1$
	}

	if (commandManager == null) {
		throw new NullPointerException(
				"A binding manager requires a command manager"); //$NON-NLS-1$
	}

	this.contextManager = contextManager;
	contextManager.addContextManagerListener(this);
	this.commandManager = commandManager;
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:32,代码来源:BindingManager.java


示例3: 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);
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:25,代码来源:BindingModelTest.java


示例4: ContributionItemsFactory

import org.eclipse.core.commands.CommandManager; //导入依赖的package包/类
ContributionItemsFactory(final MApplication inApplication,
        final EModelService inModelService,
        final EBindingService inBindingService) {
	items = new ArrayList<StyleContributionItem>();

	final IEclipseContext lContext = inApplication.getContext();
	final CommandManager lCommandManager = lContext
	        .get(CommandManager.class);
	final ISWTResourceUtilities lResourceUtility = (ISWTResourceUtilities) lContext
	        .get(IResourceUtilities.class.getName());
	final EHandlerService lHandlerService = lContext
	        .get(EHandlerService.class);

	final MToolBar lToolbar = (MToolBar) inModelService
	        .find(MUI_ID_STYLING_TOOLBAR, inApplication);
	for (final MToolBarElement lElement : lToolbar.getChildren()) {
		if (lElement instanceof MHandledToolItem) {
			final StyleContributionItem lItem = new StyleContributionItem(
			        (MHandledToolItem) lElement, lResourceUtility,
			        inBindingService, lCommandManager, lHandlerService);
			ContextInjectionFactory.inject(lItem, lContext);
			items.add(lItem);
		}
	}
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:26,代码来源:AbstractEditForm.java


示例5: CommandCallback

import org.eclipse.core.commands.CommandManager; //导入依赖的package包/类
/**
 * Constructs a new instance of <code>CommandCallback</code> with the
 * workbench it should be using. All commands will be considered active.
 * 
 * @param bindingManager
 *            The binding manager which will provide the callback; must
 *            not be <code>null</code>.
 * @param commandManager
 *            The command manager which will provide the callback; must
 *            not be <code>null</code>.
 * 
 * @since 3.1
 */
public CommandCallback(final BindingManager bindingManager,
		final CommandManager commandManager) {
	this(bindingManager, commandManager, new IActiveChecker() {
		public boolean isActive(String commandId) {
			return true;
		}

	}, new IExecuteApplicable() {
		public boolean isApplicable(IAction action) {
			return true;
		}
	});
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:27,代码来源:ExternalActionManager.java


示例6: setUp

import org.eclipse.core.commands.CommandManager; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
	contextManager = new ContextManager();
	commandManager = new CommandManager();
	bindingManager = new BindingManager(contextManager, commandManager);
	MockitoAnnotations.initMocks(this);

	final Scheme scheme = bindingManager.getScheme(SCHEME_ID);
	scheme.define("scheme:name", "scheme:description", null);
	bindingManager.setActiveScheme(scheme);
	bindingManager.schemeChanged(new SchemeEvent(scheme, true, false, false, false));
	inject(keyController, "commandManager", commandManager);
	inject(keyController, "bindingManagerApp", bindingManager);
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:15,代码来源:KeyControllerTest.java


示例7: setUp

import org.eclipse.core.commands.CommandManager; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
	commandManager = new CommandManager();
	MockitoAnnotations.initMocks(this);

	bindingTable = new TestBindingTable();
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:8,代码来源:SaveHelperTest.java


示例8: StyleContributionItem

import org.eclipse.core.commands.CommandManager; //导入依赖的package包/类
protected StyleContributionItem(final MHandledToolItem inElement,
        final ISWTResourceUtilities inUtility,
        final EBindingService inBindingService,
        final CommandManager inCommandManager,
        final EHandlerService inHandlerService) {
	super(inElement.getElementId());
	handlerService = inHandlerService;
	icon = inUtility.imageDescriptorFromURI(
	        URI.createURI(inElement.getIconURI()));
	tooltip = inElement.getLocalizedTooltip();
	command = createCommand(inElement.getCommand(), inCommandManager);
	sequence = inBindingService.getBestSequenceFor(command);
	style = Styles.getStyle(inElement.getCommand().getElementId());
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:15,代码来源:AbstractEditForm.java


示例9: loadModelBackend

import org.eclipse.core.commands.CommandManager; //导入依赖的package包/类
private BindingManager loadModelBackend() {
	final BindingManager outManager = new BindingManager(
	        new ContextManager(), new CommandManager());
	final Scheme[] definedSchemes = bindingManagerApp.getDefinedSchemes();
	try {
		Scheme modelActiveScheme = null;
		for (int i = 0; i < definedSchemes.length; i++) {
			final Scheme scheme = definedSchemes[i];
			final Scheme copy = outManager.getScheme(scheme.getId());
			copy.define(scheme.getName(), scheme.getDescription(),
			        scheme.getParentId());
			if (definedSchemes[i].getId()
			        .equals(bindingManagerApp.getActiveScheme().getId())) {
				modelActiveScheme = copy;
			}
		}
		outManager.setActiveScheme(modelActiveScheme);
	}
	catch (final NotDefinedException exc) {
		log.error(exc, exc.getMessage());
	}
	outManager.setLocale(bindingManagerApp.getLocale());
	outManager.setPlatform(bindingManagerApp.getPlatform());
	// fill bindings from bindingService to bindingManager instance
	outManager.setBindings(getBindingsFromSrc());
	return outManager;
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:28,代码来源:KeyController.java


示例10: executeSelectAllCommand

import org.eclipse.core.commands.CommandManager; //导入依赖的package包/类
/**
 * Executes the select all command in the currently open workbench.
 */
private void executeSelectAllCommand() throws ExecutionException {
	Command selectAllCommand = PlatformUI.getWorkbench()
			.getService(CommandManager.class).getCommand(IWorkbenchCommandConstants.EDIT_SELECT_ALL);
	selectAllCommand.getHandler().execute(new ExecutionEvent());
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:9,代码来源:SelectAllProjectExplorer_PluginUITest.java


示例11: setUp

import org.eclipse.core.commands.CommandManager; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
	commandManager = new CommandManager();
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:5,代码来源:BindingElementTest.java


示例12: 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);
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:7,代码来源:AbstractEditForm.java


示例13: init

import org.eclipse.core.commands.CommandManager; //导入依赖的package包/类
/**
 * Initializes the model.
 *
 * @param bindingManager
 *            {@link BindingManager}
 * @param commandManager
 *            {@link CommandManager}
 * @param bindingTables
 *            List&lt;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;
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:68,代码来源:BindingModel.java



注:本文中的org.eclipse.core.commands.CommandManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Tile类代码示例发布时间:2022-05-23
下一篇:
Java ReorientRelationshipRequest类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap