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

Java BindingManager类代码示例

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

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



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

示例1: loadModelBackend

import org.eclipse.jface.bindings.BindingManager; //导入依赖的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: setUp

import org.eclipse.jface.bindings.BindingManager; //导入依赖的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


示例3: init

import org.eclipse.jface.bindings.BindingManager; //导入依赖的package包/类
public void init(BindingManager manager, BindingModel model) {
	bindingManager = manager;
	bindingModel = model;
	conflictsMap = new HashMap();
	Iterator i = bindingModel.getBindings().iterator();
	while (i.hasNext()) {
		BindingElement be = (BindingElement) i.next();
		if (be.getModelObject() instanceof Binding) {
			updateConflictsFor(be);
		}
	}
	controller.addPropertyChangeListener(new IPropertyChangeListener() {
		public void propertyChange(PropertyChangeEvent event) {
			if (event.getSource() == ConflictModel2.this
					&& CommonModel.PROP_SELECTED_ELEMENT.equals(event
							.getProperty())) {
				if (event.getNewValue() != null) {
					updateConflictsFor(
							(BindingElement) event.getOldValue(),
							(BindingElement) event.getNewValue());
					setConflicts((Collection) conflictsMap.get(event
							.getNewValue()));
				} else {
					setConflicts(null);
				}
			} else if (BindingModel.PROP_BINDING_REMOVE.equals(event
					.getProperty())) {
				updateConflictsFor((BindingElement) event.getOldValue(),
						(BindingElement) event.getNewValue(), true);
			}
		}
	});
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:34,代码来源:ConflictModel2.java


示例4: filterDupliteBind

import org.eclipse.jface.bindings.BindingManager; //导入依赖的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()]));
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:28,代码来源:KeyController2.java


示例5: CommandCallback

import org.eclipse.jface.bindings.BindingManager; //导入依赖的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.jface.bindings.BindingManager; //导入依赖的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: init

import org.eclipse.jface.bindings.BindingManager; //导入依赖的package包/类
/**
 * Initializes this scheme model instance.
 *
 * @param bindingManager
 *            {@link BindingManager}
 * @param log
 *            {@link Logger}
 */
public void init(BindingManager bindingManager, Logger log) {
	schemes = new ArrayList<SchemeElement>();
	final Scheme[] lDefinedSchemes = bindingManager.getDefinedSchemes();
	for (int i = 0; i < lDefinedSchemes.length; i++) {
		final SchemeElement lElement = new SchemeElement(getController());
		lElement.init(lDefinedSchemes[i], log);
		lElement.setParent(this);
		schemes.add(lElement);
		if (lDefinedSchemes[i] == bindingManager.getActiveScheme()) {
			setSelectedElement(lElement);
		}
	}
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:22,代码来源:SchemeModel.java


示例8: loadModelBackend

import org.eclipse.jface.bindings.BindingManager; //导入依赖的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


示例9: init

import org.eclipse.jface.bindings.BindingManager; //导入依赖的package包/类
/**
 * Method to be called for initializing the conflict model instance.
 *
 * @param bindingModel
 *            {@link BindingModel}
 * @param bindingManager
 *            {@link BindingManager}
 */
public void init(BindingModel bindingModel, BindingManager bindingManager) {
	this.bindingModel = bindingModel;
	this.bindingManager = bindingManager;

	conflictsMap = new HashMap<BindingElement, Collection<BindingElement>>();
	final Iterator<BindingElement> lBindings = bindingModel.getBindings()
	        .iterator();
	while (lBindings.hasNext()) {
		final BindingElement lBinding = lBindings.next();
		if (lBinding.getModelObject() instanceof Binding) {
			updateConflictsFor(lBinding);
		}
	}
	getController()
	        .addPropertyChangeListener(new IPropertyChangeListener() {
		        @Override
		        public void propertyChange(
	                    final PropertyChangeEvent inEvent) {
			        if (inEvent.getSource() == ConflictModel.this
	                        && CommonModel.PROP_SELECTED_ELEMENT
	                                .equals(inEvent.getProperty())) {
				        if (inEvent.getNewValue() != null) {
					        updateConflictsFor(
	                                (BindingElement) inEvent.getOldValue(),
	                                (BindingElement) inEvent.getNewValue());
					        setConflicts(conflictsMap
	                                .get(inEvent.getNewValue()));
				        } else {
					        setConflicts(null);
				        }
			        } else if (BindingModel.PROP_BINDING_REMOVE
	                        .equals(inEvent.getProperty())) {
				        updateConflictsFor(
	                            (BindingElement) inEvent.getOldValue(),
	                            (BindingElement) inEvent.getNewValue(),
	                            true);
			        }
		        }
	        });
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:49,代码来源:ConflictModel.java


示例10: init

import org.eclipse.jface.bindings.BindingManager; //导入依赖的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.jface.bindings.BindingManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ForbiddenException类代码示例发布时间:2022-05-23
下一篇:
Java TouchImageView类代码示例发布时间: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