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.tools.messaging.editors.MessagesMasterBlock.java

License:Open Source License

public void updateBlockOnSelectionChange(IMessageViewerExtension newViewerExt) {
    IToolBarManager toolBar = getToolBarManager();
    Collection<Action> actions = null;
    if (currentViewerExt != null) {
        actions = currentViewerExt.getActions();
        for (Action action : actions) {
            toolBar.remove(new ActionContributionItem(action));
        }/*from   ww  w . j  a v a2s.co m*/
    }
    currentViewerExt = newViewerExt;
    actions = currentViewerExt.getActions();
    for (Action action : actions) {
        toolBar.add(new ActionContributionItem(action));
    }
    toolBar.update(true);
}

From source file:org.jboss.tools.central.editors.JBossCentralEditor.java

License:Open Source License

@Override
protected void createHeaderContents(IManagedForm headerForm) {
    final ScrolledForm form = headerForm.getForm();
    //form.setText(JBOSS_CENTRAL);
    new HeaderText(form);
    form.setToolTipText(JBOSS_CENTRAL);/*  ww w .j av  a  2s . c  o  m*/
    form.setImage(getHeaderImage());
    getToolkit().decorateFormHeading(form.getForm());

    final IToolBarManager toolbar = form.getToolBarManager();
    ControlContribution searchControl = new ControlContribution("Search") {
        @Override
        protected Control createControl(Composite parent) {
            return createSearchControl(parent);
        }
    };
    toolbar.add(searchControl);
    toolbar.add(new GroupMarker(COMMANDS_GROUP));
    String[] commandIds = ProjectExamplesActivator.getDefault().getConfigurator().getMainToolbarCommandIds();
    for (String commandId : commandIds) {
        CommandContributionItem item = JBossCentralActivator.createContributionItem(getSite(), commandId);
        toolbar.appendToGroup(COMMANDS_GROUP, item);
    }

    toolbar.update(true);
    form.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            if (toolbar instanceof ToolBarManager) {
                ((ToolBarManager) toolbar).dispose();
            } else {
                toolbar.removeAll();
            }
            form.removeDisposeListener(this);
        }
    });
    form.layout(true, true);
}

From source file:org.jboss.tools.jmx.jvmmonitor.internal.ui.properties.AbstractJvmPropertySection.java

License:Open Source License

/**
 * Deactivates the section./*  ww  w  .jav a2 s  .  c om*/
 */
protected void deactivateSection() {
    isSectionActivated = false;
    if (pageBook.isDisposed() || messagePage.isDisposed() || messageLabel.isDisposed()) {
        return;
    }

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

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

    // clear status line
    clearStatusLine();
}

From source file:org.jboss.tools.jmx.jvmmonitor.internal.ui.properties.AbstractJvmPropertySection.java

License:Open Source License

/**
 * Adds the tool bar actions.//from  ww w  .j  a  v a 2 s  . co  m
 */
private void addToolBarActions() {
    IToolBarManager toolBarManager = getToolBarManager();
    if (toolBarManager != null) {
        addToolBarActions(toolBarManager);
        toolBarManager.update(false);
        updateActionBars();
    }
}

From source file:org.jboss.tools.jmx.jvmmonitor.internal.ui.properties.memory.HeapHistogramPage.java

License:Open Source License

/**
 * Updates the local tool bar.//from   w  w  w .  j  av a 2s . c  o  m
 * 
 * @param activated
 *            <tt>true</tt> if this tab item is activated
 */
void updateLocalToolBar(boolean activated) {
    IToolBarManager manager = section.getActionBars().getToolBarManager();
    if (activated) {
        addToolBarActions(manager);
    } else {
        removeToolBarActions(manager);
    }

    manager.update(false);
    section.getActionBars().updateActionBars();
}

From source file:org.kalypso.gml.ui.coverage.CoverageManagementWidget.java

License:Open Source License

/**
 * initializes the button action for the style panel.
 *///from  w  w  w.  ja  v  a 2s. c om
private void initalizeColorMapActions(final IToolBarManager manager) {
    addAction(manager, new CoverageColorRangeAction(this));

    manager.update(true);
}

From source file:org.kalypso.gml.ui.coverage.CoverageManagementWidget.java

License:Open Source License

