Search in sources :

Example 1 with CBanner

use of org.eclipse.swt.custom.CBanner 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");
}
Also used : BindingManager(org.eclipse.jface.bindings.BindingManager) Shell(org.eclipse.swt.widgets.Shell) Control(org.eclipse.swt.widgets.Control) IBindingService(org.eclipse.ui.keys.IBindingService) BindingService(org.eclipse.ui.internal.keys.BindingService) CBanner(org.eclipse.swt.custom.CBanner) NotDefinedException(org.eclipse.core.commands.common.NotDefinedException) IBindingService(org.eclipse.ui.keys.IBindingService)

Example 2 with CBanner

use of org.eclipse.swt.custom.CBanner 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");
}
Also used : BindingManager(org.eclipse.jface.bindings.BindingManager) Shell(org.eclipse.swt.widgets.Shell) Control(org.eclipse.swt.widgets.Control) NXCSession(org.netxms.client.NXCSession) BindingService(org.eclipse.ui.internal.keys.BindingService) IBindingService(org.eclipse.ui.keys.IBindingService) CBanner(org.eclipse.swt.custom.CBanner) JavaScriptExecutor(org.eclipse.rap.rwt.client.service.JavaScriptExecutor) NotDefinedException(org.eclipse.core.commands.common.NotDefinedException) Menu(org.eclipse.swt.widgets.Menu) IBindingService(org.eclipse.ui.keys.IBindingService)

Aggregations

NotDefinedException (org.eclipse.core.commands.common.NotDefinedException)2 BindingManager (org.eclipse.jface.bindings.BindingManager)2 CBanner (org.eclipse.swt.custom.CBanner)2 Control (org.eclipse.swt.widgets.Control)2 Shell (org.eclipse.swt.widgets.Shell)2 BindingService (org.eclipse.ui.internal.keys.BindingService)2 IBindingService (org.eclipse.ui.keys.IBindingService)2 JavaScriptExecutor (org.eclipse.rap.rwt.client.service.JavaScriptExecutor)1 Menu (org.eclipse.swt.widgets.Menu)1 NXCSession (org.netxms.client.NXCSession)1