Search in sources :

Example 1 with ViewFailedSQLTableLabelProvider

use of com.cubrid.common.ui.common.sqlrunner.ViewFailedSQLTableLabelProvider in project cubrid-manager by CUBRID.

the class ViewSQLLogDialog method createDialogArea.

/**
	 * Create dialog area content
	 * 
	 * @param parent the parent composite
	 * @return the control
	 */
protected Control createDialogArea(Composite parent) {
    Composite container = new Composite(parent, SWT.None);
    container.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    container.setLayout(new FormLayout());
    final TableViewer tableViewer = new TableViewer(container, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION);
    tableViewer.getTable().setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    tableViewer.getTable().setLinesVisible(true);
    tableViewer.getTable().setHeaderVisible(true);
    tableViewer.getTable().setToolTipText("");
    ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.NO_RECREATE);
    FormData tableData = new FormData();
    tableData.top = new FormAttachment(0, 0);
    tableData.bottom = new FormAttachment(60, 0);
    tableData.left = new FormAttachment(0, 0);
    tableData.right = new FormAttachment(100, 0);
    tableViewer.getTable().setLayoutData(tableData);
    final TableViewerColumn lineIndex = new TableViewerColumn(tableViewer, SWT.NONE);
    lineIndex.getColumn().setWidth(40);
    lineIndex.getColumn().setText(Messages.failedSQLlineNumber);
    final TableViewerColumn sqlColumn = new TableViewerColumn(tableViewer, SWT.NONE);
    sqlColumn.getColumn().setWidth(400);
    sqlColumn.getColumn().setText(Messages.failedSQL);
    final TableViewerColumn errColumn = new TableViewerColumn(tableViewer, SWT.NONE);
    errColumn.getColumn().setWidth(400);
    errColumn.getColumn().setText(Messages.failedErrorMessage);
    tableViewer.setContentProvider(new ViewFailedSQLTableContentProvider());
    tableViewer.setLabelProvider(new ViewFailedSQLTableLabelProvider());
    tableViewer.setInput(failedList);
    sqlColumn.setLabelProvider(new ColumnLabelProvider() {

        public String getToolTipText(Object element) {
            SqlRunnerFailed failedObj = (SqlRunnerFailed) element;
            return failedObj.getSql();
        }
    });
    errColumn.setLabelProvider(new ColumnLabelProvider() {

        public String getToolTipText(Object element) {
            SqlRunnerFailed failedObj = (SqlRunnerFailed) element;
            return failedObj.getErrorMessage();
        }
    });
    tableViewer.getTable().addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            TableItem[] items = tableViewer.getTable().getSelection();
            if (items.length == 1) {
                updateDetialInfo((SqlRunnerFailed) items[0].getData());
            }
        }
    });
    detailText = new StyledText(container, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.WRAP);
    detailText.setEditable(false);
    FormData detailData = new FormData();
    detailData.top = new FormAttachment(60, 5);
    detailData.bottom = new FormAttachment(100, -5);
    detailData.left = new FormAttachment(0, 0);
    detailData.right = new FormAttachment(100, 0);
    detailText.setLayoutData(detailData);
    return container;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) StyledText(org.eclipse.swt.custom.StyledText) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SqlRunnerFailed(com.cubrid.common.ui.common.sqlrunner.model.SqlRunnerFailed) ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) ViewFailedSQLTableContentProvider(com.cubrid.common.ui.common.sqlrunner.ViewFailedSQLTableContentProvider) ViewFailedSQLTableLabelProvider(com.cubrid.common.ui.common.sqlrunner.ViewFailedSQLTableLabelProvider)

Aggregations

ViewFailedSQLTableContentProvider (com.cubrid.common.ui.common.sqlrunner.ViewFailedSQLTableContentProvider)1 ViewFailedSQLTableLabelProvider (com.cubrid.common.ui.common.sqlrunner.ViewFailedSQLTableLabelProvider)1 SqlRunnerFailed (com.cubrid.common.ui.common.sqlrunner.model.SqlRunnerFailed)1 ColumnLabelProvider (org.eclipse.jface.viewers.ColumnLabelProvider)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)1 StyledText (org.eclipse.swt.custom.StyledText)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 FormAttachment (org.eclipse.swt.layout.FormAttachment)1 FormData (org.eclipse.swt.layout.FormData)1 FormLayout (org.eclipse.swt.layout.FormLayout)1 Composite (org.eclipse.swt.widgets.Composite)1