use of org.eclipse.jface.viewers.DoubleClickEvent in project cubrid-manager by CUBRID.
the class MultiDatabaseLoginFailedDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
getShell().setText(Messages.multiDatabaseLoginDialogTitle);
Composite parentComp = (Composite) super.createDialogArea(parent);
setTitle(Messages.multiDatabaseLoginDialogTitle);
setMessage(Messages.multiDatabaseLoginDialogMessages);
databaseTable = new TableViewer(parentComp, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
databaseTable.getTable().setLayoutData(gridData);
databaseTable.getTable().setHeaderVisible(true);
databaseTable.getTable().setLinesVisible(true);
final TableViewerColumn columnHost = new TableViewerColumn(databaseTable, SWT.CENTER);
columnHost.getColumn().setWidth(120);
columnHost.getColumn().setText(Messages.multiDatabaseLoginDialogColumnHostAddress);
final TableViewerColumn columnDatabase = new TableViewerColumn(databaseTable, SWT.CENTER);
columnDatabase.getColumn().setWidth(150);
columnDatabase.getColumn().setText(Messages.multiDatabaseLoginDialogColumnDbName);
final TableViewerColumn columnUser = new TableViewerColumn(databaseTable, SWT.CENTER);
columnUser.getColumn().setWidth(100);
columnUser.getColumn().setText(Messages.multiDatabaseLoginDialogColumnUser);
final TableViewerColumn columnErrMsg = new TableViewerColumn(databaseTable, SWT.CENTER);
columnErrMsg.getColumn().setWidth(200);
columnErrMsg.getColumn().setText(Messages.multiDatabaseLoginDialogColumnErrMsg);
final TableViewerColumn columnStatus = new TableViewerColumn(databaseTable, SWT.CENTER);
columnStatus.getColumn().setWidth(100);
columnStatus.getColumn().setText(Messages.multiDatabaseLoginDialogColumnStatus);
databaseTable.setContentProvider(new ServerListContentProvider());
databaseTable.setLabelProvider(new ServerListLabelProvider());
databaseTable.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
MultiDatabaseloginFailedInfo multiDatabaseloginFailedInfo = (MultiDatabaseloginFailedInfo) selection.getFirstElement();
editHost(multiDatabaseloginFailedInfo);
//if all database login , close this dialog
if (checkAllDatabaseLogin()) {
close();
}
}
});
databaseTable.setInput(failedDatabaseList);
MenuManager menuManager = new MenuManager();
Menu contextMenu = menuManager.createContextMenu(databaseTable.getTable());
databaseTable.getTable().setMenu(contextMenu);
Menu menu = new Menu(getShell(), SWT.POP_UP);
final MenuItem itemEdit = new MenuItem(menu, SWT.PUSH);
itemEdit.setText(Messages.multiDatabaseLoginDialogEditLabel);
itemEdit.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
IStructuredSelection selection = (StructuredSelection) databaseTable.getSelection();
MultiDatabaseloginFailedInfo multiDatabaseloginFailedInfo = (MultiDatabaseloginFailedInfo) selection.getFirstElement();
editHost(multiDatabaseloginFailedInfo);
}
});
menu.addMenuListener(new MenuAdapter() {
public void menuShown(MenuEvent event) {
IStructuredSelection selection = (IStructuredSelection) databaseTable.getSelection();
MultiDatabaseloginFailedInfo multiDatabaseloginFailedInfo = (MultiDatabaseloginFailedInfo) selection.getFirstElement();
if (multiDatabaseloginFailedInfo.getCubridDatabase().isLogined()) {
itemEdit.setEnabled(false);
} else {
itemEdit.setEnabled(true);
}
}
});
databaseTable.getTable().setMenu(menu);
databaseTable.getTable().addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (databaseTable.getTable().getSelectionIndices().length > 0) {
getButton(EDIT_ID).setEnabled(true);
} else {
getButton(EDIT_ID).setEnabled(false);
}
}
});
return parentComp;
}
use of org.eclipse.jface.viewers.DoubleClickEvent in project cubrid-manager by CUBRID.
the class JobAutoDashboardEditorPart method createBackupPlanInfoTable.
public void createBackupPlanInfoTable(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) {
refreshBackupPlan();
}
});
ToolItem createItem = new ToolItem(toolBar, SWT.PUSH);
createItem.setText(Messages.jobAutoInfoDetailPartCreateBackupBtn);
createItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_add.png"));
createItem.setEnabled(canAddOrEdit);
createItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
addBackupPlan();
}
});
ToolItem editItem = new ToolItem(toolBar, SWT.PUSH);
editItem.setText(Messages.jobAutoInfoDetailPartEditBackupBtn);
editItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_edit.png"));
editItem.setEnabled(canAddOrEdit);
editItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
editBackupPlan();
}
});
ToolItem deleteItem = new ToolItem(toolBar, SWT.PUSH);
deleteItem.setText(Messages.jobAutoInfoDetailPartDeleteBackupBtn);
deleteItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_delete.png"));
deleteItem.setEnabled(canAddOrEdit);
deleteItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
deleteBackupPlan();
}
});
ToolItem openLogItem = new ToolItem(toolBar, SWT.PUSH);
openLogItem.setText(Messages.jobAutoInfoDetailPartOpenBackupLogBtn);
openLogItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_log.png"));
openLogItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
openBackupPlanLog();
}
});
final Composite tableComposite = new Composite(parent, SWT.NONE);
tableComposite.setLayout(new FillLayout());
tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
backupPlanInfoTable = new TableViewer(tableComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
backupPlanInfoTable.getTable().setHeaderVisible(true);
backupPlanInfoTable.getTable().setLinesVisible(true);
backupPlanInfoTable.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
editBackupPlan();
}
});
final TableViewerColumn idColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
idColumn.getColumn().setWidth(80);
idColumn.getColumn().setText(Messages.backupPlanInfoTableIDColumn);
final TableViewerColumn levelColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
levelColumn.getColumn().setWidth(80);
levelColumn.getColumn().setText(Messages.backupPlanInfoTableLevelColumn);
final TableViewerColumn pathColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
pathColumn.getColumn().setWidth(200);
pathColumn.getColumn().setText(Messages.backupPlanInfoTablePathColumn);
final TableViewerColumn periodTypeColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
periodTypeColumn.getColumn().setWidth(100);
periodTypeColumn.getColumn().setText(Messages.backupPlanInfoTablePeriodTypeColumn);
final TableViewerColumn backupDetailColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
backupDetailColumn.getColumn().setWidth(150);
backupDetailColumn.getColumn().setText(Messages.backupPlanInfoTablePeriodDetailColumn);
final TableViewerColumn backupTimeColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
backupTimeColumn.getColumn().setWidth(90);
backupTimeColumn.getColumn().setText(Messages.backupPlanInfoTablePeriodTimeColumn);
if (isSupportPeriodicAutoJob) {
final TableViewerColumn backupIntervalColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
backupIntervalColumn.getColumn().setWidth(100);
backupIntervalColumn.getColumn().setText(Messages.backupPlanInfoTablePeriodIntervalColumn);
}
final TableViewerColumn onOffLineColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
onOffLineColumn.getColumn().setWidth(100);
onOffLineColumn.getColumn().setText(Messages.backupPlanInfoTableOnlineOfflineColumn);
backupPlanInfoTable.setContentProvider(new BackupPlanTableViewerContentProvider());
backupPlanInfoTable.setLabelProvider(new BackupPlanTableViewerLabelProvider());
backupPlanInfoTable.getTable().addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent event) {
ActionManager.getInstance().changeFocusProvider(backupPlanInfoTable.getTable());
}
});
MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
Menu contextMenu = menuManager.createContextMenu(backupPlanInfoTable.getTable());
backupPlanInfoTable.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.jobAutoInfoDetailPartCreateBackupBtn);
createMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_add.png"));
createMenuItem.setEnabled(canAddOrEdit);
createMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
addBackupPlan();
}
});
final MenuItem editMenuItem = new MenuItem(menu, SWT.PUSH);
editMenuItem.setText(Messages.jobAutoInfoDetailPartEditBackupBtn);
editMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_edit.png"));
editMenuItem.setEnabled(canAddOrEdit);
editMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
editBackupPlan();
}
});
final MenuItem dropMenuItem = new MenuItem(menu, SWT.PUSH);
dropMenuItem.setText(Messages.jobAutoInfoDetailPartDeleteBackupBtn);
dropMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_delete.png"));
dropMenuItem.setEnabled(canAddOrEdit);
dropMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
deleteBackupPlan();
}
});
final MenuItem openLogMenuItem = new MenuItem(menu, SWT.PUSH);
openLogMenuItem.setText(Messages.jobAutoInfoDetailPartOpenBackupLogBtn);
openLogMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_log.png"));
openLogMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
openBackupPlanLog();
}
});
backupPlanInfoTable.getTable().setMenu(menu);
}
use of org.eclipse.jface.viewers.DoubleClickEvent in project tdi-studio-se by Talend.
the class ExtendedNodeReviewDialog method createDialogArea.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
//$NON-NLS-1$
TimeMeasure.step(RepositoryReviewDialog.class.getSimpleName(), "before createDialogArea...");
GridData data = (GridData) container.getLayoutData();
data.minimumHeight = 400;
data.heightHint = 400;
data.minimumWidth = 500;
data.widthHint = 500;
container.setLayoutData(data);
textFilter = new ViewerTextFilter();
createFilterField(container);
treeViewer = provider.createViewer(container);
treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
getButton(IDialogConstants.OK_ID).setEnabled(isValidSelection(event));
}
});
treeViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
if (getButton(IDialogConstants.OK_ID).isEnabled()) {
okPressed();
}
}
});
treeViewer.addFilter(textFilter);
treeViewer.addFilter(new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
return filterByType(viewer, parentElement, element);
}
});
return container;
}
use of org.eclipse.jface.viewers.DoubleClickEvent in project tdi-studio-se by Talend.
the class TalendExportPage method createTreeViewer.
protected Composite createTreeViewer(Composite parent) {
IWizardCategory root = WorkbenchPlugin.getDefault().getExportWizardRegistry().getRootCategory();
// exportTree = new TalendCategorizedWizardSelectionTree(root,
// WorkbenchMessages.ExportWizard_selectDestination);
exportTree = new TalendCategorizedWizardSelectionTree(root, //$NON-NLS-1$
Messages.getString("WorkbenchMessages.ExportWizard_selectDestination"));
Composite exportComp = exportTree.createControl(parent);
exportTree.getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
listSelectionChanged(event.getSelection());
}
});
exportTree.getViewer().addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
treeDoubleClicked(event);
}
});
setTreeViewer(exportTree.getViewer());
return exportComp;
}
use of org.eclipse.jface.viewers.DoubleClickEvent in project tdi-studio-se by Talend.
the class ListStringValueDialog method createDialogArea.
/**
* Create contents of the dialog
*
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
tableViewer = new TableViewer(container, SWT.FULL_SELECTION | SWT.BORDER);
table = tableViewer.getTable();
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
TableLayout layout = new TableLayout();
table.setLayout(layout);
layout.addColumnData(new ColumnWeightData(100));
final TableColumn tableColumn = new TableColumn(table, SWT.NONE);
tableColumn.setAlignment(SWT.CENTER);
tableColumn.setWidth(100);
tableColumn.setText("column");
tableViewer.setContentProvider(new ArrayContentProvider());
tableViewer.setLabelProvider(new ViewerLabelProvider());
tableViewer.setInput(dataList);
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
selectObj = selection.getFirstElement();
}
});
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(final DoubleClickEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
selectObj = selection.getFirstElement();
setReturnCode(0);
close();
}
});
//
return container;
}
Aggregations