Example usage for org.eclipse.jface.action IToolBarManager update

List of usage examples for org.eclipse.jface.action IToolBarManager update

Introduction

In this page you can find the example usage for org.eclipse.jface.action IToolBarManager update.

Prototype

void update(boolean force);

Source Link

Document

Updates this manager's underlying widget(s) with any changes which have been made to it or its items.

Usage

From source file:org.fusesource.ide.jvmmonitor.internal.ui.properties.AbstractJvmPropertySection.java

License:Open Source License

/**
 * Deactivates the section./*from   w  ww .jav  a2s  .c o m*/
 */
protected void deactivateSection() {
    isSectionActivated = false;
    if (pageBook.isDisposed() || errorMessageLabel.isDisposed()) {
        return;
    }

    // remove tool bar actions
    IToolBarManager toolBarManager = getToolBarManager();
    if (toolBarManager != null) {
        removeToolBarActions(toolBarManager);
        toolBarManager.update(false);
    }

    // remove local menus
    IMenuManager menuManager = getMenuManager();
    if (menuManager != null) {
        menuManager.remove(preferencesAction.getId());
        removeLocalMenus(menuManager);
        menuManager.update(false);
    }

    // clear status line
    clearStatusLine();
}

From source file:org.fusesource.ide.jvmmonitor.internal.ui.properties.AbstractJvmPropertySection.java

License:Open Source License

/**
 * Adds the tool bar actions./*from   www .  j  ava2  s.com*/
 */
private void addToolBarActions() {
    IToolBarManager toolBarManager = getToolBarManager();
    if (toolBarManager != null) {
        addToolBarActions(toolBarManager);
        toolBarManager.update(false);
    }
}

From source file:org.fusesource.ide.jvmmonitor.internal.ui.properties.memory.HeapHistogramPage.java

License:Open Source License

/**
 * Adds the tool bar actions.//from   ww  w .j  a v a 2 s .  co m
 * 
 * @param manager
 *            The tool bar manager
 */
void addToolBarActions(IToolBarManager manager) {
    manager.insertAfter("defaults", separator); //$NON-NLS-1$
    if (manager.find(refreshAction.getId()) == null) {
        manager.insertAfter("defaults", refreshAction); //$NON-NLS-1$
    }
    if (manager.find(garbageCollectorAction.getId()) == null) {
        manager.insertAfter("defaults", garbageCollectorAction); //$NON-NLS-1$
    }
    if (manager.find(clearHeapDeltaAction.getId()) == null) {
        manager.insertAfter("defaults", clearHeapDeltaAction); //$NON-NLS-1$
    }
    if (manager.find(dumpHeapAction.getId()) == null) {
        manager.insertAfter("defaults", dumpHeapAction); //$NON-NLS-1$
    }
    if (manager.find(dumpHprofAction.getId()) == null) {
        manager.insertAfter("defaults", dumpHprofAction); //$NON-NLS-1$
    }
    manager.update(true);
}

From source file:org.fusesource.ide.jvmmonitor.internal.ui.properties.memory.HeapHistogramPage.java

License:Open Source License

/**
 * Removes the tool bar actions./*  w  w w.  java2  s.c o m*/
 * 
 * @param manager
 *            The tool bar manager
 */
void removeToolBarActions(IToolBarManager manager) {
    manager.remove(separator);
    manager.remove(refreshAction.getId());
    manager.remove(garbageCollectorAction.getId());
    manager.remove(clearHeapDeltaAction.getId());
    manager.remove(dumpHeapAction.getId());
    manager.remove(dumpHprofAction.getId());
    manager.update(true);
}

From source file:org.fusesource.ide.jvmmonitor.internal.ui.properties.memory.SWTResourcesPage.java

License:Open Source License

/**
 * Adds the tool bar actions.//from   w w w.  j  a va  2s .c  o m
 * 
 * @param manager
 *            The tool bar manager
 */
void addToolBarActions(IToolBarManager manager) {
    manager.insertAfter("defaults", separator); //$NON-NLS-1$
    if (manager.find(refreshAction.getId()) == null) {
        manager.insertAfter("defaults", refreshAction); //$NON-NLS-1$
    }
    if (manager.find(clearSWTResourceAction.getId()) == null) {
        manager.insertAfter("defaults", clearSWTResourceAction); //$NON-NLS-1$
    }
    manager.update(true);
}

