use of org.eclipse.jface.viewers.IDoubleClickListener in project cubrid-manager by CUBRID.
the class SqlmapNavigatorView method createParamView.
private void createParamView(Composite parent) {
String[] columnNames = { Messages.lblSqlmapName, Messages.lblSqlmapValue, Messages.lblSqlmapType };
Label lblCondTitle = new Label(parent, SWT.NONE);
lblCondTitle.setText(Messages.lblSqlmapParameters);
paramView = CommonUITool.createCommonTableViewer(parent, null, columnNames, CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, 120));
paramView.setColumnProperties(columnNames);
paramView.setContentProvider(new TableContentProvider());
paramView.setLabelProvider(new TableLabelProvider());
TableLayout tableLayout = new TableLayout();
tableLayout.addColumnData(new ColumnPixelData(100));
tableLayout.addColumnData(new ColumnPixelData(80));
tableLayout.addColumnData(new ColumnPixelData(70));
paramView.getTable().setLayout(tableLayout);
paramView.addDoubleClickListener(new IDoubleClickListener() {
@SuppressWarnings("unchecked")
public void doubleClick(DoubleClickEvent event) {
StructuredSelection sel = (StructuredSelection) event.getSelection();
Map<String, String> data = (Map<String, String>) sel.getFirstElement();
modifyParam(data);
}
});
Menu menu = new Menu(paramView.getTable().getShell(), SWT.POP_UP);
paramView.getTable().setMenu(menu);
final MenuItem addMenuItem = new MenuItem(menu, SWT.PUSH);
addMenuItem.setText(Messages.mnuSqlmapAdd);
addMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
addParameter();
}
});
final MenuItem modifyMenuItem = new MenuItem(menu, SWT.PUSH);
modifyMenuItem.setText(Messages.mnuSqlmapModify);
modifyMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
modifyParameterByCurrentSelected();
}
});
final MenuItem delMenuItem = new MenuItem(menu, SWT.PUSH);
delMenuItem.setText(Messages.mnuSqlmapRemove);
delMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (CommonUITool.openConfirmBox(Messages.msgSqlmapRemove)) {
removeParameterByCurrentSelected();
}
}
});
}
use of org.eclipse.jface.viewers.IDoubleClickListener in project dbeaver by serge-rider.
the class PostgresRolePrivilegesEditor method createPartControl.
@Override
public void createPartControl(Composite parent) {
this.boldFont = UIUtils.makeBoldFont(parent.getFont());
parent.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
UIUtils.dispose(boldFont);
}
});
this.pageControl = new PageControl(parent);
this.pageControl.createOrSubstituteProgressPanel(getSite());
this.pageControl.setDoubleClickHandler(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
final ISelection selection = pageControl.getSelectionProvider().getSelection();
if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
final PostgrePermission element = (PostgrePermission) ((IStructuredSelection) selection).getFirstElement();
new AbstractJob("Open target object") {
@Override
protected IStatus run(DBRProgressMonitor monitor) {
try {
final PostgreObject targetObject = element.getTargetObject(monitor);
if (targetObject != null) {
DBeaverUI.syncExec(new Runnable() {
@Override
public void run() {
NavigatorHandlerObjectOpen.openEntityEditor(targetObject);
}
});
}
} catch (DBException e) {
return GeneralUtils.makeExceptionStatus(e);
}
return Status.OK_STATUS;
}
}.schedule();
}
}
});
}
use of org.eclipse.jface.viewers.IDoubleClickListener in project cubrid-manager by CUBRID.
the class ViewDashboardEditorPart method createViewsDetailInfoTable.
public void createViewsDetailInfoTable(Composite parent) {
final Composite tableComposite = new Composite(parent, SWT.NONE);
{
tableComposite.setLayout(new FillLayout());
tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
}
viewsDetailInfoTable = new TableViewer(tableComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
viewsDetailInfoTable.getTable().setHeaderVisible(true);
viewsDetailInfoTable.getTable().setLinesVisible(true);
final TableViewerColumn columnViewName = new TableViewerColumn(viewsDetailInfoTable, SWT.LEFT);
columnViewName.getColumn().setWidth(150);
columnViewName.getColumn().setText(Messages.viewDetailInfoPartColViewName);
final TableViewerColumn scriptDescColumn = new TableViewerColumn(viewsDetailInfoTable, SWT.LEFT);
scriptDescColumn.getColumn().setWidth(200);
scriptDescColumn.getColumn().setText(Messages.viewDetailInfoPartTableDefColumn);
final TableViewerColumn ownerColumn = new TableViewerColumn(viewsDetailInfoTable, SWT.LEFT);
ownerColumn.getColumn().setWidth(80);
ownerColumn.getColumn().setText(Messages.viewDetailInfoPartTableOwnerColumn);
viewsDetailInfoTable.setContentProvider(new ViewsDetailTableViewerContentProvider());
viewsDetailInfoTable.setLabelProvider(new ViewsDetailTableViewerLabelProvider());
viewsDetailInfoTable.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
ViewDetailInfo oneViewDetail = (ViewDetailInfo) selection.getFirstElement();
//if had opend,set it selection
for (CTabItem tabItem : tabFolder.getItems()) {
if (tabItem.getText().equals(oneViewDetail.getViewName())) {
tabFolder.setSelection(tabItem);
return;
}
}
//if a new view info,create a new tab
ViewDashboardComposite viewComp = new ViewDashboardComposite(tabFolder, SWT.NONE);
viewComp.initialize();
SchemaInfo schemaInfo = database.getDatabaseInfo().getSchemaInfo(oneViewDetail.getViewName());
viewComp.setInput(schemaInfo);
}
});
viewsDetailInfoTable.getTable().addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent event) {
if ((event.stateMask & SWT.CTRL) != 0 && event.keyCode == 'c') {
}
}
});
registerContextMenu();
}
use of org.eclipse.jface.viewers.IDoubleClickListener in project azure-tools-for-java by Microsoft.
the class ServiceExplorerView method hookMouseActions.
private void hookMouseActions() {
viewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
doubleClickAction.run();
}
});
Tree tree = (Tree) viewer.getControl();
tree.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent e) {
if (e.button == 1) {
// left button
TreeItem[] selection = ((Tree) e.widget).getSelection();
if (selection.length > 0) {
TreeItem item = ((Tree) e.widget).getSelection()[0];
Node node = ((TreeNode) item.getData()).node;
// we do not propagate the click event to it
if (!node.isLoading()) {
node.getClickAction().fireNodeActionEvent();
}
}
}
}
});
}
use of org.eclipse.jface.viewers.IDoubleClickListener 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;
}
Aggregations