本文整理汇总了Java中org.eclipse.ui.keys.IBindingService.getActiveScheme方法的典型用法代码示例。如果您正苦于以下问题:Java IBindingService.getActiveScheme方法的具体用法?Java IBindingService.getActiveScheme怎么用?Java IBindingService.getActiveScheme使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.keys.IBindingService
的用法示例。
在下文中一共展示了IBindingService.getActiveScheme方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getKeyboardShortcut
import org.eclipse.ui.keys.IBindingService; //导入方法依赖的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
示例2: loadModelBackend
import org.eclipse.ui.keys.IBindingService; //导入方法依赖的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;
}
示例3: BindKeysHelper
import org.eclipse.ui.keys.IBindingService; //导入方法依赖的package包/类
/**
* @param contextId defines the keys context we'll work with...
*
* We'll only remove/add bindings to this context.
*/
public BindKeysHelper(String contextId) {
Assert.isNotNull(contextId);
this.contextId = contextId;
// Set the context we're working with.
Set<String> activeContextIds = new HashSet<>();
activeContextIds.add(contextId);
contextManager.setActiveContextIds(activeContextIds);
// Check that the context we're working with actually exists
IWorkbench workbench = PlatformUI.getWorkbench();
bindingService = (IBindingService) workbench.getService(IBindingService.class);
IContextService contextService = (IContextService) workbench.getService(IContextService.class);
Context context = contextService.getContext(contextId);
if (context == null || context.isDefined() == false) {
throw new RuntimeException("The context: " + contextId + " does not exist.");
}
Scheme activeScheme = bindingService.getActiveScheme();
final Scheme[] definedSchemes = bindingService.getDefinedSchemes();
// Make a copy we can work with locally (we'll apply changes later based on this copy).
try {
for (int i = 0; i < definedSchemes.length; i++) {
final Scheme scheme = definedSchemes[i];
final Scheme copy = localChangeManager.getScheme(scheme.getId());
copy.define(scheme.getName(), scheme.getDescription(), scheme.getParentId());
}
localChangeManager.setActiveScheme(activeScheme);
} catch (final NotDefinedException e) {
throw new Error("There is a programmer error in the bind keys helper"); //$NON-NLS-1$
}
localChangeManager.setLocale(bindingService.getLocale());
localChangeManager.setPlatform(bindingService.getPlatform());
Binding[] bindings = bindingService.getBindings();
for (Binding binding : bindings) {
initialState.add(binding);
}
localChangeManager.setBindings(bindings);
}