Search in sources :

Example 1 with IResultSetContainer

use of org.jkiss.dbeaver.ui.controls.resultset.IResultSetContainer in project dbeaver by serge-rider.

the class CursorViewDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    final IValueController valueController = getValueController();
    value = (DBDCursor) valueController.getValue();
    Composite dialogGroup = (Composite) super.createDialogArea(parent);
    if (value != null) {
        DBPPreferenceStore globalPreferenceStore = DBeaverCore.getGlobalPreferenceStore();
        if (!globalPreferenceStore.getBoolean(DBeaverPreferences.KEEP_STATEMENT_OPEN)) {
            if (ConfirmationDialog.showConfirmDialog(getShell(), DBeaverPreferences.CONFIRM_KEEP_STATEMENT_OPEN, ConfirmationDialog.QUESTION) == IDialogConstants.YES_ID) {
                globalPreferenceStore.setValue(DBeaverPreferences.KEEP_STATEMENT_OPEN, true);
                if (valueController.getValueSite().getPart() instanceof IResultSetContainer) {
                    IResultSetController rsv = ((IResultSetContainer) valueController.getValueSite().getPart()).getResultSetController();
                    if (rsv != null) {
                        rsv.refresh();
                    }
                }
            }
            DBeaverUI.asyncExec(new Runnable() {

                @Override
                public void run() {
                    close();
                }
            });
        }
    }
    resultSetViewer = new ResultSetViewer(dialogGroup, valueController.getValueSite(), this);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = 300;
    gd.grabExcessVerticalSpace = true;
    resultSetViewer.getControl().setLayoutData(gd);
    resultSetViewer.refresh();
    return dialogGroup;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) IResultSetContainer(org.jkiss.dbeaver.ui.controls.resultset.IResultSetContainer) GridData(org.eclipse.swt.layout.GridData) IResultSetController(org.jkiss.dbeaver.ui.controls.resultset.IResultSetController) IValueController(org.jkiss.dbeaver.ui.data.IValueController) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore) ResultSetViewer(org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer)

Aggregations

GridData (org.eclipse.swt.layout.GridData)1 Composite (org.eclipse.swt.widgets.Composite)1 DBPPreferenceStore (org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)1 IResultSetContainer (org.jkiss.dbeaver.ui.controls.resultset.IResultSetContainer)1 IResultSetController (org.jkiss.dbeaver.ui.controls.resultset.IResultSetController)1 ResultSetViewer (org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer)1 IValueController (org.jkiss.dbeaver.ui.data.IValueController)1