Search in sources :

Example 1 with DBAServerSessionDetails

use of org.jkiss.dbeaver.model.admin.sessions.DBAServerSessionDetails in project dbeaver by serge-rider.

the class SessionManagerViewer method updatePreview.

private void updatePreview() {
    if (previewFolder.getSelectionIndex() == 0) {
        // Show SQL
        detailsItem.setText(SessionEditorMessages.viewer_details_item_session_details);
        updateSQL();
        if (curSession == null) {
            sessionProps.clearProperties();
        } else {
            PropertyCollector propCollector = new PropertyCollector(curSession, true);
            propCollector.collectProperties();
            sessionProps.loadProperties(propCollector);
        }
    } else if (planViewer != null) {
        // Show execution plan
        String sqlText = curSession == null ? "" : CommonUtils.notEmpty(curSession.getActiveQuery());
        if (!CommonUtils.isEmpty(sqlText)) {
            planViewer.explainQueryPlan(new SQLQuery(sessionManager.getDataSource(), sqlText), curSession.getActiveQueryId());
        }
    }
    if (detailsFolder.getSelectionIndex() > 0) {
        CTabItem detailsItem = detailsFolder.getItem(detailsFolder.getSelectionIndex());
        Object data = detailsItem.getData();
        if (data instanceof DBAServerSessionDetails) {
            if (detailsItem.getControl() instanceof StyledText) {
                StyledText styledText = (StyledText) detailsItem.getControl();
                loadPlainTextDetails((DBAServerSessionDetails) data, styledText);
            } else {
                DetailsListControl detailsListControl = (DetailsListControl) detailsItem.getControl();
                detailsListControl.loadData();
            }
        }
    }
}
Also used : StyledText(org.eclipse.swt.custom.StyledText) DBAServerSessionDetails(org.jkiss.dbeaver.model.admin.sessions.DBAServerSessionDetails) PropertyCollector(org.jkiss.dbeaver.runtime.properties.PropertyCollector) DBPObject(org.jkiss.dbeaver.model.DBPObject) SQLQuery(org.jkiss.dbeaver.model.sql.SQLQuery) CTabItem(org.eclipse.swt.custom.CTabItem)

Example 2 with DBAServerSessionDetails

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

the class SessionManagerViewer method updatePreview.

private void updatePreview() {
    if (previewFolder.getSelectionIndex() == 0) {
        // Show SQL
        detailsItem.setText(SessionEditorMessages.viewer_details_item_session_details);
        updateSQL();
        if (curSession == null) {
            sessionProps.clearProperties();
        } else {
            PropertyCollector propCollector = new PropertyCollector(curSession, true);
            propCollector.collectProperties();
            sessionProps.loadProperties(propCollector);
        }
    } else if (planViewer != null) {
        // Show execution plan
        String sqlText = curSession == null ? "" : CommonUtils.notEmpty(curSession.getActiveQuery());
        if (!CommonUtils.isEmpty(sqlText)) {
            planViewer.explainQueryPlan(new SQLQuery(sessionManager.getDataSource(), sqlText), curSession.getActiveQueryId());
        }
    }
    if (detailsFolder.getSelectionIndex() > 0) {
        CTabItem detailsItem = detailsFolder.getItem(detailsFolder.getSelectionIndex());
        Object data = detailsItem.getData();
        if (data instanceof DBAServerSessionDetails) {
            if (detailsItem.getControl() instanceof StyledText) {
                StyledText styledText = (StyledText) detailsItem.getControl();
                loadPlainTextDetails((DBAServerSessionDetails) data, styledText);
            } else {
                DetailsListControl detailsListControl = (DetailsListControl) detailsItem.getControl();
                detailsListControl.loadData();
            }
        }
    }
}
Also used : StyledText(org.eclipse.swt.custom.StyledText) DBAServerSessionDetails(org.jkiss.dbeaver.model.admin.sessions.DBAServerSessionDetails) PropertyCollector(org.jkiss.dbeaver.runtime.properties.PropertyCollector) DBPObject(org.jkiss.dbeaver.model.DBPObject) SQLQuery(org.jkiss.dbeaver.model.sql.SQLQuery) CTabItem(org.eclipse.swt.custom.CTabItem)

Aggregations

CTabItem (org.eclipse.swt.custom.CTabItem)2 StyledText (org.eclipse.swt.custom.StyledText)2 DBPObject (org.jkiss.dbeaver.model.DBPObject)2 DBAServerSessionDetails (org.jkiss.dbeaver.model.admin.sessions.DBAServerSessionDetails)2 SQLQuery (org.jkiss.dbeaver.model.sql.SQLQuery)2 PropertyCollector (org.jkiss.dbeaver.runtime.properties.PropertyCollector)2