private void initalizeCoverageActions(final IToolBarManager manager) {
    /* Add the default actions. */
    addDefaultActions(manager);//from  w ww.  ja  v  a  2  s.c  om

    /* Add actions registered by the extension point. */
    addExtensionActions(manager);

    /* Add the custom actions. */
    addCustomActions(manager);

    /* Update the toolbar manager. */
    manager.update(true);
}

From source file:org.kalypso.model.wspm.pdb.ui.internal.content.PdbView.java

License:Open Source License

@Override
public void createPartControl(final Composite parent) {
    m_toolkit = ToolkitUtils.createToolkit(parent);

    m_form = m_toolkit.createForm(parent);
    m_toolkit.decorateFormHeading(m_form);

    m_form.setImage(getFormImage());// ww  w  .jav  a2  s . c o m
    m_form.setText(getFormTitel());

    m_form.addMessageHyperlinkListener(m_statusListener);

    final IToolBarManager formToolbar = m_form.getToolBarManager();
    formToolbar.add(m_infoAction);
    formToolbar.add(m_disconnectAction);
    formToolbar.update(true);

    final Composite body = m_form.getBody();
    body.setLayout(new FillLayout());

    m_updateControlJob.schedule(250);

    PlatformUI.getWorkbench().getHelpSystem().setHelp(m_form, IPdbHelp.CONTEXT_PDB_USER_MANUAL);
}

From source file:org.kalypso.ui.editor.styleeditor.SLDComposite.java

License:Open Source License

public SLDComposite(final Composite parent) {
    super(parent, SWT.NONE);

    setLayout(new FillLayout());

    m_toolkit = ToolkitUtils.createToolkit(this);

    m_form = m_toolkit.createForm(this);
    m_form.setText(Messages.getString("org.kalypso.ui.editor.styleeditor.SLDEditorGuiBuilder.1")); //$NON-NLS-1$

    final Composite body = m_form.getBody();
    body.setLayout(new FillLayout());

    final IToolBarManager toolBarManager = m_form.getToolBarManager();
    toolBarManager.add(m_resetAction);/*  w w  w . ja v a  2  s  .  c  o  m*/
    toolBarManager.add(m_saveAction);
    toolBarManager.update(true);

    setInput(null);
}

From source file:org.locationtech.udig.style.sld.SLDConfigurator.java

License:Open Source License

protected void refresh() {
    Layer layer = getLayer();// w  ww . java  2s.com
    if (!canStyle(layer)) {
        throw new IllegalStateException("Hey I can't style " + layer); //$NON-NLS-1$
    }
    // pull the sld style off the blackboard, and initialize the cm
    Style style = (Style) getStyleBlackboard().get(SLDContent.ID);

    // if no style information, create default
    if (style == null) {
        style = SLDContent.createDefaultStyle();
        getStyleBlackboard().put(SLDContent.ID, style);
    }
    sldContentManager.init(SLDContent.getStyleBuilder(), style);

    // pull the feature type name out of the layer
    if (layer.getSchema() != null) {
        SimpleFeatureType featureType = layer.getSchema();

        //set the name of the feature type style for the feature renderer
        String name = featureType.getName().getLocalPart();
        sldContentManager.getDefaultFeatureTypeStyle().setFeatureTypeName(SLDs.GENERIC_FEATURE_TYPENAME);
    }

    // force the toolbar to refresh
    //
    IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager();
    tbm.markDirty();
    tbm.update(true);
    getViewSite().getActionBars().updateActionBars();

    for (IContributionItem item : tbm.getItems()) {
        ActionContributionItem action = (ActionContributionItem) item;
        action.getAction().setEnabled(action.getAction().isEnabled());
    }

    // focus the active editor if any exisits
    SLDEditorPart editor = (SLDEditorPart) editorBook.getData();
    List<Class> supported = SLD.getSupportedTypes(layer);
    if (editor != null) {
        if (supported.contains(editor.getContentType())) {
            initEditor(editor);
            editor.reset();
            return; // current editor is still okay
        }
    }
    // if we get here the current editor wasn't applicable, show first that works
    for (Class type : classToEditors.keySet()) {
        if (!supported.contains(type))
            continue;

        for (SLDEditorPart part : classToEditors.get(type)) {
            initEditor(part); // FIXME: we don't want the editor to have content it should not
            part.reset();
            editorBook.setData(part);
            editorBook.showPage(part.getPage());
            part.getPage().setVisible(true);
            return;
        }
    }
    editorBook.showPage(blank);

}