Search in sources :

Example 1 with DataSetTable

use of org.talend.sqlbuilder.dataset.dataset.DataSetTable in project tdi-studio-se by Talend.

the class AbstractDataSetTab method fillDetailComposite.

public final void fillDetailComposite(Composite composite) {
    try {
        pComposite = composite;
        DataSet dataSet = getCachedDataSet();
        if (dataSet == null) {
            return;
        }
        // store for later use in dataset table
        //$NON-NLS-1$
        composite.setData("IDetailTab", this);
        new DataSetTable(composite, dataSet, getStatusMessage(), false);
    } catch (Exception e) {
        //$NON-NLS-1$
        SqlBuilderPlugin.log(Messages.getString("AbstractDataSetTab.logMessage1"), e);
        // couldn't get results.. clean mess up
        Control[] controls = composite.getChildren();
        for (int i = 0; i < controls.length; i++) {
            controls[i].dispose();
        }
        // and show error message
        Label label = new Label(composite, SWT.FILL);
        //$NON-NLS-1$ //$NON-NLS-2$
        label.setText(Messages.getString("DatabaseDetailView.Tab.Unavailable") + " " + e.getMessage());
        label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
        //$NON-NLS-1$
        SqlBuilderPlugin.log(Messages.getString("AbstractDataSetTab.logMessage2"), e);
    }
}
Also used : DataSet(org.talend.sqlbuilder.dataset.dataset.DataSet) DataSetTable(org.talend.sqlbuilder.dataset.dataset.DataSetTable) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData)

Example 2 with DataSetTable

use of org.talend.sqlbuilder.dataset.dataset.DataSetTable in project tdi-studio-se by Talend.

the class SQLExecution method displayResults.

/**
     * Display SQL Results in result pane.
     */
protected void displayResults() {
    Display.getDefault().asyncExec(new Runnable() {

        public void run() {
            clearCanvas();
            composite.setLayout(new GridLayout());
            try {
                int resultCount = sqlResult.getDataSet().getRows().length;
                String statusMessage = //$NON-NLS-1$ //$NON-NLS-2$
                Messages.getString("SQLResultsView.Time.Prefix") + " " + sqlResult.getExecutionTimeMillis() + //$NON-NLS-1$
                " " + //$NON-NLS-1$
                Messages.getString("SQLResultsView.Time.Postfix");
                if (resultCount > 0) {
                    statusMessage = //$NON-NLS-1$
                    statusMessage + "  " + Messages.getString("SQLResultsView.Count.Prefix") + " " + //$NON-NLS-1$ //$NON-NLS-2$
                    resultCount;
                }
                new DataSetTable(composite, sqlResult.getDataSet(), statusMessage, true);
                //$NON-NLS-1$
                composite.setData("parenttab", parentTab);
            } catch (Exception e) {
                // add message
                String message = e.getMessage();
                Label errorLabel = new Label(composite, SWT.FILL);
                errorLabel.setText(message);
                errorLabel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
                //$NON-NLS-1$
                SqlBuilderPlugin.log(Messages.getString("SQLExecution.logMessage1"), e);
            }
            composite.layout();
            composite.redraw();
            // reset to start message in case F5 will be used
            //$NON-NLS-1$
            setProgressMessage(Messages.getString("SQLResultsView.ConnectionWait"));
        }

        ;
    });
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) DataSetTable(org.talend.sqlbuilder.dataset.dataset.DataSetTable) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) SQLException(java.sql.SQLException)

Aggregations

GridData (org.eclipse.swt.layout.GridData)2 Label (org.eclipse.swt.widgets.Label)2 DataSetTable (org.talend.sqlbuilder.dataset.dataset.DataSetTable)2 SQLException (java.sql.SQLException)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 DataSet (org.talend.sqlbuilder.dataset.dataset.DataSet)1