Search in sources :

Example 11 with DBAServerSession

use of org.jkiss.dbeaver.model.admin.sessions.DBAServerSession in project dbeaver by dbeaver.

the class MySQLSessionEditor method createSessionViewer.

@Override
protected SessionManagerViewer createSessionViewer(DBCExecutionContext executionContext, Composite parent) {
    return new SessionManagerViewer<MySQLSession>(this, parent, new MySQLSessionManager((MySQLDataSource) executionContext.getDataSource())) {

        private boolean hideSleeping;

        @Override
        protected void contributeToToolbar(DBAServerSessionManager sessionManager, IContributionManager contributionManager) {
            contributionManager.add(killSessionAction);
            contributionManager.add(terminateQueryAction);
            contributionManager.add(new Separator());
            contributionManager.add(new ControlContribution("MySQLSessionHideSleep") {

                @Override
                protected Control createControl(Composite parent) {
                    Button hideSleepingCheck = UIUtils.createCheckbox(parent, "Hide sleeping", "Show only active connections", hideSleeping, 0);
                    hideSleepingCheck.addSelectionListener(new SelectionAdapter() {

                        @Override
                        public void widgetSelected(SelectionEvent e) {
                            hideSleeping = hideSleepingCheck.getSelection();
                            refreshPart(MySQLSessionEditor.this, true);
                        }
                    });
                    return hideSleepingCheck;
                }
            });
            contributionManager.add(new Separator());
        }

        @Override
        protected void onSessionSelect(DBAServerSession session) {
            super.onSessionSelect(session);
            killSessionAction.setEnabled(session != null);
            terminateQueryAction.setEnabled(session != null && !CommonUtils.isEmpty(session.getActiveQuery()));
        }

        @Override
        public Map<String, Object> getSessionOptions() {
            if (hideSleeping) {
                return Collections.singletonMap(MySQLSessionManager.OPTION_HIDE_SLEEPING, true);
            }
            return super.getSessionOptions();
        }
    };
}
Also used : DBAServerSession(org.jkiss.dbeaver.model.admin.sessions.DBAServerSession) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ControlContribution(org.eclipse.jface.action.ControlContribution) SessionManagerViewer(org.jkiss.dbeaver.ui.views.session.SessionManagerViewer) Control(org.eclipse.swt.widgets.Control) MySQLDataSource(org.jkiss.dbeaver.ext.mysql.model.MySQLDataSource) Button(org.eclipse.swt.widgets.Button) DBAServerSessionManager(org.jkiss.dbeaver.model.admin.sessions.DBAServerSessionManager) SelectionEvent(org.eclipse.swt.events.SelectionEvent) MySQLSessionManager(org.jkiss.dbeaver.ext.mysql.model.session.MySQLSessionManager) IContributionManager(org.eclipse.jface.action.IContributionManager) Separator(org.eclipse.jface.action.Separator)

Example 12 with DBAServerSession

use of org.jkiss.dbeaver.model.admin.sessions.DBAServerSession in project dbeaver by dbeaver.

the class ExasolServerSessionEditor method createSessionViewer.

@Override
protected SessionManagerViewer createSessionViewer(DBCExecutionContext executionContext, Composite parent) {
    return new SessionManagerViewer<ExasolServerSession>(this, parent, new ExasolServerSessionManager((ExasolDataSource) executionContext.getDataSource())) {

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

        @Override
        protected void onSessionSelect(DBAServerSession session) {
            super.onSessionSelect(session);
            killSessionAction.setEnabled(session != null);
            terminateQueryAction.setEnabled(session != null && !CommonUtils.isEmpty(session.getActiveQuery()));
        }
    };
}
Also used : SessionManagerViewer(org.jkiss.dbeaver.ui.views.session.SessionManagerViewer) DBAServerSession(org.jkiss.dbeaver.model.admin.sessions.DBAServerSession) DBAServerSessionManager(org.jkiss.dbeaver.model.admin.sessions.DBAServerSessionManager) ExasolDataSource(org.jkiss.dbeaver.ext.exasol.model.ExasolDataSource) IContributionManager(org.eclipse.jface.action.IContributionManager) Separator(org.eclipse.jface.action.Separator)

