本文整理汇总了Java中org.eclipse.jface.bindings.Scheme类的典型用法代码示例。如果您正苦于以下问题:Java Scheme类的具体用法?Java Scheme怎么用?Java Scheme使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Scheme类属于org.eclipse.jface.bindings包,在下文中一共展示了Scheme类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doEvaluate
import org.eclipse.jface.bindings.Scheme; //导入依赖的package包/类
private EvaluationResult doEvaluate(
final KbaChangeSet changeSet) {
final KeyBindings bindings = new KeyBindings(bindingService.getBindings());
final Scheme scheme = bindingService.getScheme(changeSet.getSchemeId());
switch (changeSet.getAction()) {
case ADD:
modifyBindingsForAddChangeSet(changeSet, bindings, scheme);
break;
case REMOVE:
modifyBindingsForRemoveChangeSet(changeSet, bindings, scheme);
break;
default:
throw new UnsupportedOperationException();
}
return new EvaluationResult(scheme, bindings);
}
开发者ID:alfsch,项目名称:workspacemechanic,代码行数:21,代码来源:KeyboardBindingsTask.java
示例2: getKeyboardShortcut
import org.eclipse.jface.bindings.Scheme; //导入依赖的package包/类
private static String getKeyboardShortcut(ParameterizedCommand command) {
IBindingService bindingService= (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class);
fgLocalBindingManager.setBindings(bindingService.getBindings());
try {
Scheme activeScheme= bindingService.getActiveScheme();
if (activeScheme != null)
fgLocalBindingManager.setActiveScheme(activeScheme);
} catch (NotDefinedException e) {
JavaPlugin.log(e);
}
TriggerSequence[] bindings= fgLocalBindingManager.getActiveBindingsDisregardingContextFor(command);
if (bindings.length > 0)
return bindings[0].format();
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:CodeAssistAdvancedConfigurationBlock.java
示例3: loadModelBackend
import org.eclipse.jface.bindings.Scheme; //导入依赖的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
示例4: setDefaultBindings
import org.eclipse.jface.bindings.Scheme; //导入依赖的package包/类
/**
* Sets the bindings to default.
* @param bindingService
* @throws NotDefinedException
*/
public void setDefaultBindings(IBindingService bindingService, List<String> lstRemove) throws NotDefinedException {
// Fix the scheme in the local changes.
final String defaultSchemeId = bindingService.getDefaultSchemeId();
final Scheme defaultScheme = fBindingManager.getScheme(defaultSchemeId);
try {
fBindingManager.setActiveScheme(defaultScheme);
} catch (final NotDefinedException e) {
// At least we tried....
}
// Restore any User defined bindings
Binding[] bindings = fBindingManager.getBindings();
for (int i = 0; i < bindings.length; i++) {
ParameterizedCommand pCommand = bindings[i].getParameterizedCommand();
String commandId = null;
if (pCommand != null) {
commandId = pCommand.getCommand().getId();
}
if (bindings[i].getType() == Binding.USER || (commandId != null && lstRemove.contains(commandId))) {
fBindingManager.removeBinding(bindings[i]);
}
}
bindingModel.refresh(contextModel, lstRemove);
saveBindings(bindingService);
}
开发者ID:heartsome,项目名称:translationstudio8,代码行数:31,代码来源:KeyController2.java
示例5: earlyStartup
import org.eclipse.jface.bindings.Scheme; //导入依赖的package包/类
public void earlyStartup() {
final IWorkbench workbench = PlatformUI.getWorkbench();
workbench.getDisplay().asyncExec(new Runnable() {
public void run() {
// 在工作台初始化后,移除平台默认的 scheme
IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class);
Scheme[] schemes = bindingService.getDefinedSchemes();
for (int i = 0; i < schemes.length; i++) {
String id = schemes[i].getId();
if (id.equals(platformDefaultScheme) || id.equals(platformEmacsScheme)) {
schemes[i].undefine();
}
}
}
});
}
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:19,代码来源:ShieldStartup.java
示例6: setUp
import org.eclipse.jface.bindings.Scheme; //导入依赖的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
示例7: changeScheme
import org.eclipse.jface.bindings.Scheme; //导入依赖的package包/类
protected void changeScheme(final SchemeElement inOldScheme,
final SchemeElement inNewScheme) {
if (inNewScheme == null || inNewScheme
.getModelObject() == bindingManager.getActiveScheme()) {
return;
}
try {
bindingManager
.setActiveScheme((Scheme) inNewScheme.getModelObject());
bindingModel.refresh(getContextModel());
bindingModel.setSelectedElement(null);
}
catch (final NotDefinedException exc) {
log.error(exc, exc.getMessage());
}
}
开发者ID:aktion-hip,项目名称:relations,代码行数:17,代码来源:KeyController.java
示例8: addIfNotPresent
import org.eclipse.jface.bindings.Scheme; //导入依赖的package包/类
/**
* Bind a scheme / platform / context / trigger sequence to a command.
*/
public void addIfNotPresent(
Scheme scheme,
String platform,
String contextId,
KeySequence triggerSequence,
ParameterizedCommand command) {
Map<String,String> params = commandParamMap(command);
Binding binding = find(scheme, platform, triggerSequence, command.getId(), params);
// If no binding exists, create the user binding, add it and return true.
if (binding == null) {
Binding bindingToAdd = createBinding(scheme, platform, contextId, triggerSequence, command);
addUserBinding(bindingToAdd);
addedBindings.add(bindingToAdd);
return;
}
/*
* If a system binding exists for this scheme / sequence, find out if there's a
* user binding hiding it, and if so remove it.
*/
if ((binding.getType() == Binding.SYSTEM)) {
// Finding a user binding to a null command.
// ZORZELLA: do we even need to supply params?
Binding userBinding = find(scheme, platform, triggerSequence, null, params, userBindings);
if (userBinding != null) {
userBindings.remove(userBinding);
return;
}
}
return;
}
开发者ID:alfsch,项目名称:workspacemechanic,代码行数:35,代码来源:KeyBindings.java
示例9: removeBindingIfPresent
import org.eclipse.jface.bindings.Scheme; //导入依赖的package包/类
/**
* Remove a binding.
*/
public void removeBindingIfPresent(
Scheme scheme,
String platform,
String contextId,
KeySequence triggerSequence,
Command command,
Map<String, String> params) {
Binding binding = find(scheme, platform, triggerSequence, command.getId(), params, userBindings);
if (binding != null) {
userBindings.remove(binding);
removedBindings.add(binding);
return;
}
binding = find(scheme, platform, triggerSequence, command.getId(), params, systemBindings);
if (binding != null) {
if (find(scheme, platform, triggerSequence, null, params, userBindings) == null) {
Binding bindingToRemoveWithNullCommand = createBinding(scheme, platform, contextId, triggerSequence, null);
// Removing a system binding means creating a weird system binding with
// a null command
addUserBinding(bindingToRemoveWithNullCommand);
removedBindings.add(binding);
return;
}
}
return;
}
开发者ID:alfsch,项目名称:workspacemechanic,代码行数:33,代码来源:KeyBindings.java
示例10: find
import org.eclipse.jface.bindings.Scheme; //导入依赖的package包/类
private Binding find(
Scheme scheme,
String platform,
KeySequence triggerSequence,
String cid,
Map<String, String> params) {
Binding userBinding = find(scheme, platform, triggerSequence, cid, params, userBindings);
if (userBinding != null) {
return userBinding;
}
return find(scheme, platform, triggerSequence, cid, params, systemBindings);
}
开发者ID:alfsch,项目名称:workspacemechanic,代码行数:13,代码来源:KeyBindings.java
示例11: createBinding
import org.eclipse.jface.bindings.Scheme; //导入依赖的package包/类
private Binding createBinding(
Scheme scheme,
String platform,
String contextId,
KeySequence triggerSequence,
ParameterizedCommand parameterizedCommand) {
Binding newBinding =
new KeyBinding(triggerSequence, parameterizedCommand, scheme.getId(),
contextId, null, platform, null, Binding.USER);
return newBinding;
}
开发者ID:alfsch,项目名称:workspacemechanic,代码行数:14,代码来源:KeyBindings.java
示例12: modifyBindingsForAddChangeSet
import org.eclipse.jface.bindings.Scheme; //导入依赖的package包/类
private void modifyBindingsForAddChangeSet(final KbaChangeSet changeSet,
final KeyBindings bindings, final Scheme scheme) {
for (KbaBinding toAdd : changeSet.getBindingList()) {
Command commandToAdd = commandService.getCommand(toAdd.getCid());
if (!commandToAdd.isDefined()) {
log.logWarning("Command '" + toAdd.getCid() + "' does not exist. Skipping.");
continue;
}
ParameterizedCommand parameterizedCommandToAdd =
ParameterizedCommand.generateCommand(commandToAdd, toAdd.getParameters());
KeySequence triggerSequence;
try {
triggerSequence = KeySequence.getInstance(toAdd.getKeySequence());
} catch (ParseException e) {
log.logError(e, "Invalid key sequence: %s", toAdd.getKeySequence());
throw new RuntimeException(e);
}
bindings.addIfNotPresent(
scheme,
changeSet.getPlatform(),
changeSet.getContextId(),
triggerSequence,
parameterizedCommandToAdd);
}
}
开发者ID:alfsch,项目名称:workspacemechanic,代码行数:28,代码来源:KeyboardBindingsTask.java
示例13: changeScheme
import org.eclipse.jface.bindings.Scheme; //导入依赖的package包/类
/**
* @param oldScheme
* @param newScheme
*/
protected void changeScheme(SchemeElement oldScheme, SchemeElement newScheme) {
if (newScheme == null || newScheme.getModelObject() == fBindingManager.getActiveScheme()) {
return;
}
try {
fBindingManager.setActiveScheme((Scheme) newScheme.getModelObject());
bindingModel.refresh(contextModel);
bindingModel.setSelectedElement(null);
} catch (NotDefinedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
开发者ID:heartsome,项目名称:translationstudio8,代码行数:19,代码来源:KeyController2.java
示例14: earlyStartup
import org.eclipse.jface.bindings.Scheme; //导入依赖的package包/类
public void earlyStartup() {
IWorkbench workbench = PlatformUI.getWorkbench();
// 在工作台初始化后,移除平台默认的 scheme
IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class);
Scheme[] schemes = bindingService.getDefinedSchemes();
for (int i = 0; i < schemes.length; i++) {
String id = schemes[i].getId();
if (id.equals(platformDefaultScheme) || id.equals(platformEmacsScheme)) {
schemes[i].undefine();
}
}
}
开发者ID:heartsome,项目名称:translationstudio8,代码行数:14,代码来源:ShieldStartup.java
示例15: addUserBindings
import org.eclipse.jface.bindings.Scheme; //导入依赖的package包/类
/**
* @param force if true, we'll create the user binding regardless of having some existing binding. Otherwise,
* we'll not allow the creation if a binding already exists for it.
*
* Note: conflicting bindings should be removed before (through removeUserBindingsWithFilter). If they're
* not removed, a conflict will be created in the bindings.
*/
public void addUserBindings(KeySequence keySequence, ParameterizedCommand command) throws Exception {
Scheme activeScheme = bindingService.getActiveScheme();
String schemeId = activeScheme.getId();
localChangeManager.addBinding(new KeyBinding(keySequence, command,
schemeId, contextId, null, null, null, Binding.USER));
}
开发者ID:fabioz,项目名称:Pydev,代码行数:16,代码来源:BindKeysHelper.java
示例16: setUp
import org.eclipse.jface.bindings.Scheme; //导入依赖的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
示例17: init
import org.eclipse.jface.bindings.Scheme; //导入依赖的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
示例18: init
import org.eclipse.jface.bindings.Scheme; //导入依赖的package包/类
/**
* Initializes this scheme instance.
*
* @param scheme
* {@link Scheme}
* @param log
* {@link Logger}
*/
public void init(final Scheme scheme, final Logger log) {
setId(scheme.getId());
setModelObject(scheme);
try {
setName(scheme.getName());
setDescription(scheme.getDescription());
}
catch (final NotDefinedException exc) {
log.error(exc, exc.getMessage());
}
}
开发者ID:aktion-hip,项目名称:relations,代码行数:20,代码来源:SchemeElement.java
示例19: loadModelBackend
import org.eclipse.jface.bindings.Scheme; //导入依赖的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
示例20: EvaluationResult
import org.eclipse.jface.bindings.Scheme; //导入依赖的package包/类
public EvaluationResult(
final Scheme scheme,
final KeyBindings keyBindings) {
this.scheme = scheme;
this.keyBindings = keyBindings;
}
开发者ID:alfsch,项目名称:workspacemechanic,代码行数:7,代码来源:KeyboardBindingsTask.java
注:本文中的org.eclipse.jface.bindings.Scheme类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论