use of com.cubrid.common.ui.common.sqlrunner.ViewFailedSQLTableContentProvider 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;
}
Aggregations