use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.
the class DataCompareDetailEditorPart method createContent.
private void createContent(Composite parent) {
compareTableViewer = new TableViewer(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
compareTableViewer.setUseHashlookup(true);
CommonUITool.createGridLayout(compareTableViewer.getTable(), 1, 0, 10, 0, 10, 0, 0, 0, 0);
compareTableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
compareTableViewer.getTable().setLinesVisible(true);
compareTableViewer.getTable().setHeaderVisible(true);
try {
new ProgressMonitorDialog(this.getSite().getShell()).run(true, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
monitor.beginTask(Messages.msgLoadingData, 1);
loadData(1);
monitor.done();
Display.getDefault().syncExec(new Runnable() {
public void run() {
initTableViewer();
compareTableViewer.setInput(dataList);
CommonUITool.packTable(compareTableViewer.getTable(), 20, 200);
}
});
}
});
} catch (Exception e) {
LOGGER.error("", e);
}
}
use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.
the class DataCompareEditorPart method createContent.
private void createContent(Composite parent) {
compareTableViewer = new TableViewer(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
compareTableViewer.setUseHashlookup(true);
compareTableViewer.setColumnProperties(columnNames);
CommonUITool.createGridLayout(compareTableViewer.getTable(), 1, 0, 10, 0, 10, 0, 0, 0, 0);
compareTableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
compareTableViewer.getTable().setLinesVisible(true);
compareTableViewer.getTable().setHeaderVisible(true);
sorter = new DataCompareSchemaListViewSorter();
sorter.setSortType(DataCompareSchemaListViewSorter.SORT_TABLE);
compareTableViewer.setSorter(sorter);
makeContextMenu(compareTableViewer);
final TableViewerColumn firstCol = new TableViewerColumn(compareTableViewer, SWT.NONE);
firstCol.getColumn().setWidth(30);
firstCol.getColumn().setResizable(false);
firstCol.getColumn().setAlignment(SWT.CENTER);
firstCol.getColumn().setImage(CommonUIPlugin.getImage("icons/unchecked.gif"));
firstCol.getColumn().addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TableItem[] items = compareTableViewer.getTable().getItems();
if (items == null) {
return;
}
for (TableItem item : items) {
DataCompare dataCompare = (DataCompare) item.getData();
dataCompare.setUse(isSelectAll);
}
compareTableViewer.refresh();
Image image = null;
if (isSelectAll) {
image = CommonUIPlugin.getImage("icons/checked.gif");
} else {
image = CommonUIPlugin.getImage("icons/unchecked.gif");
}
firstCol.getColumn().setImage(image);
isSelectAll = !isSelectAll;
}
});
TableViewerColumn col = new TableViewerColumn(compareTableViewer, SWT.NONE);
col.getColumn().setWidth(200);
col.getColumn().setText(Messages.lblDataCompareTable);
makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_TABLE);
col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
col.getColumn().setWidth(100);
col.getColumn().setText(Messages.lblDataCompareRecordSource);
makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_SOURCE_RECORDS);
col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
col.getColumn().setWidth(100);
col.getColumn().setText(Messages.lblDataCompareRecordTarget);
makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_TARGET_RECORDS);
col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
col.getColumn().setWidth(100);
col.getColumn().setText(Messages.lblDataCompareRecordProgress);
makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_PROGRESS);
col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
col.getColumn().setWidth(100);
col.getColumn().setText(Messages.lblDataCompareRecordMatch);
makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_MATCHES);
col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
col.getColumn().setWidth(100);
col.getColumn().setText(Messages.lblDataCompareRecordNoMatch);
makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_NOT_MATCHES);
col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
col.getColumn().setWidth(100);
col.getColumn().setText(Messages.lblDataCompareRecordNotExist);
makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_NOT_EXISTS);
col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
col.getColumn().setWidth(300);
col.getColumn().setText(Messages.lblDataCompareRecordError);
makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_ERROR);
CellEditor[] cellEditor = new CellEditor[1];
cellEditor[0] = new CheckboxCellEditor(compareTableViewer.getTable());
compareTableViewer.setCellEditors(cellEditor);
compareTableViewer.setCellModifier(new DataCompareCellModifier(this));
compareTableViewer.setContentProvider(new DataCompareSchemaListContentProvider());
compareTableViewer.setLabelProvider(new DataCompareSchemaListLabelProvider());
compareList = new ArrayList<DataCompare>();
compareTableViewer.setInput(compareList);
txtProgress = new StyledText(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
txtProgress.setEditable(false);
txtProgress.setWordWrap(true);
txtProgress.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, 100));
txtProgress.setBackground(txtProgress.getDisplay().getSystemColor(SWT.COLOR_BLACK));
txtProgress.setForeground(txtProgress.getDisplay().getSystemColor(SWT.COLOR_GREEN));
compareTableViewer.getTable().setToolTipText(Messages.msgYouCanSeeDetailDblclick);
compareTableViewer.getTable().addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent e) {
if (e.character == ' ') {
TableItem[] items = compareTableViewer.getTable().getSelection();
if (items == null) {
return;
}
for (TableItem item : items) {
DataCompare dataCompare = (DataCompare) item.getData();
dataCompare.setUse(!dataCompare.isUse());
}
compareTableViewer.refresh();
}
}
});
compareTableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
if (!refreshedRecordCounts) {
CommonUITool.openWarningBox(Messages.msgClickRefreshToEsimateDiff);
return;
}
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
DataCompare model = (DataCompare) selection.getFirstElement();
if (!model.isSameSchema()) {
CommonUITool.openWarningBox(Messages.msgTheSchemaDiff);
return;
}
if (model.getRecordsTarget() == -1) {
CommonUITool.openWarningBox(Messages.msgTargetNotFound);
return;
}
if (model.getRecordsSource() == 0 && model.getRecordsTarget() > 0) {
CommonUITool.openWarningBox(Messages.msgTargetNoData);
return;
}
if (model.getRecordsSource() == 0) {
CommonUITool.openWarningBox(Messages.msgNoDataToCompare);
return;
}
if (model.getProgressPosition() == 0) {
CommonUITool.openWarningBox(Messages.msgNotYetCompared);
return;
}
if (model.getNotMatches() == 0 && model.getNotExists() == 0) {
CommonUITool.openWarningBox(Messages.msgSameData);
return;
}
showDataCompareDetailEditor(model.getSchemaInfo());
}
});
}
use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.
the class RunSQLFileViewPart 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));
pbTotal = new ProgressBar(progressPanel, SWT.NONE);
pbTotal.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(input.getLogFolderPath()));
} catch (IOException e) {
e.printStackTrace();
}
}
});
Composite textComp = new Composite(backPanel, SWT.NONE);
GridData textCompGd = new GridData(GridData.FILL_HORIZONTAL);
textCompGd.heightHint = 50;
textCompGd.exclude = true;
textComp.setVisible(false);
textComp.setLayoutData(textCompGd);
textComp.setLayout(new GridLayout(1, false));
Text errorText = new Text(textComp, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
errorText.setLayoutData(new GridData(GridData.FILL_BOTH));
errorText.setEditable(false);
tvProgress = new TableViewer(backPanel, SWT.BORDER | SWT.FULL_SELECTION);
tvProgress.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
tvProgress.getTable().setLinesVisible(true);
tvProgress.getTable().setHeaderVisible(true);
final TableViewerColumn fileName = new TableViewerColumn(tvProgress, SWT.NONE);
final TableViewerColumn successCount = new TableViewerColumn(tvProgress, SWT.NONE);
final TableViewerColumn failCount = new TableViewerColumn(tvProgress, SWT.NONE);
final TableViewerColumn status = new TableViewerColumn(tvProgress, SWT.NONE);
final TableViewerColumn elapsedTime = new TableViewerColumn(tvProgress, SWT.NONE);
fileName.getColumn().setWidth(250);
fileName.getColumn().setText(Messages.fileName);
successCount.getColumn().setWidth(100);
successCount.getColumn().setText(Messages.successCount);
failCount.getColumn().setWidth(100);
failCount.getColumn().setText(Messages.failCount);
status.getColumn().setWidth(100);
status.getColumn().setText(Messages.columnStatus);
elapsedTime.getColumn().setWidth(130);
elapsedTime.getColumn().setText(Messages.columnElapsedTime);
tvProgress.setContentProvider(new RunSQLFileTableContentProvider());
tvProgress.setLabelProvider(new RunSQLFileTableLabelProvider());
tvProgress.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
SqlRunnerProgress po = (SqlRunnerProgress) selection.getFirstElement();
new ViewSQLLogDialog(Display.getDefault().getActiveShell(), po.getFileName(), po.getFailList()).open();
}
});
String errorMsg = testConnection();
if (errorMsg != null) {
pbTotal.setEnabled(false);
btnStop.setEnabled(false);
textCompGd.exclude = false;
textComp.setVisible(true);
errorText.setText("Can't get connection : " + errorMsg);
textComp.getParent().layout();
return;
}
initManager();
intiTableView();
}
use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.
the class CubridIndexNavigatorView method createPartControl.
public void createPartControl(Composite parent) {
tableIndexTableViewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
Table columnsTable = tableIndexTableViewer.getTable();
columnsTable.setLinesVisible(true);
columnsTable.setHeaderVisible(true);
final TableColumn pkColumn = new TableColumn(columnsTable, SWT.NONE);
pkColumn.setAlignment(SWT.LEFT);
pkColumn.setWidth(40);
pkColumn.setText(Messages.lblIndexType);
final TableColumn indexNameColumn = new TableColumn(columnsTable, SWT.NONE);
indexNameColumn.setAlignment(SWT.LEFT);
indexNameColumn.setWidth(80);
indexNameColumn.setText(Messages.tblColumnIndexName);
final TableColumn onColumn = new TableColumn(columnsTable, SWT.NONE);
onColumn.setAlignment(SWT.LEFT);
onColumn.setWidth(90);
onColumn.setText(Messages.tblColumnOnColumns);
tableIndexTableViewer.setContentProvider(new CubridIndexNavigatorContentProvider());
tableIndexTableViewer.setLabelProvider(new CubridIndexNavigatorLabelProvider());
}
use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.
the class CubridColumnNavigatorView method createPartControl.
public void createPartControl(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
{
GridLayout gl = new GridLayout(1, false);
comp.setLayout(gl);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
comp.setLayoutData(gd);
}
lblSchemaName = new Label(comp, SWT.NONE);
lblSchemaName.setText(com.cubrid.common.ui.common.Messages.lblQuickViewColInfo);
{
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
lblSchemaName.setLayoutData(gd);
}
tableColTableViewer = new TableViewer(comp, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
{
GridData gd = new GridData(GridData.FILL_BOTH);
tableColTableViewer.getTable().setLayoutData(gd);
tableColTableViewer.getTable().setToolTipText(com.cubrid.common.ui.common.Messages.miniSchemaCopyColumnTooltip);
final MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
final Menu contextMenu = menuManager.createContextMenu(tableColTableViewer.getTable());
tableColTableViewer.getTable().setMenu(contextMenu);
final Menu copyMenu = new Menu(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP);
tableColTableViewer.getTable().setMenu(copyMenu);
tableColTableViewer.getTable().addKeyListener(new org.eclipse.swt.events.KeyAdapter() {
public void keyPressed(org.eclipse.swt.events.KeyEvent event) {
if ((event.stateMask & SWT.CTRL) != 0 && (event.stateMask & SWT.SHIFT) == 0 && event.keyCode == 'c') {
copyColumnListToClipboard(",");
}
}
});
final MenuItem copyMenuItem = new MenuItem(copyMenu, SWT.PUSH);
copyMenuItem.setText(com.cubrid.common.ui.common.Messages.miniSchemaCopyColumnWithComma);
copyMenuItem.setAccelerator(SWT.CTRL + 'C');
copyMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
copyColumnListToClipboard(",");
}
});
final MenuItem copyMenuItem2 = new MenuItem(copyMenu, SWT.PUSH);
copyMenuItem2.setText(com.cubrid.common.ui.common.Messages.miniSchemaCopyColumnWithNewline);
copyMenuItem2.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
copyColumnListToClipboard(StringUtil.NEWLINE);
}
});
new MenuItem(copyMenu, SWT.SEPARATOR);
final MenuItem copyMenuItem3 = new MenuItem(copyMenu, SWT.PUSH);
copyMenuItem3.setText(com.cubrid.common.ui.common.Messages.miniSchemaCopySelectQuery);
copyMenuItem3.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
copySelectSQLToClipboard();
}
});
final MenuItem copyMenuItem4 = new MenuItem(copyMenu, SWT.PUSH);
copyMenuItem4.setText(com.cubrid.common.ui.common.Messages.miniSchemaCopyInsertQuery);
copyMenuItem4.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
copyInsertSQLToClipboard();
}
});
final MenuItem copyMenuItem5 = new MenuItem(copyMenu, SWT.PUSH);
copyMenuItem5.setText(com.cubrid.common.ui.common.Messages.miniSchemaCopyUpdateQuery);
copyMenuItem5.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
copyUpdateSQLToClipboard();
}
});
}
Table columnsTable = tableColTableViewer.getTable();
columnsTable.setLinesVisible(true);
columnsTable.setHeaderVisible(true);
final TableColumn pkColumn = new TableColumn(columnsTable, SWT.NONE);
pkColumn.setAlignment(SWT.CENTER);
pkColumn.setWidth(30);
pkColumn.setText(Messages.tblColumnPK);
final TableColumn nameColumn = new TableColumn(columnsTable, SWT.NONE);
nameColumn.setWidth(90);
nameColumn.setText(Messages.tblColumnName);
final TableColumn dataTypeColumn = new TableColumn(columnsTable, SWT.NONE);
dataTypeColumn.setWidth(120);
dataTypeColumn.setText(Messages.tblColumnDataType);
final TableColumn defaultColumn = new TableColumn(columnsTable, SWT.NONE);
defaultColumn.setWidth(98);
defaultColumn.setText(Messages.tblColumnDefault);
final TableColumn autoIncrTableColumn = new TableColumn(columnsTable, SWT.NONE);
autoIncrTableColumn.setAlignment(SWT.CENTER);
autoIncrTableColumn.setWidth(100);
autoIncrTableColumn.setText(Messages.tblColumnAutoIncr);
final TableColumn notNullColumn = new TableColumn(columnsTable, SWT.NONE);
notNullColumn.setWidth(70);
notNullColumn.setText(Messages.tblColumnNotNull);
notNullColumn.setAlignment(SWT.CENTER);
final TableColumn uniqueColumn = new TableColumn(columnsTable, SWT.NONE);
uniqueColumn.setWidth(70);
uniqueColumn.setText(Messages.tblColumnUnique);
uniqueColumn.setAlignment(SWT.CENTER);
final TableColumn sharedColumn = new TableColumn(columnsTable, SWT.NONE);
sharedColumn.setWidth(60);
sharedColumn.setResizable(false);
sharedColumn.setText(Messages.tblColumnShared);
sharedColumn.setAlignment(SWT.CENTER);
final TableColumn inheritColumn = new TableColumn(columnsTable, SWT.NONE);
inheritColumn.setAlignment(SWT.CENTER);
inheritColumn.setWidth(90);
inheritColumn.setResizable(false);
inheritColumn.setText(Messages.tblColumnInherit);
final TableColumn classColumn = new TableColumn(columnsTable, SWT.NONE);
classColumn.setWidth(90);
classColumn.setResizable(false);
classColumn.setText(Messages.tblColumnClass);
classColumn.setAlignment(SWT.CENTER);
}
Aggregations