use of org.eclipse.jface.viewers.DoubleClickEvent in project ACS by ACS-Community.
the class ChannelTreePart method postConstruct.
/**
* See http://www.vogella.com/articles/EclipseJFaceTree/article.html
*/
@PostConstruct
public void postConstruct(Composite parent, final IEclipseContext context, EMenuService menuService, IEventBroker eventBroker) {
try {
eventModel = EventModel.getInstance();
} catch (Throwable thr) {
thr.printStackTrace();
IStatus someStatus = statusReporter.newStatus(IStatus.ERROR, "Connection with NCs failed.", thr);
statusReporter.report(someStatus, StatusReporter.SHOW);
throw new RuntimeException(thr);
}
// eventModel.getLogger().info("ChannelTreePart got EventModel instance.");
statusLineWriter = new StatusLineWriter(eventBroker);
viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
viewer.setContentProvider(new ChannelTreeContentProvider());
viewer.setLabelProvider(new ChannelTreeLabelProvider());
// Expand the tree. '2' means to show only the visible top-level nodes.
viewer.setAutoExpandLevel(2);
viewer.setComparator(new ServiceViewerComparator());
// Provide the root node to the ContentProvider
viewer.setInput(eventModel.getNotifyServicesRoot());
// Expand with doubleclick
viewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
IStructuredSelection thisSelection = (IStructuredSelection) event.getSelection();
Object selectedNode = thisSelection.getFirstElement();
viewer.setExpandedState(selectedNode, !viewer.getExpandedState(selectedNode));
}
});
// Attach a selection listener to our tree that will post selections to the ESelectionService
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
selectionService.setSelection(selection.size() == 1 ? selection.getFirstElement() : selection.toArray());
}
});
// TODO: Take care of help system. Here's the E3 code:
// // Create the help context id for the viewer's control
// PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), "alma.acs.eventbrowser.viewer");
hookContextMenu(menuService);
// TODO: this could be used by handlers etc, currently it's not
context.set(ChannelTreePart.class, this);
}
use of org.eclipse.jface.viewers.DoubleClickEvent in project cubrid-manager by CUBRID.
the class TableSchemaCompareInfoPart method createCommonColumnsOnTable.
public void createCommonColumnsOnTable(Composite parent) {
final Composite tableComposite = new Composite(parent, SWT.NONE);
tableComposite.setLayout(new FillLayout());
tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
tablesSchemaCompareTable = new TableViewer(tableComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
tablesSchemaCompareTable.getTable().setHeaderVisible(true);
tablesSchemaCompareTable.getTable().setLinesVisible(true);
final TableViewerColumn statusColumn = new TableViewerColumn(tablesSchemaCompareTable, SWT.NONE);
statusColumn.getColumn().setWidth(20);
statusColumn.getColumn().setToolTipText(Messages.compareStatusTip);
statusColumn.getColumn().setResizable(false);
tablesSchemaCompareTable.setSorter(TableSchemaCompareTableViewerSorter.STATUS_DESC);
statusColumn.getColumn().addSelectionListener(new SelectionAdapter() {
boolean asc = true;
public void widgetSelected(SelectionEvent e) {
tablesSchemaCompareTable.setSorter(asc ? TableSchemaCompareTableViewerSorter.STATUS_ASC : TableSchemaCompareTableViewerSorter.STATUS_DESC);
tablesSchemaCompareTable.getTable().setSortColumn(statusColumn.getColumn());
tablesSchemaCompareTable.getTable().setSortDirection(asc ? SWT.UP : SWT.DOWN);
asc = !asc;
}
});
final TableViewerColumn sourceDBColumn = new TableViewerColumn(tablesSchemaCompareTable, SWT.LEFT);
sourceDBColumn.getColumn().setWidth(300);
sourceDBColumn.getColumn().setText(" " + sourceDB.getDatabaseInfo().getBrokerIP() + "@" + sourceDB.getName() + " [" + Messages.sourceDatabase + "]");
sourceDBColumn.getColumn().setToolTipText(Messages.sourceDatabaseTip);
sourceDBColumn.getColumn().addSelectionListener(new SelectionAdapter() {
boolean asc = true;
public void widgetSelected(SelectionEvent e) {
tablesSchemaCompareTable.setSorter(asc ? TableSchemaCompareTableViewerSorter.SOURCE_DB_ASC : TableSchemaCompareTableViewerSorter.SOURCE_DB_DESC);
tablesSchemaCompareTable.getTable().setSortColumn(sourceDBColumn.getColumn());
tablesSchemaCompareTable.getTable().setSortDirection(asc ? SWT.UP : SWT.DOWN);
asc = !asc;
}
});
final TableViewerColumn targetDBColoum = new TableViewerColumn(tablesSchemaCompareTable, SWT.LEFT);
targetDBColoum.getColumn().setWidth(300);
if (targetDB.isVirtual()) {
String targetDbName = Messages.erwinVirtualTable;
if (StringUtil.isNotEmpty(targetDB.getName())) {
targetDbName += " : " + targetDB.getName();
}
targetDBColoum.getColumn().setText(targetDbName);
} else {
targetDBColoum.getColumn().setText(" " + targetDB.getDatabaseInfo().getBrokerIP() + "@" + targetDB.getName() + " [" + Messages.targetDatabase + "]");
}
targetDBColoum.getColumn().setToolTipText(Messages.targetDatabaseTip);
targetDBColoum.getColumn().addSelectionListener(new SelectionAdapter() {
boolean asc = true;
public void widgetSelected(SelectionEvent e) {
tablesSchemaCompareTable.setSorter(asc ? TableSchemaCompareTableViewerSorter.TARGET_DB_ASC : TableSchemaCompareTableViewerSorter.TARGET_DB_DESC);
tablesSchemaCompareTable.getTable().setSortColumn(targetDBColoum.getColumn());
tablesSchemaCompareTable.getTable().setSortDirection(asc ? SWT.UP : SWT.DOWN);
asc = !asc;
}
});
tablesSchemaCompareTable.setContentProvider(new TableSchemaCompareTableViewerContentProvider());
tablesSchemaCompareTable.setLabelProvider(new TableSchemaCompareDetailTableViewerLabelProvider());
tablesSchemaCompareTable.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
TableSchemaCompareModel compSchemaModel = (TableSchemaCompareModel) selection.getFirstElement();
compSchemaModel.setSourceDB(sourceDB);
compSchemaModel.setTargetDB(targetDB);
TableSchema leftTableSchema = (TableSchema) compSchemaModel.getLeft();
TableSchema rightTableSchema = (TableSchema) compSchemaModel.getRight();
String tabItemText = leftTableSchema.getName();
if (StringUtil.isEmpty(leftTableSchema.getName()) || StringUtil.isEmpty(tabItemText)) {
tabItemText = rightTableSchema.getName();
}
//if had opend,set it selection and refresh the contents
for (CTabItem tabItem : tabFolder.getItems()) {
if (tabItem.getText().equals(tabItemText)) {
tableComp.setInput(compSchemaModel);
tableComp.refreshMergeViewer(tabItemText);
tabFolder.setSelection(tabItem);
return;
}
}
tableComp.setInput(compSchemaModel);
tableComp.initialize();
}
});
registerContextMenu();
}
use of org.eclipse.jface.viewers.DoubleClickEvent in project cubrid-manager by CUBRID.
the class EditVirtualTableDialog method createFkIndexTabItem.
/**
* Create foreign key/Index tab item.
*
* @param tabFolder the object of TabFolder
*/
private void createFkIndexTabItem(final TabFolder tabFolder) {
final TabItem foreignKeyTabItem = new TabItem(tabFolder, SWT.NONE);
foreignKeyTabItem.setText(Messages.infoIndexesTab);
final Composite composite = new Composite(tabFolder, SWT.NONE);
GridLayout gridLayout = new GridLayout();
composite.setLayout(gridLayout);
foreignKeyTabItem.setControl(composite);
// create the fk table viewer
final Label fkLabel = new Label(composite, SWT.NONE);
fkLabel.setText(Messages.lblFK);
fkTableView = new TableViewer(composite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
fkTable = fkTableView.getTable();
final GridData gdFkTable = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1);
fkTable.setLayoutData(gdFkTable);
fkTable.setLinesVisible(true);
fkTable.setHeaderVisible(true);
TableColumn tblCol = new TableColumn(fkTable, SWT.NONE);
tblCol.setWidth(100);
tblCol.setText(Messages.tblColumnFK);
tblCol = new TableColumn(fkTable, SWT.NONE);
tblCol.setWidth(119);
tblCol.setText(Messages.tblColumnColumnName);
tblCol = new TableColumn(fkTable, SWT.NONE);
tblCol.setWidth(93);
tblCol.setText(Messages.tblColumnForeignTable);
tblCol = new TableColumn(fkTable, SWT.NONE);
tblCol.setWidth(143);
tblCol.setText(Messages.tblColumnForeignColumnName);
tblCol = new TableColumn(fkTable, SWT.NONE);
tblCol.setWidth(84);
tblCol.setText(Messages.tblColumnUpdateRule);
tblCol = new TableColumn(fkTable, SWT.NONE);
tblCol.setWidth(86);
tblCol.setText(Messages.tblColumnDeleteRule);
tblCol = new TableColumn(fkTable, SWT.NONE);
tblCol.setWidth(100);
tblCol.setText(Messages.tblColumnCacheColumn);
FKTableViewerContentProvider fkContentProvider = new FKTableViewerContentProvider();
FKTableViewerLabelProvider fkLabelProvider = new FKTableViewerLabelProvider(database.getDatabaseInfo(), erSchema);
fkTableView.setContentProvider(fkContentProvider);
fkTableView.setLabelProvider(fkLabelProvider);
fkTableView.setInput(getNewSchemaInfo());
final Composite fkBtnComposite = new Composite(composite, SWT.NONE);
final GridData gdBtnComposite = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
fkBtnComposite.setLayoutData(gdBtnComposite);
gridLayout = new GridLayout();
gridLayout.numColumns = 3;
fkBtnComposite.setLayout(gridLayout);
final GridData gdFKBTN = new GridData(SWT.LEFT, SWT.CENTER, false, false);
final Button addFKBTN = new Button(fkBtnComposite, SWT.NONE);
addFKBTN.setLayoutData(gdFKBTN);
addFKBTN.setText(Messages.btnAddFk);
addFKBTN.addSelectionListener(new AddFkBtnListenerOnFkIndexTab());
final Button editFKBTN = new Button(fkBtnComposite, SWT.NONE);
editFKBTN.setLayoutData(gdFKBTN);
editFKBTN.setEnabled(false);
editFKBTN.setText(Messages.btnEditFk);
editFKBTN.addSelectionListener(new EditFkBtnListenerOnFkIndexTab());
final Button deleteFKBTN = new Button(fkBtnComposite, SWT.NONE);
deleteFKBTN.setLayoutData(gdFKBTN);
deleteFKBTN.setEnabled(false);
deleteFKBTN.setText(Messages.btnDelFk);
deleteFKBTN.addSelectionListener(new DelFkBtnListenerOnFkIndexTab());
fkTable.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
SchemaInfo newSchemaInfo = getNewSchemaInfo();
if (database == null || database.getDatabaseInfo() == null || newSchemaInfo == null) {
return;
}
TableItem[] items = fkTable.getSelection();
if (items == null || items.length == 0) {
deleteFKBTN.setEnabled(false);
editFKBTN.setEnabled(false);
} else {
deleteFKBTN.setEnabled(true);
editFKBTN.setEnabled(items.length == 1);
for (TableItem item : items) {
String fkName = item.getText(0);
List<SchemaInfo> superList = SuperClassUtil.getSuperClasses(database.getDatabaseInfo(), newSchemaInfo.getSuperClasses());
if (newSchemaInfo.isInSuperClasses(superList, fkName)) {
deleteFKBTN.setEnabled(false);
editFKBTN.setEnabled(false);
}
}
}
}
});
// create index table view
final Label indexLabel = new Label(composite, SWT.NONE);
indexLabel.setText(Messages.lblIndexes);
indexTableView = new TableViewer(composite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
indexTable = indexTableView.getTable();
indexTable.setLinesVisible(true);
indexTable.setHeaderVisible(true);
final GridData gdIndexTable = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1);
indexTable.setLayoutData(gdIndexTable);
tblCol = new TableColumn(indexTable, SWT.NONE);
tblCol.setWidth(150);
tblCol.setText(Messages.tblColumnIndexName);
tblCol = new TableColumn(indexTable, SWT.NONE);
tblCol.setWidth(78);
tblCol.setText(Messages.tblColumnIndexType);
tblCol = new TableColumn(indexTable, SWT.NONE);
tblCol.setWidth(218);
tblCol.setText(Messages.tblColumnOnColumns);
tblCol = new TableColumn(indexTable, SWT.NONE);
tblCol.setWidth(282);
tblCol.setText(Messages.tblColumnIndexRule);
IndexTableViewerContentProvider indexContentProvider = new IndexTableViewerContentProvider();
IndexTableViewerLabelProvider indexLabelProvider = new IndexTableViewerLabelProvider();
indexTableView.setContentProvider(indexContentProvider);
indexTableView.setLabelProvider(indexLabelProvider);
indexTableView.setInput(getNewSchemaInfo());
indexTableView.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
StructuredSelection selected = (StructuredSelection) event.getSelection();
if (selected == null) {
return;
}
Constraint constraint = (Constraint) selected.getFirstElement();
openEditIndexDialog(constraint);
}
});
final Composite indexBtnComposite = new Composite(composite, SWT.NONE);
final GridData gdIndexBtnComposite = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
indexBtnComposite.setLayoutData(gdIndexBtnComposite);
gridLayout = new GridLayout();
gridLayout.numColumns = 3;
indexBtnComposite.setLayout(gridLayout);
final GridData gdIndexBTN = new GridData(SWT.LEFT, SWT.CENTER, false, false);
final Button addIndexBTN = new Button(indexBtnComposite, SWT.NONE);
addIndexBTN.setLayoutData(gdIndexBTN);
addIndexBTN.setText(Messages.btnAddIndex);
addIndexBTN.addSelectionListener(new AddIndexBtnListenerOnFkIndexTab());
final Button editIndexBTN = new Button(indexBtnComposite, SWT.NONE);
editIndexBTN.setLayoutData(gdIndexBTN);
editIndexBTN.setEnabled(false);
editIndexBTN.setText(Messages.btnEditIndex);
editIndexBTN.addSelectionListener(new EditIndexBtnListenerOnFkIndexTab());
final Button deleteIndexBTN = new Button(indexBtnComposite, SWT.NONE);
deleteIndexBTN.setLayoutData(gdIndexBTN);
deleteIndexBTN.setEnabled(false);
deleteIndexBTN.setText(Messages.btnDelIndex);
deleteIndexBTN.addSelectionListener(new DelIndexBtnListenerOnFkIndexTab());
indexTable.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
TableItem[] items = indexTable.getSelection();
if (items == null || items.length == 0) {
deleteIndexBTN.setEnabled(false);
editIndexBTN.setEnabled(false);
} else {
deleteIndexBTN.setEnabled(true);
editIndexBTN.setEnabled(items.length == 1);
}
}
});
}
use of org.eclipse.jface.viewers.DoubleClickEvent 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.DoubleClickEvent 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();
}
Aggregations