use of org.eclipse.jface.viewers.IDoubleClickListener in project tesb-studio-se by Talend.
the class RouteResourceSelectionDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
final Composite container = (Composite) super.createDialogArea(parent);
final RepositoryViewerProvider provider = new RepositoryViewerProvider() {
@Override
protected TreeViewer createTreeViewer(Composite parent, int style) {
return new RepositoryTreeViewer(parent, style);
}
@Override
protected ERepositoryObjectType getCheckingType() {
return CamelRepositoryNodeType.repositoryRouteResourceType;
}
@Override
protected int getStyle() {
// http://jira.talendforge.org/browse/TESB-6582 Xiaopeng Li
return SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL;
}
};
repositoryTreeViewer = (RepositoryTreeViewer) provider.createViewer(container);
repositoryTreeViewer.expandAll();
repositoryTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
getButton(IDialogConstants.OK_ID).setEnabled(validateSelection((IStructuredSelection) event.getSelection()));
}
});
repositoryTreeViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
if (getButton(IDialogConstants.OK_ID).isEnabled()) {
okPressed();
}
}
});
return container;
}
use of org.eclipse.jface.viewers.IDoubleClickListener 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.IDoubleClickListener 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.IDoubleClickListener 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.IDoubleClickListener 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();
}
Aggregations