use of org.eclipse.ui.internal.keys.BindingService in project netxms by netxms.
the class MobileApplicationWorkbenchWindowAdvisor method postWindowCreate.
/* (non-Javadoc)
* @see org.eclipse.ui.application.WorkbenchWindowAdvisor#postWindowCreate()
*/
@Override
public void postWindowCreate() {
super.postWindowCreate();
BindingService service = (BindingService) getWindowConfigurer().getWindow().getWorkbench().getService(IBindingService.class);
BindingManager bindingManager = service.getBindingManager();
try {
// $NON-NLS-1$
bindingManager.setActiveScheme(service.getScheme("org.netxms.ui.eclipse.defaultKeyBinding"));
} catch (NotDefinedException e) {
e.printStackTrace();
}
final Shell shell = getWindowConfigurer().getWindow().getShell();
shell.setMaximized(true);
for (Control ctrl : shell.getChildren()) {
// $NON-NLS-1$
ctrl.setData(RWT.CUSTOM_VARIANT, "gray");
if (ctrl instanceof CBanner) {
for (Control cc : ((CBanner) ctrl).getChildren()) // $NON-NLS-1$
cc.setData(RWT.CUSTOM_VARIANT, "gray");
} else if (// $NON-NLS-1$
ctrl.getClass().getName().equals("org.eclipse.swt.widgets.Composite")) {
for (Control cc : ((Composite) ctrl).getChildren()) // $NON-NLS-1$
cc.setData(RWT.CUSTOM_VARIANT, "gray");
}
}
// $NON-NLS-1$
shell.getMenuBar().setData(RWT.CUSTOM_VARIANT, "menuBar");
}
use of org.eclipse.ui.internal.keys.BindingService in project translationstudio8 by heartsome.
the class KeyController2 method filterDupliteBind.
@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()]));
}
use of org.eclipse.ui.internal.keys.BindingService in project translationstudio8 by heartsome.
the class KeyAssistHandler method execute.
public Object execute(ExecutionEvent event) throws ExecutionException {
final IWorkbench workbench = PlatformUI.getWorkbench();
IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class);
BindingService service = (BindingService) bindingService;
ArrayList<Binding> lstBinding = new ArrayList<Binding>(Arrays.asList(bindingService.getBindings()));
List<String> lstRemove = Constants.lstRemove;
Iterator<Binding> it = lstBinding.iterator();
while (it.hasNext()) {
Binding binding = it.next();
ParameterizedCommand pCommand = binding.getParameterizedCommand();
if (pCommand == null || lstRemove.contains(pCommand.getCommand().getId())) {
it.remove();
}
}
service.getKeyboard().openKeyAssistShell(lstBinding);
return null;
}
use of org.eclipse.ui.internal.keys.BindingService in project netxms by netxms.
the class ApplicationWorkbenchWindowAdvisor method postWindowCreate.
/* (non-Javadoc)
* @see org.eclipse.ui.application.WorkbenchWindowAdvisor#postWindowCreate()
*/
@Override
public void postWindowCreate() {
super.postWindowCreate();
NXCSession session = (NXCSession) ConsoleSharedData.getSession();
// Changes the page title at runtime
JavaScriptExecutor executor = RWT.getClient().getService(JavaScriptExecutor.class);
if (executor != null) {
StringBuilder js = new StringBuilder();
// $NON-NLS-1$
js.append("document.title = ");
js.append("\"");
js.append(BrandingManager.getInstance().getProductName());
js.append(" - [");
js.append(session.getUserName());
js.append("@");
js.append(session.getServerAddress());
js.append("]");
js.append("\"");
executor.execute(js.toString());
}
BindingService service = (BindingService) getWindowConfigurer().getWindow().getWorkbench().getService(IBindingService.class);
BindingManager bindingManager = service.getBindingManager();
try {
// $NON-NLS-1$
bindingManager.setActiveScheme(service.getScheme("org.netxms.ui.eclipse.defaultKeyBinding"));
} catch (NotDefinedException e) {
e.printStackTrace();
}
final Shell shell = getWindowConfigurer().getWindow().getShell();
shell.setMaximized(true);
for (Control ctrl : shell.getChildren()) {
// $NON-NLS-1$
ctrl.setData(RWT.CUSTOM_VARIANT, "gray");
if (ctrl instanceof CBanner) {
for (Control cc : ((CBanner) ctrl).getChildren()) // $NON-NLS-1$
cc.setData(RWT.CUSTOM_VARIANT, "gray");
} else if (// $NON-NLS-1$
ctrl.getClass().getName().equals("org.eclipse.swt.widgets.Composite")) {
for (Control cc : ((Composite) ctrl).getChildren()) // $NON-NLS-1$
cc.setData(RWT.CUSTOM_VARIANT, "gray");
}
}
Menu menuBar = shell.getMenuBar();
if (menuBar != null)
// $NON-NLS-1$
menuBar.setData(RWT.CUSTOM_VARIANT, "menuBar");
}
Aggregations