Search in sources :

Example 36 with IContributionManager

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

the class ConfigurableContentOutlinePage method unconfigure.

/**
 * Unconfigure the content outline page
 */
private void unconfigure() {
    if (getTreeViewer() != null) {
        // remove the key listeners
        if (getControl() != null && !getControl().isDisposed()) {
            KeyListener[] listeners = getConfiguration().getKeyListeners(getTreeViewer());
            if (listeners != null) {
                for (int i = 0; i < listeners.length; i++) {
                    getControl().removeKeyListener(listeners[i]);
                }
            }
        }
        IContributionManager toolbar = getSite().getActionBars().getToolBarManager();
        if (toolbar != null && !toolbar.isEmpty()) {
            IContributionItem[] toolbarItems = getConfiguration().getToolbarContributions(getTreeViewer());
            if (toolbarItems != null && toolbarItems.length > 0) {
                for (int i = 0; i < toolbarItems.length; i++) {
                    toolbar.remove(toolbarItems[i]);
                }
                toolbar.update(false);
            }
        }
        IContributionManager menubar = getSite().getActionBars().getMenuManager();
        if (menubar != null && !menubar.isEmpty()) {
            IContributionItem[] menuItems = getConfiguration().getMenuContributions(getTreeViewer());
            if (menuItems != null && menuItems.length > 0) {
                for (int i = 0; i < menuItems.length; i++) {
                    menubar.remove(menuItems[i]);
                }
                menubar.remove(IWorkbenchActionConstants.MB_ADDITIONS);
                menubar.update(false);
            }
        }
        // clear the DnD listeners and transfer types
        if (fDragAdapter != null && !fDragAdapter.isEmpty() && fDragSource != null && !fDragSource.isDisposed() && fDragSource.getTransfer().length > 0) {
            if (fActiveDragListeners != null) {
                for (int i = 0; i < fActiveDragListeners.length; i++) {
                    fDragAdapter.removeDragSourceListener(fActiveDragListeners[i]);
                }
            }
            fActiveDragListeners = null;
            fDragSource.removeDragListener(fDragAdapter);
            fDragSource.setTransfer(new Transfer[0]);
        }
        if (fDropAdapter != null && !fDropAdapter.isEmpty() && fDropTarget != null && !fDropTarget.isDisposed() && fDropTarget.getTransfer().length > 0) {
            if (fActiveDropListeners != null) {
                for (int i = 0; i < fActiveDropListeners.length; i++) {
                    fDropAdapter.removeDropTargetListener(fActiveDropListeners[i]);
                }
            }
            fActiveDropListeners = null;
            fDropTarget.removeDropListener(fDropAdapter);
            fDropTarget.setTransfer(new Transfer[0]);
        }
        getConfiguration().getContentProvider(getTreeViewer()).inputChanged(getTreeViewer(), fInput, null);
        // release any ties to this tree viewer
        getConfiguration().unconfigure(getTreeViewer());
    }
}
Also used : IContributionItem(org.eclipse.jface.action.IContributionItem) KeyListener(org.eclipse.swt.events.KeyListener) IContributionManager(org.eclipse.jface.action.IContributionManager)

Example 37 with IContributionManager

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

the class ViewerTestXML 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 StructuredTextViewerConfigurationXML();
    // set up the viewer with a document & viewer config
    setupViewerForNew();
    setupViewerPreferences();
}
Also used : StructuredTextViewerConfigurationXML(org.eclipse.wst.xml.ui.StructuredTextViewerConfigurationXML) StructuredTextViewer(org.eclipse.wst.sse.ui.internal.StructuredTextViewer) IContributionManager(org.eclipse.jface.action.IContributionManager)

Example 38 with IContributionManager

use of org.eclipse.jface.action.IContributionManager in project netxms by netxms.

the class StatusLineContributionItem method setText.

/**
 * Sets the text to be displayed in the status line.
 *
 * @param text the text to be displayed, must not be <code>null</code>
 */
public void setText(String text) {
    this.text = LegacyActionTools.escapeMnemonics(text);
    if (label != null && !label.isDisposed()) {
        label.setText(this.text);
    }
    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 39 with IContributionManager

use of org.eclipse.jface.action.IContributionManager in project netxms by netxms.

the class StatusLineContributionItem method setImage.

/**
 * @param image
 */
public void setImage(Image image) {
    this.image = image;
    if (label != null && !label.isDisposed()) {
        label.setImage(image);
        IContributionManager contributionManager = getParent();
        if (contributionManager != null) {
            contributionManager.update(true);
        }
    }
}
Also used : IContributionManager(org.eclipse.jface.action.IContributionManager)

Example 40 with IContributionManager

use of org.eclipse.jface.action.IContributionManager in project dbeaver by serge-rider.

the class DB2ServerApplicationEditor method createSessionViewer.

@Override
protected SessionManagerViewer createSessionViewer(DBCExecutionContext executionContext, Composite parent) {
    return new SessionManagerViewer<DB2ServerApplication>(this, parent, new DB2ServerApplicationManager((DB2DataSource) executionContext.getDataSource())) {

        @Override
        @SuppressWarnings("rawtypes")
        protected void contributeToToolbar(DBAServerSessionManager sessionManager, IContributionManager contributionManager) {
            contributionManager.add(forceApplicationAction);
            contributionManager.add(new Separator());
        }

        @Override
        protected void onSessionSelect(DBAServerSession session) {
            super.onSessionSelect(session);
            forceApplicationAction.setEnabled(session != null);
        }
    };
}
Also used : SessionManagerViewer(org.jkiss.dbeaver.ui.views.session.SessionManagerViewer) DBAServerSession(org.jkiss.dbeaver.model.admin.sessions.DBAServerSession) DB2DataSource(org.jkiss.dbeaver.ext.db2.model.DB2DataSource) DBAServerSessionManager(org.jkiss.dbeaver.model.admin.sessions.DBAServerSessionManager) DB2ServerApplicationManager(org.jkiss.dbeaver.ext.db2.model.app.DB2ServerApplicationManager) IContributionManager(org.eclipse.jface.action.IContributionManager) Separator(org.eclipse.jface.action.Separator)

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