Search in sources :

Example 6 with IContributionManager

use of org.eclipse.jface.action.IContributionManager in project yamcs-studio by yamcs.

the class StatusLineContributionItem method updateManager.

private void updateManager() {
    if (this.text.length() == 0) {
        if (isVisible()) {
            setVisible(false);
            IContributionManager contributionManager = getParent();
            if (contributionManager != null) {
                contributionManager.update(true);
            }
        }
    } else {
        // Always update if using 'CALC_TRUE_WIDTH'
        if (!isVisible() || charWidth == CALC_TRUE_WIDTH) {
            setVisible(true);
            IContributionManager contributionManager = getParent();
            if (contributionManager != null) {
                contributionManager.update(true);
            }
        }
    }
}
Also used : IContributionManager(org.eclipse.jface.action.IContributionManager)

Example 7 with IContributionManager

use of org.eclipse.jface.action.IContributionManager in project jbosstools-openshift by jbosstools.

the class UIUtils method registerContributionManager.

/**
 * Register a {@link ContributionManager}. The contribution manager gets
 * unregistered on control disposal
 *
 * @param id
 *            the id
 * @param contributionManager
 *            the contribution manager
 * @param control
 *            the control
 *
 * @see ContributionManager
 * @see IMenuService
 * @see DisposeListener
 */
public static void registerContributionManager(final String id, final IContributionManager contributionManager, final Control control) {
    Assert.isNotNull(id);
    Assert.isNotNull(contributionManager);
    Assert.isTrue(control != null && !control.isDisposed());
    final IMenuService menuService = (IMenuService) PlatformUI.getWorkbench().getService(IMenuService.class);
    menuService.populateContributionManager((ContributionManager) contributionManager, id);
    contributionManager.update(true);
    control.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            menuService.releaseContributions((ContributionManager) contributionManager);
        }
    });
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) IMenuService(org.eclipse.ui.menus.IMenuService) IContributionManager(org.eclipse.jface.action.IContributionManager) ContributionManager(org.eclipse.jface.action.ContributionManager) DisposeEvent(org.eclipse.swt.events.DisposeEvent)

Example 8 with IContributionManager

use of org.eclipse.jface.action.IContributionManager in project webtools.sourceediting by eclipse.

the class ViewerTestHTML method createPartControl.

/**
 * @see org.eclipse.ui.IWorkbenchPart#createPartControl(Composite)
 */
public void createPartControl(Composite parent) {
    IContributionManager mgr = getViewSite().getActionBars().getMenuManager();
    addActions(mgr);
    // create source viewer & its content type-specific viewer
    // configuration
    fSourceViewer = new StructuredTextViewer(parent, null, null, false, SWT.NONE);
    fConfig = new StructuredTextViewerConfigurationHTML();
    // set up the viewer with a document & viewer config
    setupViewerForNew();
    setupViewerPreferences();
}
Also used : StructuredTextViewerConfigurationHTML(org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML) StructuredTextViewer(org.eclipse.wst.sse.ui.internal.StructuredTextViewer) IContributionManager(org.eclipse.jface.action.IContributionManager)

Example 9 with IContributionManager

use of org.eclipse.jface.action.IContributionManager in project webtools.sourceediting by eclipse.

the class ConfigurableContentOutlinePage method setConfiguration.

/**
 * Configures (or reconfigures) the page according to the given
 * configuration.
 *
 * @param configuration
 */
