use of org.eclipse.jface.viewers.TableViewerColumn in project cubrid-manager by CUBRID.
the class JobAutoDashboardEditorPart method createQueryPlanInfoTable.
public void createQueryPlanInfoTable(Composite parent) {
parent.setLayout(new GridLayout(1, false));
ToolBar toolBar = new ToolBar(parent, SWT.RIGHT);
toolBar.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
ToolItem refreshItem = new ToolItem(toolBar, SWT.PUSH);
refreshItem.setText(com.cubrid.common.ui.cubrid.table.Messages.tablesDetailInfoPartRefreshBtn);
refreshItem.setImage(CommonUIPlugin.getImage("icons/action/refresh.png"));
refreshItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
refreshQueryPlan();
}
});
ToolItem createItem = new ToolItem(toolBar, SWT.PUSH);
createItem.setText(Messages.jobAutoInfoDetailPartCreateQueryPlanBtn);
createItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_add.png"));
createItem.setEnabled(canAddOrEdit);
createItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
addQueryPlan();
}
});
ToolItem editItem = new ToolItem(toolBar, SWT.PUSH);
editItem.setText(Messages.jobAutoInfoDetailPartEditQueryPlanBtn);
editItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_edit.png"));
editItem.setEnabled(canAddOrEdit);
editItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
editQueryPlan();
}
});
ToolItem deleteItem = new ToolItem(toolBar, SWT.PUSH);
deleteItem.setText(Messages.jobAutoInfoDetailPartDeleteQueryPlanBtn);
deleteItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_delete.png"));
deleteItem.setEnabled(canAddOrEdit);
deleteItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
deleteQueryPlan();
}
});
ToolItem openLogItem = new ToolItem(toolBar, SWT.PUSH);
openLogItem.setText(Messages.jobAutoInfoDetailPartOpenQueryLogBtn);
openLogItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_log.png"));
openLogItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
openQueryPlanLog();
}
});
final Composite tableComposite = new Composite(parent, SWT.NONE);
tableComposite.setLayout(new FillLayout());
tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
queryPlanInfoTable = new TableViewer(tableComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
queryPlanInfoTable.getTable().setHeaderVisible(true);
queryPlanInfoTable.getTable().setLinesVisible(true);
queryPlanInfoTable.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
editQueryPlan();
}
});
final TableViewerColumn nameColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
nameColumn.getColumn().setWidth(120);
nameColumn.getColumn().setText(Messages.queryPlanInfoTableNameColumn);
final TableViewerColumn periodTypeColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
periodTypeColumn.getColumn().setWidth(100);
periodTypeColumn.getColumn().setText(Messages.queryPlanInfoTablePeriodTypeColumn);
final TableViewerColumn periodDetailColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
periodDetailColumn.getColumn().setWidth(150);
periodDetailColumn.getColumn().setText(Messages.queryPlanInfoTablePeriodDetailColumn);
final TableViewerColumn queryTimeColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
queryTimeColumn.getColumn().setWidth(90);
queryTimeColumn.getColumn().setText(Messages.queryPlanInfoTablePeriodTimeColumn);
if (isSupportPeriodicAutoJob) {
final TableViewerColumn queryIntervalColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
queryIntervalColumn.getColumn().setWidth(100);
queryIntervalColumn.getColumn().setText(Messages.queryPlanInfoTablePeriodIntervalColumn);
}
final TableViewerColumn queryColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
queryColumn.getColumn().setWidth(200);
queryColumn.getColumn().setText(Messages.queryPlanInfoTableQueryColumn);
queryPlanInfoTable.setContentProvider(new QueryPlanTableViewerContentProvider());
queryPlanInfoTable.setLabelProvider(new QueryPlanTableViewerLabelProvider());
MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
Menu contextMenu = menuManager.createContextMenu(queryPlanInfoTable.getTable());
queryPlanInfoTable.getTable().setMenu(contextMenu);
Menu menu = new Menu(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP);
final MenuItem createMenuItem = new MenuItem(menu, SWT.PUSH);
createMenuItem.setText(Messages.jobAutoInfoDetailPartCreateQueryPlanBtn);
createMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_add.png"));
createMenuItem.setEnabled(canAddOrEdit);
createMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
addQueryPlan();
}
});
final MenuItem editMenuItem = new MenuItem(menu, SWT.PUSH);
editMenuItem.setText(Messages.jobAutoInfoDetailPartEditQueryPlanBtn);
editMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_edit.png"));
editMenuItem.setEnabled(canAddOrEdit);
editMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
editQueryPlan();
}
});
final MenuItem dropMenuItem = new MenuItem(menu, SWT.PUSH);
dropMenuItem.setText(Messages.jobAutoInfoDetailPartDeleteQueryPlanBtn);
dropMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_delete.png"));
dropMenuItem.setEnabled(canAddOrEdit);
dropMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
deleteQueryPlan();
}
});
final MenuItem openLogMenuItem = new MenuItem(menu, SWT.PUSH);
openLogMenuItem.setText(Messages.jobAutoInfoDetailPartOpenQueryLogBtn);
openLogMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_log.png"));
openLogMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
openQueryPlanLog();
}
});
queryPlanInfoTable.getTable().setMenu(menu);
}
use of org.eclipse.jface.viewers.TableViewerColumn in project cubrid-manager by CUBRID.
the class ColumnViewerSorter method createTablesDetailInfoTable.
/**
* createTablesDetailInfoTable
*
* @param parent
*/
public void createTablesDetailInfoTable(Composite parent) {
final Composite tableComposite = new Composite(parent, SWT.NONE);
tableComposite.setLayout(new FillLayout());
tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
tableListView = new TableViewer(tableComposite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
tableListView.getTable().setHeaderVisible(true);
tableListView.getTable().setLinesVisible(true);
final TableViewerColumn columnTableName = new TableViewerColumn(tableListView, SWT.LEFT);
columnTableName.getColumn().setWidth(150);
columnTableName.getColumn().setText(Messages.tablesDetailInfoPartColTableName);
columnTableName.getColumn().addSelectionListener(new SelectionAdapter() {
boolean isAsc = false;
public void widgetSelected(SelectionEvent e) {
tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_NAME));
tableListView.getTable().setSortColumn(columnTableName.getColumn());
tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
isAsc = !isAsc;
}
});
final TableViewerColumn columnTableDesc = new TableViewerColumn(tableListView, SWT.LEFT);
columnTableDesc.getColumn().setWidth(200);
columnTableDesc.getColumn().setText(Messages.tablesDetailInfoPartColTableMemo);
columnTableDesc.getColumn().addSelectionListener(new SelectionAdapter() {
boolean isAsc = false;
public void widgetSelected(SelectionEvent e) {
tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_MEMO));
tableListView.getTable().setSortColumn(columnTableDesc.getColumn());
tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
isAsc = !isAsc;
}
});
final TableViewerColumn columnRecordsCount = new TableViewerColumn(tableListView, SWT.LEFT);
columnRecordsCount.getColumn().setWidth(60);
columnRecordsCount.getColumn().setText(Messages.tablesDetailInfoPartColRecordsCount);
columnRecordsCount.getColumn().addSelectionListener(new SelectionAdapter() {
boolean isAsc = false;
public void widgetSelected(SelectionEvent e) {
tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_RECORD));
tableListView.getTable().setSortColumn(columnRecordsCount.getColumn());
tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
isAsc = !isAsc;
}
});
final TableViewerColumn columnColumnsCount = new TableViewerColumn(tableListView, SWT.LEFT);
columnColumnsCount.getColumn().setWidth(80);
columnColumnsCount.getColumn().setText(Messages.tablesDetailInfoPartColColumnsCount);
columnColumnsCount.getColumn().addSelectionListener(new SelectionAdapter() {
boolean isAsc = false;
public void widgetSelected(SelectionEvent e) {
tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_COLUMN));
tableListView.getTable().setSortColumn(columnColumnsCount.getColumn());
tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
isAsc = !isAsc;
}
});
final TableViewerColumn columnPK = new TableViewerColumn(tableListView, SWT.LEFT);
columnPK.getColumn().setWidth(50);
columnPK.getColumn().setText(Messages.tablesDetailInfoPartColPK);
columnPK.getColumn().addSelectionListener(new SelectionAdapter() {
boolean isAsc = false;
public void widgetSelected(SelectionEvent e) {
tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_PK));
tableListView.getTable().setSortColumn(columnPK.getColumn());
tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
isAsc = !isAsc;
}
});
final TableViewerColumn columnTableUK = new TableViewerColumn(tableListView, SWT.LEFT);
columnTableUK.getColumn().setWidth(50);
columnTableUK.getColumn().setText(Messages.tablesDetailInfoPartColUK);
columnTableUK.getColumn().addSelectionListener(new SelectionAdapter() {
boolean isAsc = false;
public void widgetSelected(SelectionEvent e) {
tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_UK));
tableListView.getTable().setSortColumn(columnTableUK.getColumn());
tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
isAsc = !isAsc;
}
});
final TableViewerColumn columnFK = new TableViewerColumn(tableListView, SWT.LEFT);
columnFK.getColumn().setWidth(50);
columnFK.getColumn().setText(Messages.tablesDetailInfoPartColFK);
columnFK.getColumn().addSelectionListener(new SelectionAdapter() {
boolean isAsc = false;
public void widgetSelected(SelectionEvent e) {
tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_FK));
tableListView.getTable().setSortColumn(columnFK.getColumn());
tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
isAsc = !isAsc;
}
});
final TableViewerColumn columnIndex = new TableViewerColumn(tableListView, SWT.LEFT);
columnIndex.getColumn().setWidth(50);
columnIndex.getColumn().setText(Messages.tablesDetailInfoPartColIndex);
columnIndex.getColumn().addSelectionListener(new SelectionAdapter() {
boolean isAsc = false;
public void widgetSelected(SelectionEvent e) {
tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_INDEX));
tableListView.getTable().setSortColumn(columnIndex.getColumn());
tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
isAsc = !isAsc;
}
});
final TableViewerColumn columnRecordsSize = new TableViewerColumn(tableListView, SWT.LEFT);
columnRecordsSize.getColumn().setWidth(100);
columnRecordsSize.getColumn().setText(Messages.tablesDetailInfoPartColTableRecordsSize);
columnRecordsSize.getColumn().addSelectionListener(new SelectionAdapter() {
boolean isAsc = false;
public void widgetSelected(SelectionEvent e) {
tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_SIZE));
tableListView.getTable().setSortColumn(columnRecordsSize.getColumn());
tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
isAsc = !isAsc;
}
});
tableListView.setContentProvider(new TableDashboardContentProvider());
tableListView.setLabelProvider(new TableDashboardLabelProvider());
tableListView.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
TableDetailInfo oneTableDetail = (TableDetailInfo) selection.getFirstElement();
openTableDetail(oneTableDetail);
}
});
tableListView.getTable().addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent event) {
if ((event.stateMask & SWT.CTRL) != 0 && event.keyCode == 'c') {
copySelectedTableNamesToClipboard();
} else if (event.keyCode == SWT.CR) {
showEditDialog(tableListView.getTable(), tableListView.getTable().getSelectionIndex());
}
}
});
registerContextMenu();
}
use of org.eclipse.jface.viewers.TableViewerColumn in project cubrid-manager by CUBRID.
the class TableConfigCellEditor method createControl.
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new FormLayout());
setControl(container);
Composite leftComposite = new Composite(container, SWT.NONE);
leftComposite.setLayout(new GridLayout(1, false));
FormData leftData = new FormData();
leftData.top = new FormAttachment(0, 5);
leftData.bottom = new FormAttachment(100, 0);
leftData.left = new FormAttachment(0, 5);
leftData.right = new FormAttachment(55, 0);
leftComposite.setLayoutData(leftData);
Group grpButtons = new Group(leftComposite, SWT.NONE);
{
grpButtons.setLayout(new GridLayout(4, false));
grpButtons.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
grpButtons.setText(Messages.grpAddRemove);
}
Button sqlSchemaFileButton = new Button(grpButtons, SWT.NONE);
sqlSchemaFileButton.setText(Messages.btnAddSchemaFile);
sqlSchemaFileButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
sqlSchemaFileButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
addFile(TableConfig.TYPE_SCHEMA);
}
});
Button sqlDataFileButton = new Button(grpButtons, SWT.NONE);
sqlDataFileButton.setText(Messages.btnAddDataFile);
sqlDataFileButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
sqlDataFileButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
addFile(TableConfig.TYPE_DATA);
}
});
Button sqlIndexFileButton = new Button(grpButtons, SWT.NONE);
sqlIndexFileButton.setText(Messages.btnAddIndexFile);
sqlIndexFileButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
sqlIndexFileButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
addFile(TableConfig.TYPE_INDEX);
}
});
delFileButton = new Button(grpButtons, SWT.NONE);
delFileButton.setText(Messages.btnDelFiles);
delFileButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
delFileButton.setEnabled(false);
delFileButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
deleteSelectedFile();
}
});
sqlFileTableViewer = new TableViewer(leftComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
sqlFileTableViewer.getTable().setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 4, 1, -1, -1));
sqlFileTableViewer.getTable().setLinesVisible(true);
sqlFileTableViewer.getTable().setHeaderVisible(true);
final TableViewerColumn fileNameCol = new TableViewerColumn(sqlFileTableViewer, SWT.NONE);
fileNameCol.getColumn().setWidth(300);
fileNameCol.getColumn().setText(Messages.columnImportFileName);
final TableViewerColumn fileTypeCol = new TableViewerColumn(sqlFileTableViewer, SWT.NONE);
fileTypeCol.getColumn().setWidth(100);
fileTypeCol.getColumn().setText(Messages.columnImportFileType);
CellEditor[] editors = new CellEditor[4];
editors[0] = new TextCellEditor(sqlFileTableViewer.getTable());
editors[1] = new ComboBoxCellEditor(sqlFileTableViewer.getTable(), TYPE_ITEMS, SWT.READ_ONLY);
sqlFileTableViewer.setColumnProperties(PROPS);
sqlFileTableViewer.setContentProvider(new SQLFileTableContentProvider());
sqlFileTableViewer.setLabelProvider(new SQLFileTableLabelProvider());
sqlFileTableViewer.setCellModifier(new TableConfigCellEditor(sqlFileTableViewer, this));
sqlFileTableViewer.setCellEditors(editors);
sqlFileTableViewer.getTable().addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
delFileButton.setEnabled(delCanEnable());
}
});
Composite rightComposite = new Composite(container, SWT.NONE);
FormData rightData = new FormData();
rightData.top = new FormAttachment(0, 5);
rightData.bottom = new FormAttachment(100, 0);
rightData.left = new FormAttachment(55, 0);
rightData.right = new FormAttachment(100, -5);
rightComposite.setLayoutData(rightData);
GridLayout rightCompositeLayout = new GridLayout();
rightCompositeLayout.verticalSpacing = 10;
rightComposite.setLayout(rightCompositeLayout);
Group enCodingOptionGroup = new Group(rightComposite, SWT.None);
enCodingOptionGroup.setText(Messages.grpEncodingOption);
enCodingOptionGroup.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
enCodingOptionGroup.setLayout(new GridLayout(4, false));
Label dbCharsetLabel = new Label(enCodingOptionGroup, SWT.None);
dbCharsetLabel.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, -1, -1));
dbCharsetLabel.setText(Messages.lblDBCharset);
dbCharsetCombo = new Combo(enCodingOptionGroup, SWT.BORDER);
dbCharsetCombo.setLayoutData(CommonUITool.createGridData(1, 1, 50, 21));
dbCharsetCombo.setEnabled(false);
Label fileCharsetLabel = new Label(enCodingOptionGroup, SWT.None);
fileCharsetLabel.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, -1, -1));
fileCharsetLabel.setText(Messages.lblFileCharset);
fileCharsetCombo = new Combo(enCodingOptionGroup, SWT.BORDER);
fileCharsetCombo.setLayoutData(CommonUITool.createGridData(1, 1, 50, 21));
fileCharsetCombo.setItems(QueryOptions.getAllCharset(null));
fileCharsetCombo.select(0);
fileCharsetCombo.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
getImportDataWizard().getImportConfig().setFilesCharset(fileCharsetCombo.getText());
}
});
Group importOptionGroup = new Group(rightComposite, SWT.None);
importOptionGroup.setText(Messages.grpImportOptions);
importOptionGroup.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
importOptionGroup.setLayout(new GridLayout(2, false));
Label threadCountLabel = new Label(importOptionGroup, SWT.None);
threadCountLabel.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, -1, -1));
threadCountLabel.setText(Messages.lblThreadNum);
threadCountSpinner = new Spinner(importOptionGroup, SWT.BORDER);
threadCountSpinner.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
threadCountSpinner.setMaximum(ImportConfig.MAX_IMPORT_THREAD_COUNT);
threadCountSpinner.setMinimum(ImportConfig.MIN_IMPORT_THREAD_COUNT);
threadCountSpinner.setSelection(ImportConfig.DEFAULT_IMPORT_THREAD_COUNT);
threadCountSpinner.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
validate();
}
});
Label commitCountLabel = new Label(importOptionGroup, SWT.None);
commitCountLabel.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, -1, -1));
commitCountLabel.setText(Messages.lblCommitCount);
commitCountSpinner = new Spinner(importOptionGroup, SWT.BORDER);
commitCountSpinner.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
commitCountSpinner.setMaximum(ImportConfig.MAX_IMPORT_COMMIT_COUNT);
commitCountSpinner.setMinimum(ImportConfig.MIN_IMPORT_COMMIT_COUNT);
commitCountSpinner.setIncrement(ImportConfig.IMPORT_COMMIT_STEP);
commitCountSpinner.setSelection(ImportConfig.DEFAULT_IMPORT_COMMIT_COUNT);
final Button haModeButton = new Button(rightComposite, SWT.CHECK);
haModeButton.setText(Messages.btnInHaMode);
haModeButton.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_END, 1, 1, -1, -1));
haModeButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ImportConfig importConfig = getImportDataWizard().getImportConfig();
importConfig.setHaMode(haModeButton.getSelection());
Collections.sort(fileList, new TableConfigComparator(getImportDataWizard().getImportConfig()));
sqlFileTableViewer.refresh();
}
});
registerContextMenu();
}
use of org.eclipse.jface.viewers.TableViewerColumn in project cubrid-manager by CUBRID.
the class TableContentProvider method createPartControl.
/**
* Create part controls
*
* @param parent of the controls
*
*/
public void createPartControl(Composite parent) {
Composite backPanel = new Composite(parent, SWT.NONE);
backPanel.setLayout(new GridLayout(1, false));
backPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
Composite progressPanel = new Composite(backPanel, SWT.NONE);
progressPanel.setLayout(new GridLayout(3, false));
progressPanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
progressIndicator = new ProgressIndicator(progressPanel, SWT.NONE);
progressIndicator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
btnStop = new Button(progressPanel, SWT.NONE);
btnStop.setText(Messages.btnStop);
btnStop.setImage(CommonUIPlugin.getImage("icons/queryeditor/query_run_stop.png"));
btnStop.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
processStop();
}
});
openLogFolderButton = new Button(progressPanel, SWT.NONE);
openLogFolderButton.setText(Messages.runSQLOpenBtn);
openLogFolderButton.setEnabled(false);
openLogFolderButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
try {
java.awt.Desktop.getDesktop().open(new File(importConfig.getErrorLogFolderPath()));
} catch (IOException e) {
e.printStackTrace();
}
}
});
progressTableViewer = new TableViewer(backPanel, SWT.BORDER | SWT.FULL_SELECTION);
progressTableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
progressTableViewer.getTable().setLinesVisible(true);
progressTableViewer.getTable().setHeaderVisible(true);
final TableViewerColumn tableName = new TableViewerColumn(progressTableViewer, SWT.NONE);
final TableViewerColumn totalCount = new TableViewerColumn(progressTableViewer, SWT.NONE);
final TableViewerColumn parseCount = new TableViewerColumn(progressTableViewer, SWT.NONE);
final TableViewerColumn failedCount = new TableViewerColumn(progressTableViewer, SWT.NONE);
final TableViewerColumn status = new TableViewerColumn(progressTableViewer, SWT.NONE);
final TableViewerColumn elapsedTime = new TableViewerColumn(progressTableViewer, SWT.NONE);
final TableViewerColumn buttonColumn = new TableViewerColumn(progressTableViewer, SWT.NONE);
tableName.getColumn().setWidth(250);
tableName.getColumn().setText(Messages.columnName);
totalCount.getColumn().setWidth(100);
totalCount.getColumn().setText(Messages.columnCount);
parseCount.getColumn().setWidth(100);
parseCount.getColumn().setText(Messages.columnFinished);
failedCount.getColumn().setWidth(100);
failedCount.getColumn().setText(Messages.columnFailed);
status.getColumn().setWidth(100);
status.getColumn().setText(Messages.columnStatus);
elapsedTime.getColumn().setWidth(130);
elapsedTime.getColumn().setText(Messages.columnTime);
buttonColumn.getColumn().setWidth(90);
progressTableViewer.setContentProvider(new TableContentProvider());
progressTableViewer.setLabelProvider(new TableLabelProvider());
progressTableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
ImportMonitor monitor = (ImportMonitor) selection.getFirstElement();
openViewDialog(monitor);
}
});
Composite historyComposite = new Composite(backPanel, SWT.NONE);
historyComposite.setLayout(new GridLayout(4, false));
historyComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
historyLabel = new Label(historyComposite, SWT.NONE);
historyLabel.setText(Messages.lblHistory);
historyText = new Text(historyComposite, SWT.BORDER);
historyText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
saveButton = new Button(historyComposite, SWT.NONE);
saveButton.setText(Messages.btnSaveAndClose);
saveButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (historyText.getText().trim().length() == 0) {
CommonUITool.openErrorBox(Messages.errHistoryEmpty);
return;
}
if (ImportConfigManager.getInstance().getConfig(historyText.getText()) != null) {
CommonUITool.openErrorBox(Messages.errHistoryExist);
return;
}
importConfig.setName(historyText.getText().trim());
ImportConfigManager.getInstance().addConfig(importConfig);
close();
}
});
closeButton = new Button(historyComposite, SWT.NONE);
closeButton.setText(Messages.btnClose);
closeButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
close();
}
});
setHistroyWidgetStatus(false);
init();
}
use of org.eclipse.jface.viewers.TableViewerColumn in project cubrid-manager by CUBRID.
the class RecentlyUsedSQLComposite method createHistoryTable.
/**
* createHistoryTable
* @param bottomSash
*/
public void createHistoryTable(SashForm bottomSash) {
sqlHistoryTable = new TableViewer(bottomSash, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
sqlHistoryTable.getTable().setHeaderVisible(true);
sqlHistoryTable.getTable().setLinesVisible(true);
// final TableViewerColumn columnNO = new TableViewerColumn(
// sqlHistoryTable, SWT.CENTER);
// columnNO.getColumn().setWidth(40);
// columnNO.getColumn().setText("NO");
final TableViewerColumn columnRunTime = new TableViewerColumn(sqlHistoryTable, SWT.LEFT);
columnRunTime.getColumn().setWidth(155);
columnRunTime.getColumn().setText(Messages.recentlyUsedSQLColumnRunTime);
columnRunTime.getColumn().addSelectionListener(new SelectionAdapter() {
boolean asc = true;
@Override
public void widgetSelected(SelectionEvent e) {
sqlHistoryTable.setSorter(asc ? Sorter.EXECUTETIME_ASC : Sorter.EXECUTETIME_DESC);
sqlHistoryTable.getTable().setSortDirection(asc ? SWT.DOWN : SWT.UP);
asc = !asc;
}
});
final TableViewerColumn columnSQL = new TableViewerColumn(sqlHistoryTable, SWT.LEFT);
columnSQL.getColumn().setWidth(250);
columnSQL.getColumn().setText(Messages.recentlyUsedSQLColumn);
columnSQL.getColumn().addSelectionListener(new SelectionAdapter() {
boolean asc = true;
@Override
public void widgetSelected(SelectionEvent e) {
sqlHistoryTable.setSorter(asc ? Sorter.SQL_ASC : Sorter.SQL_DEC);
sqlHistoryTable.getTable().setSortDirection(asc ? SWT.DOWN : SWT.UP);
asc = !asc;
}
});
final TableViewerColumn columnElapseTime = new TableViewerColumn(sqlHistoryTable, SWT.LEFT);
columnElapseTime.getColumn().setWidth(100);
columnElapseTime.getColumn().setText(Messages.recentlyUsedSQLColumnElapseTime);
columnElapseTime.getColumn().addSelectionListener(new SelectionAdapter() {
boolean asc = true;
@Override
public void widgetSelected(SelectionEvent e) {
sqlHistoryTable.setSorter(asc ? Sorter.ELAPSETIME_ASC : Sorter.ELAPSETIME_DESC);
sqlHistoryTable.getTable().setSortDirection(asc ? SWT.DOWN : SWT.UP);
asc = !asc;
}
});
final TableViewerColumn columnInfo = new TableViewerColumn(sqlHistoryTable, SWT.LEFT);
columnInfo.getColumn().setWidth(300);
columnInfo.getColumn().setText(Messages.recentlyUsedSQLColumnLOG);
columnInfo.getColumn().addSelectionListener(new SelectionAdapter() {
boolean asc = true;
@Override
public void widgetSelected(SelectionEvent e) {
sqlHistoryTable.setSorter(asc ? Sorter.LOG_ASC : Sorter.LOG_DESC);
sqlHistoryTable.getTable().setSortDirection(asc ? SWT.DOWN : SWT.UP);
asc = !asc;
}
});
sqlHistoryTable.setContentProvider(new HistorySQLContentProvider());
provider = new HistorySQLLabelProvider();
sqlHistoryTable.setLabelProvider(provider);
sqlHistoryTable.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(final SelectionChangedEvent event) {
SQLHistoryDetail history = (SQLHistoryDetail) sqlHistoryTable.getElementAt(sqlHistoryTable.getTable().getSelectionIndex());
if (history != null) {
logMessageArea.setText(history.getExecuteInfo() + StringUtil.NEWLINE + history.getSql());
}
}
});
sqlHistoryTable.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
SQLHistoryDetail history = (SQLHistoryDetail) selection.getFirstElement();
logMessageArea.setText(history.getExecuteInfo() + StringUtil.NEWLINE + StringUtil.NEWLINE + history.getSql());
int start = editor.getAllQueries().length();
editor.setQuery(StringUtil.NEWLINE + history.getSql(), true, false, false);
int end = start + history.getSql().length();
// "/n" take a postion ,so both start and end should + 1
editor.setSelection(start + 1, end + 1);
}
});
}
Aggregations