Search in sources :

Example 11 with IContributionManager

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

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

Example 12 with IContributionManager

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

the class ServerNameStatusLineItem method setServerInfo.

/**
 * 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 setServerInfo(String name, String color) {
    serverName = name;
    serverColor = (color != null) ? ColorConverter.parseColorDefinition(color) : null;
    if (label != null && !label.isDisposed()) {
        label.setText(serverName);
        setColors();
    }
    // 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 13 with IContributionManager

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

the class ObjectPropertiesEditor method createPartControl.

@Override
public void createPartControl(Composite parent) {
    // Add lazy props listener
    // PropertiesContributor.getInstance().addLazyListener(this);
    pageControl = new ObjectEditorPageControl(parent, SWT.SHEET, this) {

        @Override
        public void fillCustomActions(IContributionManager contributionManager) {
            createPropertyRefreshAction(contributionManager);
            super.fillCustomActions(contributionManager);
            if (propertiesPanel != null && folderComposite == null) {
                // We have object editor and no folders - contribute default actions
                DatabaseEditorUtils.contributeStandardEditorActions(getSite(), contributionManager);
            }
        }
    };
    CSSUtils.setCSSClass(pageControl, DBStyles.COLORED_BY_CONNECTION_TYPE);
    pageControl.setShowDivider(true);
    mainComposite = new Composite(pageControl, SWT.NONE);
    GridLayout gl = new GridLayout(1, false);
    gl.verticalSpacing = 5;
    gl.horizontalSpacing = 0;
    gl.marginHeight = 0;
    gl.marginWidth = 0;
    mainComposite.setLayout(gl);
    mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    pageControl.createProgressPanel();
    curFolderId = getEditorInput().getDefaultFolderId();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ObjectEditorPageControl(org.jkiss.dbeaver.ui.controls.ObjectEditorPageControl) GridData(org.eclipse.swt.layout.GridData) IContributionManager(org.eclipse.jface.action.IContributionManager)

Example 14 with IContributionManager

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

the class ExasolLockEditor method createLockViewer.

@SuppressWarnings("unchecked")
@Override
protected LockManagerViewer createLockViewer(DBCExecutionContext executionContext, Composite parent) {
    @SuppressWarnings("rawtypes") DBAServerLockManager<DBAServerLock, DBAServerLockItem> lockManager = (DBAServerLockManager) new ExasolLockManager((ExasolDataSource) executionContext.getDataSource());
    return new LockManagerViewer(this, parent, lockManager) {

        @Override
        protected void contributeToToolbar(DBAServerLockManager<DBAServerLock, DBAServerLockItem> sessionManager, IContributionManager contributionManager) {
            contributionManager.add(new Separator());
        }

        @SuppressWarnings("serial")
        @Override
        protected void onLockSelect(final DBAServerLock lock) {
            super.onLockSelect(lock);
            if (lock != null) {
                final ExasolLock pLock = (ExasolLock) lock;
                super.refreshDetail(new HashMap<String, Object>() {

                    {
                        put(sidHold, BigInteger.valueOf(pLock.getHold_sid()));
                        put(sidWait, BigInteger.valueOf(pLock.getWait_sid().longValue()));
                    }
                });
            }
        }
    };
}
Also used : DBAServerLockItem(org.jkiss.dbeaver.model.admin.locks.DBAServerLockItem) ExasolLockManager(org.jkiss.dbeaver.ext.exasol.model.lock.ExasolLockManager) ExasolLock(org.jkiss.dbeaver.ext.exasol.model.lock.ExasolLock) DBAServerLock(org.jkiss.dbeaver.model.admin.locks.DBAServerLock) DBAServerLockManager(org.jkiss.dbeaver.model.admin.locks.DBAServerLockManager) ExasolDataSource(org.jkiss.dbeaver.ext.exasol.model.ExasolDataSource) LockManagerViewer(org.jkiss.dbeaver.ext.ui.locks.manage.LockManagerViewer) IContributionManager(org.eclipse.jface.action.IContributionManager) Separator(org.eclipse.jface.action.Separator)

Example 15 with IContributionManager

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

the class OracleSessionEditor method createSessionViewer.

@Override
protected SessionManagerViewer createSessionViewer(DBCExecutionContext executionContext, Composite parent) {
    return new SessionManagerViewer<OracleServerSession>(this, parent, new OracleServerSessionManager((OracleDataSource) executionContext.getDataSource())) {

        private boolean showBackground;

        private boolean showInactive;

        @Override
        protected void contributeToToolbar(DBAServerSessionManager sessionManager, IContributionManager contributionManager) {
            contributionManager.add(killSessionAction);
            contributionManager.add(disconnectSessionAction);
            contributionManager.add(new Separator());
            contributionManager.add(ActionUtils.makeActionContribution(new Action("Show background", Action.AS_CHECK_BOX) {

                {
                    setImageDescriptor(DBeaverIcons.getImageDescriptor(UIIcon.CONFIGURATION));
                    setToolTipText("Show background tasks");
                    setChecked(showBackground);
                }

                @Override
                public void run() {
                    showBackground = isChecked();
                    refreshPart(OracleSessionEditor.this, true);
                }
            }, true));
            contributionManager.add(ActionUtils.makeActionContribution(new Action("Show inactive", Action.AS_CHECK_BOX) {

                {
                    setImageDescriptor(DBeaverIcons.getImageDescriptor(UIIcon.CONFIGURATION));
                    setToolTipText("Show inactive sessions");
                    setChecked(showInactive);
                }

                @Override
                public void run() {
                    showInactive = isChecked();
                    refreshPart(OracleSessionEditor.this, true);
                }
            }, true));
        }

        @Override
        protected void onSessionSelect(DBAServerSession session) {
            super.onSessionSelect(session);
            killSessionAction.setEnabled(session != null);
            disconnectSessionAction.setEnabled(session != null);
        }

        @Override
        protected void loadSettings(IDialogSettings settings) {
            showBackground = CommonUtils.toBoolean(settings.get("showBackground"));
            showInactive = CommonUtils.toBoolean(settings.get("showInactive"));
            super.loadSettings(settings);
        }

        @Override
        protected void saveSettings(IDialogSettings settings) {
            super.saveSettings(settings);
            settings.put("showBackground", showBackground);
            settings.put("showInactive", showInactive);
        }

        @Override
        public Map<String, Object> getSessionOptions() {
            Map<String, Object> options = new HashMap<>();
            if (showBackground) {
                options.put(OracleServerSessionManager.OPTION_SHOW_BACKGROUND, true);
            }
            if (showInactive) {
                options.put(OracleServerSessionManager.OPTION_SHOW_INACTIVE, true);
            }
            return options;
        }
    };
}
Also used : Action(org.eclipse.jface.action.Action) DBAServerSession(org.jkiss.dbeaver.model.admin.sessions.DBAServerSession) HashMap(java.util.HashMap) OracleDataSource(org.jkiss.dbeaver.ext.oracle.model.OracleDataSource) SessionManagerViewer(org.jkiss.dbeaver.ui.views.session.SessionManagerViewer) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) DBAServerSessionManager(org.jkiss.dbeaver.model.admin.sessions.DBAServerSessionManager) OracleServerSessionManager(org.jkiss.dbeaver.ext.oracle.model.session.OracleServerSessionManager) 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