From source file:org.fusesource.ide.jvmmonitor.internal.ui.properties.memory.SWTResourcesPage.java

License:Open Source License

/**
 * Removes the tool bar actions.//from w  w w  .  j ava  2s. c  o m
 * 
 * @param manager
 *            The tool bar manager
 */
void removeToolBarActions(IToolBarManager manager) {
    manager.remove(separator);
    manager.remove(refreshAction.getId());
    manager.remove(clearSWTResourceAction.getId());
    manager.update(true);
}

From source file:org.fusesource.ide.jvmmonitor.internal.ui.views.JvmExplorer.java

License:Open Source License

/**
 * Creates the local tool bar./*w w  w. j a va2  s. c  o m*/
 */
private void createLocalToolBar() {
    IToolBarManager manager = getViewSite().getActionBars().getToolBarManager();
    manager.add(new NewJvmConnectionAction(treeViewer));
    manager.update(false);
}

From source file:org.fusesource.ide.zk.core.editors.DataModelFormEditor.java

License:Apache License

protected void addImageHyperlinkToolBarContribution(final IManagedForm headerForm,
        final IToolBarManager toolBarManager, final BaseControlContribution baseControlContribution,
        final DataModel<?, ?, ?> model) {

    final Separator separator = new Separator();
    toolBarManager.add(separator);// www.  j  av a  2 s .  c o  m
    toolBarManager.add(baseControlContribution);

    baseControlContribution.addControlDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {

            if (!model.isDestroyed()) {
                // Only do this clean up when the model destruction caused the widget disposal
                // WARNING: toolBarManager.update(true); throws a NullPointer if called during app exit.
                return;
            }

            toolBarManager.remove(separator);
            separator.dispose();
            toolBarManager.remove(baseControlContribution);
            toolBarManager.update(true);
        }
    });
}

From source file:org.fusesource.ide.zk.core.editors.DataModelFormEditor.java

License:Apache License

@Override
protected void createHeaderContents(IManagedForm headerForm) {
    super.createHeaderContents(headerForm);

    FormToolkit toolkit = headerForm.getToolkit();
    ScrolledForm scrolledForm = headerForm.getForm();
    Form form = scrolledForm.getForm();//  www .  j  a  va2  s. c  o m
    toolkit.decorateFormHeading(form);

    updateTitle();
    makeActions();

    IToolBarManager toolBarManager = form.getToolBarManager();
    contributeToToolBar(headerForm, toolBarManager);
    toolBarManager.update(true);

}

From source file:org.fusesource.ide.zk.core.editors.DataModelFormPage.java

License:Apache License

@Override
protected final void createFormContent(IManagedForm managedForm) {

    makeActions();/*from   w w  w.j  a v  a2s.c o m*/

    ScrolledForm form = managedForm.getForm();

    form.setText(getTitle());
    form.setImage(getImage());
    FormLayout bodyLayout = new FormLayout();
    bodyLayout.marginWidth = 0;
    bodyLayout.marginHeight = 0;

    Composite body = form.getBody();
    body.setLayout(bodyLayout);
    Dialog.applyDialogFont(body);

    _InfoBar = createInfoBar(body);

    setInfoText(getInfoText());

    _Client = createClient(managedForm, body);

    FormData clientFormData = new FormData();

    if (_InfoBar != null) {
        clientFormData.top = new FormAttachment(_InfoBar, 0, SWT.BOTTOM);
    } else {
        clientFormData.top = new FormAttachment(0, 0);
    }
    clientFormData.left = new FormAttachment(0, 0);
    clientFormData.right = new FormAttachment(100, 0);
    clientFormData.bottom = new FormAttachment(100, 0);
    _Client.setLayoutData(clientFormData);

    IToolBarManager toolBarManager = form.getToolBarManager();
    contributeToToolBar(toolBarManager);
    toolBarManager.update(true);

    if (!getModel().isDestroyed()) {
        createModelFormContent(managedForm, _Client);
        initFromModel();
    }

}