Example 13 with DBAServerSession

use of org.jkiss.dbeaver.model.admin.sessions.DBAServerSession in project dbeaver by dbeaver.

the class OracleSessionEditor method createSessionViewer.

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

        @Override
        protected void contributeToToolbar(DBAServerSessionManager sessionManager, IContributionManager contributionManager) {
            contributionManager.add(killSessionAction);
            contributionManager.add(disconnectSessionAction);
            contributionManager.add(new Separator());
        }

        @Override
        protected void onSessionSelect(DBAServerSession session) {
            super.onSessionSelect(session);
            killSessionAction.setEnabled(session != null);
            disconnectSessionAction.setEnabled(session != null);
        }
    };
}
Also used : SessionManagerViewer(org.jkiss.dbeaver.ui.views.session.SessionManagerViewer) DBAServerSession(org.jkiss.dbeaver.model.admin.sessions.DBAServerSession) 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)

Example 14 with DBAServerSession

use of org.jkiss.dbeaver.model.admin.sessions.DBAServerSession in project dbeaver by dbeaver.

the class PostgreSessionEditor method createSessionViewer.

@Override
protected SessionManagerViewer createSessionViewer(DBCExecutionContext executionContext, Composite parent) {
    return new SessionManagerViewer<PostgreSession>(this, parent, new PostgreSessionManager((PostgreDataSource) executionContext.getDataSource())) {

        @Override
        protected void contributeToToolbar(DBAServerSessionManager sessionManager, IContributionManager contributionManager) {
            contributionManager.add(terminateQueryAction);
            contributionManager.add(new Separator());
        }

        @Override
        protected void onSessionSelect(DBAServerSession session) {
            super.onSessionSelect(session);
            terminateQueryAction.setEnabled(session != null && !CommonUtils.isEmpty(session.getActiveQuery()));
        }
    };
}
Also used : SessionManagerViewer(org.jkiss.dbeaver.ui.views.session.SessionManagerViewer) DBAServerSession(org.jkiss.dbeaver.model.admin.sessions.DBAServerSession) PostgreDataSource(org.jkiss.dbeaver.ext.postgresql.model.PostgreDataSource) DBAServerSessionManager(org.jkiss.dbeaver.model.admin.sessions.DBAServerSessionManager) PostgreSessionManager(org.jkiss.dbeaver.ext.postgresql.model.session.PostgreSessionManager) IContributionManager(org.eclipse.jface.action.IContributionManager) Separator(org.eclipse.jface.action.Separator)

Example 15 with DBAServerSession

use of org.jkiss.dbeaver.model.admin.sessions.DBAServerSession in project dbeaver by dbeaver.

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)22 Separator (org.eclipse.jface.action.Separator)22 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)6 IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)6 HashMap (java.util.HashMap)4 DB2DataSource (org.jkiss.dbeaver.ext.db2.model.DB2DataSource)4 ExasolDataSource (org.jkiss.dbeaver.ext.exasol.model.ExasolDataSource)4 MySQLDataSource (org.jkiss.dbeaver.ext.mysql.model.MySQLDataSource)4 MySQLSessionManager (org.jkiss.dbeaver.ext.mysql.model.session.MySQLSessionManager)4 OracleServerSessionManager (org.jkiss.dbeaver.ext.oracle.model.session.OracleServerSessionManager)4 PostgreDataSource (org.jkiss.dbeaver.ext.postgresql.model.PostgreDataSource)4 PostgreSessionManager (org.jkiss.dbeaver.ext.postgresql.model.session.PostgreSessionManager)4 DB2ServerApplicationManager (org.jkiss.dbeaver.ext.db2.model.app.DB2ServerApplicationManager)2 ExasolServerSessionManager (org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSessionManager)2 SQLServerDataSource (org.jkiss.dbeaver.ext.mssql.model.SQLServerDataSource)2 SQLServerSessionManager (org.jkiss.dbeaver.ext.mssql.model.session.SQLServerSessionManager)2 OracleDataSource (org.jkiss.dbeaver.ext.oracle.model.OracleDataSource)2