public void setConfiguration(ContentOutlineConfiguration configuration) {
    // intentionally do not check to see if the new configuration != old
    // configuration
    unconfigure();
    fConfiguration = configuration;
    if (getTreeViewer() != null && getControl() != null && !getControl().isDisposed()) {
        // (re)set the providers
        ILabelProvider labelProvider = getConfiguration().getLabelProvider(getTreeViewer());
        if (labelProvider instanceof IStyledLabelProvider) {
            getTreeViewer().setLabelProvider(new DelegatingStyledCellLabelProvider((IStyledLabelProvider) labelProvider));
        } else {
            getTreeViewer().setLabelProvider(labelProvider);
        }
        getTreeViewer().setContentProvider(getConfiguration().getContentProvider(getTreeViewer()));
        // view toolbar
        IContributionManager toolbar = getSite().getActionBars().getToolBarManager();
        if (toolbar != null) {
            IContributionItem[] toolbarItems = getConfiguration().getToolbarContributions(getTreeViewer());
            if (toolbarItems != null) {
                for (int i = 0; i < toolbarItems.length; i++) {
                    toolbar.add(toolbarItems[i]);
                }
                toolbar.update(true);
            }
        }
        // view menu
        IContributionManager menu = getSite().getActionBars().getMenuManager();
        if (menu != null) {
            IContributionItem[] menuItems = getConfiguration().getMenuContributions(getTreeViewer());
            if (menuItems != null) {
                for (int i = 0; i < menuItems.length; i++) {
                    menuItems[i].setVisible(true);
                    menu.add(menuItems[i]);
                    menuItems[i].update();
                }
                menu.update(true);
            }
        }
        // add the allowed DnD listeners and types
        TransferDragSourceListener[] dragListeners = getConfiguration().getTransferDragSourceListeners(getTreeViewer());
        if (fDragAdapter != null && dragListeners.length > 0) {
            for (int i = 0; i < dragListeners.length; i++) {
                fDragAdapter.addDragSourceListener(dragListeners[i]);
            }
            fActiveDragListeners = dragListeners;
            fDragSource.addDragListener(fDragAdapter);
            fDragSource.setTransfer(fDragAdapter.getTransfers());
        }
        TransferDropTargetListener[] dropListeners = getConfiguration().getTransferDropTargetListeners(getTreeViewer());
        if (fDropAdapter != null && dropListeners.length > 0) {
            for (int i = 0; i < dropListeners.length; i++) {
                fDropAdapter.addDropTargetListener(dropListeners[i]);
            }
            fActiveDropListeners = dropListeners;
            fDropTarget.addDropListener(fDropAdapter);
            fDropTarget.setTransfer(fDropAdapter.getTransfers());
        }
        // add the key listeners
        KeyListener[] listeners = getConfiguration().getKeyListeners(getTreeViewer());
        if (listeners != null) {
            for (int i = 0; i < listeners.length; i++) {
                getControl().addKeyListener(listeners[i]);
            }
        }
    }
    if (fInput != null) {
        setInput(fInput);
    }
}
Also used : IContributionItem(org.eclipse.jface.action.IContributionItem) TransferDragSourceListener(org.eclipse.jface.util.TransferDragSourceListener) TransferDropTargetListener(org.eclipse.jface.util.TransferDropTargetListener) ILabelProvider(org.eclipse.jface.viewers.ILabelProvider) IStyledLabelProvider(org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider) KeyListener(org.eclipse.swt.events.KeyListener) DelegatingStyledCellLabelProvider(org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider) IContributionManager(org.eclipse.jface.action.IContributionManager)

Example 10 with IContributionManager

use of org.eclipse.jface.action.IContributionManager in project webtools.sourceediting by eclipse.

the class ViewerTestJSP method createPartControl.

/**
 * @see org.eclipse.ui.IWorkbenchPart#createPartControl(Composite)
 */
public void createPartControl(Composite parent) {
    IContributionManager mgr = getViewSite().getActionBars().getMenuManager();
    addActions(mgr);
    // create source viewer & its content type-specific viewer
    // configuration
    fSourceViewer = new StructuredTextViewer(parent, null, null, false, SWT.NONE);
    fConfig = new StructuredTextViewerConfigurationJSP();
    // set up the viewer with a document & viewer config
    setupViewerForNew();
    setupViewerPreferences();
}
Also used : StructuredTextViewerConfigurationJSP(org.eclipse.jst.jsp.ui.StructuredTextViewerConfigurationJSP) StructuredTextViewer(org.eclipse.wst.sse.ui.internal.StructuredTextViewer) IContributionManager(org.eclipse.jface.action.IContributionManager)

Aggregations

IContributionManager (org.eclipse.jface.action.IContributionManager)52 Separator (org.eclipse.jface.action.Separator)31 DBAServerSession (org.jkiss.dbeaver.model.admin.sessions.DBAServerSession)22 DBAServerSessionManager (org.jkiss.dbeaver.model.admin.sessions.DBAServerSessionManager)22 SessionManagerViewer (org.jkiss.dbeaver.ui.views.session.SessionManagerViewer)22 Action (org.eclipse.jface.action.Action)9 IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)8 ExasolDataSource (org.jkiss.dbeaver.ext.exasol.model.ExasolDataSource)7 PostgreDataSource (org.jkiss.dbeaver.ext.postgresql.model.PostgreDataSource)7 LockManagerViewer (org.jkiss.dbeaver.ext.ui.locks.manage.LockManagerViewer)7 DBAServerLock (org.jkiss.dbeaver.model.admin.locks.DBAServerLock)7 DBAServerLockItem (org.jkiss.dbeaver.model.admin.locks.DBAServerLockItem)7 DBAServerLockManager (org.jkiss.dbeaver.model.admin.locks.DBAServerLockManager)7 Composite (org.eclipse.swt.widgets.Composite)6 GridData (org.eclipse.swt.layout.GridData)5 OracleDataSource (org.jkiss.dbeaver.ext.oracle.model.OracleDataSource)5 HashMap (java.util.HashMap)4 DB2DataSource (org.jkiss.dbeaver.ext.db2.model.DB2DataSource)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)3 ArrayList (java.util.ArrayList)3