use of org.eclipse.jface.viewers.DoubleClickEvent in project azure-tools-for-java by Microsoft.
the class BlobExplorerFileEditor method createTable.
private Table createTable(Composite parent) {
blobListTable = new Table(parent, SWT.BORDER | SWT.FULL_SELECTION);
blobListTable.setHeaderVisible(true);
blobListTable.setLinesVisible(true);
GridData gridData = new GridData();
// gridData.heightHint = 75;
gridData.horizontalAlignment = SWT.FILL;
gridData.verticalAlignment = SWT.FILL;
gridData.grabExcessVerticalSpace = true;
gridData.grabExcessHorizontalSpace = true;
GridLayout gridLayoutTable = new GridLayout();
gridLayoutTable.numColumns = 6;
gridLayoutTable.marginRight = 0;
blobListTable.setLayout(gridLayoutTable);
blobListTable.setLayoutData(gridData);
for (int i = 0; i < 6; i++) {
new TableColumn(blobListTable, SWT.FILL);
}
blobListTable.getColumn(0).setText("");
blobListTable.getColumn(1).setText("Name");
blobListTable.getColumn(2).setText("Size");
blobListTable.getColumn(3).setText("Last Modified (UTC)");
blobListTable.getColumn(4).setText("Content Type");
blobListTable.getColumn(5).setText("URL");
blobListTable.getColumn(0).setWidth(25);
blobListTable.getColumn(1).setWidth(280);
blobListTable.getColumn(2).setWidth(60);
blobListTable.getColumn(3).setWidth(110);
blobListTable.getColumn(4).setWidth(140);
blobListTable.getColumn(5).setWidth(250);
tableViewer = new TableViewer(blobListTable);
tableViewer.setUseHashlookup(true);
tableViewer.setContentProvider(new BlobListContentProvider());
tableViewer.setLabelProvider(new BlobListLabelProvider());
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent selectionChangedEvent) {
boolean directorySelected = tableViewer.getTable().getSelectionIndex() > -1 && isDirectorySelected();
deleteButton.setEnabled(!directorySelected);
// openButton.setEnabled(!directorySelected);
saveAsButton.setEnabled(!directorySelected);
}
});
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
tableSelection();
}
});
fillGrid();
return blobListTable;
}
use of org.eclipse.jface.viewers.DoubleClickEvent in project cubrid-manager by CUBRID.
the class NewMultiHostConnectionDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
getShell().setText(Messages.multiConnectServerDialogTitle);
Composite parentComp = (Composite) super.createDialogArea(parent);
setTitle(Messages.multiConnectServerDialogTitle);
setMessage(Messages.multiConnectServerDialogMessages);
serverTable = 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);
serverTable.getTable().setLayoutData(gridData);
serverTable.getTable().setHeaderVisible(true);
serverTable.getTable().setLinesVisible(true);
final TableViewerColumn columnHost = new TableViewerColumn(serverTable, SWT.CENTER);
columnHost.getColumn().setWidth(120);
columnHost.getColumn().setText(Messages.multiConnectServerDialogColumnHostAddress);
final TableViewerColumn columnUser = new TableViewerColumn(serverTable, SWT.CENTER);
columnUser.getColumn().setWidth(200);
columnUser.getColumn().setText(Messages.multiConnectServerDialogColumnUser);
final TableViewerColumn columnErrMsg = new TableViewerColumn(serverTable, SWT.CENTER);
columnErrMsg.getColumn().setWidth(200);
columnErrMsg.getColumn().setText(Messages.multiConnectServerDialogColumnErrMsg);
final TableViewerColumn columnStatus = new TableViewerColumn(serverTable, SWT.CENTER);
columnStatus.getColumn().setWidth(100);
columnStatus.getColumn().setText(Messages.multiConnectServerDialogColumnStatus);
serverTable.setContentProvider(new ServerListContentProvider());
serverTable.setLabelProvider(new ServerListLabelProvider());
serverTable.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
FailedHostServerInfo multiHostConnectionFailedServerInfo = (FailedHostServerInfo) selection.getFirstElement();
editHost(multiHostConnectionFailedServerInfo);
}
});
serverTable.setInput(failedServerList);
MenuManager menuManager = new MenuManager();
Menu contextMenu = menuManager.createContextMenu(serverTable.getTable());
serverTable.getTable().setMenu(contextMenu);
Menu menu = new Menu(getShell(), SWT.POP_UP);
final MenuItem itemEdit = new MenuItem(menu, SWT.PUSH);
itemEdit.setText(Messages.msgConnectHostDialog);
itemEdit.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
IStructuredSelection selection = (StructuredSelection) serverTable.getSelection();
FailedHostServerInfo multiHostConnectionFailedServerInfo = (FailedHostServerInfo) selection.getFirstElement();
editHost(multiHostConnectionFailedServerInfo);
}
});
menu.addMenuListener(new MenuAdapter() {
public void menuShown(MenuEvent event) {
IStructuredSelection selection = (IStructuredSelection) serverTable.getSelection();
FailedHostServerInfo multiHostConnectionFailedServerInfo = (FailedHostServerInfo) selection.getFirstElement();
if (multiHostConnectionFailedServerInfo.getCubridServer().isConnected()) {
itemEdit.setEnabled(false);
} else {
itemEdit.setEnabled(true);
}
}
});
serverTable.getTable().setMenu(menu);
return parentComp;
}
use of org.eclipse.jface.viewers.DoubleClickEvent in project cubrid-manager by CUBRID.
the class DatabaseLogListDialog method createTable.
/**
*
* Create table area
*
* @param parent the parent composite
*/
private void createTable(Composite parent) {
Label tipLabel = new Label(parent, SWT.LEFT | SWT.WRAP);
tipLabel.setText(Messages.lblDbLogListInfo);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
tipLabel.setLayoutData(gridData);
final String[] columnNameArr = new String[] { Messages.colDbLog };
dbLogTableViewer = CommonUITool.createCommonTableViewer(parent, new LogTableViewerSorter(), columnNameArr, CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, 200));
dbLogTable = dbLogTableViewer.getTable();
for (int i = 0; i < dbLogTable.getColumnCount(); i++) {
dbLogTable.getColumn(i).pack();
}
dbLogTable.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
getButton(IDialogConstants.OK_ID).setEnabled(dbLogTable.getSelectionCount() > 0);
}
});
dbLogTableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
openLogEditor();
}
});
dbLogTableViewer.setInput(dbLogList);
}
use of org.eclipse.jface.viewers.DoubleClickEvent in project cubrid-manager by CUBRID.
the class JobAutoDashboardEditorPart method createQueryPlanInfoTable.
public void createQueryPlanInfoTable(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) {
refreshQueryPlan();
}
});
ToolItem createItem = new ToolItem(toolBar, SWT.PUSH);
createItem.setText(Messages.jobAutoInfoDetailPartCreateQueryPlanBtn);
createItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_add.png"));
createItem.setEnabled(canAddOrEdit);
createItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
addQueryPlan();
}
});
ToolItem editItem = new ToolItem(toolBar, SWT.PUSH);
editItem.setText(Messages.jobAutoInfoDetailPartEditQueryPlanBtn);
editItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_edit.png"));
editItem.setEnabled(canAddOrEdit);
editItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
editQueryPlan();
}
});
ToolItem deleteItem = new ToolItem(toolBar, SWT.PUSH);
deleteItem.setText(Messages.jobAutoInfoDetailPartDeleteQueryPlanBtn);
deleteItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_delete.png"));
deleteItem.setEnabled(canAddOrEdit);
deleteItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
deleteQueryPlan();
}
});
ToolItem openLogItem = new ToolItem(toolBar, SWT.PUSH);
openLogItem.setText(Messages.jobAutoInfoDetailPartOpenQueryLogBtn);
openLogItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_log.png"));
openLogItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
openQueryPlanLog();
}
});
final Composite tableComposite = new Composite(parent, SWT.NONE);
tableComposite.setLayout(new FillLayout());
tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
queryPlanInfoTable = new TableViewer(tableComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
queryPlanInfoTable.getTable().setHeaderVisible(true);
queryPlanInfoTable.getTable().setLinesVisible(true);
queryPlanInfoTable.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
editQueryPlan();
}
});
final TableViewerColumn nameColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
nameColumn.getColumn().setWidth(120);
nameColumn.getColumn().setText(Messages.queryPlanInfoTableNameColumn);
final TableViewerColumn periodTypeColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
periodTypeColumn.getColumn().setWidth(100);
periodTypeColumn.getColumn().setText(Messages.queryPlanInfoTablePeriodTypeColumn);
final TableViewerColumn periodDetailColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
periodDetailColumn.getColumn().setWidth(150);
periodDetailColumn.getColumn().setText(Messages.queryPlanInfoTablePeriodDetailColumn);
final TableViewerColumn queryTimeColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
queryTimeColumn.getColumn().setWidth(90);
queryTimeColumn.getColumn().setText(Messages.queryPlanInfoTablePeriodTimeColumn);
if (isSupportPeriodicAutoJob) {
final TableViewerColumn queryIntervalColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
queryIntervalColumn.getColumn().setWidth(100);
queryIntervalColumn.getColumn().setText(Messages.queryPlanInfoTablePeriodIntervalColumn);
}
final TableViewerColumn queryColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
queryColumn.getColumn().setWidth(200);
queryColumn.getColumn().setText(Messages.queryPlanInfoTableQueryColumn);
queryPlanInfoTable.setContentProvider(new QueryPlanTableViewerContentProvider());
queryPlanInfoTable.setLabelProvider(new QueryPlanTableViewerLabelProvider());
MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
Menu contextMenu = menuManager.createContextMenu(queryPlanInfoTable.getTable());
queryPlanInfoTable.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.jobAutoInfoDetailPartCreateQueryPlanBtn);
createMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_add.png"));
createMenuItem.setEnabled(canAddOrEdit);
createMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
addQueryPlan();
}
});
final MenuItem editMenuItem = new MenuItem(menu, SWT.PUSH);
editMenuItem.setText(Messages.jobAutoInfoDetailPartEditQueryPlanBtn);
editMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_edit.png"));
editMenuItem.setEnabled(canAddOrEdit);
editMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
editQueryPlan();
}
});
final MenuItem dropMenuItem = new MenuItem(menu, SWT.PUSH);
dropMenuItem.setText(Messages.jobAutoInfoDetailPartDeleteQueryPlanBtn);
dropMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_delete.png"));
dropMenuItem.setEnabled(canAddOrEdit);
dropMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
deleteQueryPlan();
}
});
final MenuItem openLogMenuItem = new MenuItem(menu, SWT.PUSH);
openLogMenuItem.setText(Messages.jobAutoInfoDetailPartOpenQueryLogBtn);
openLogMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_log.png"));
openLogMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
openQueryPlanLog();
}
});
queryPlanInfoTable.getTable().setMenu(menu);
}
use of org.eclipse.jface.viewers.DoubleClickEvent in project cubrid-manager by CUBRID.
the class ColumnViewerSorter method createTablesDetailInfoTable.
/**
* createTablesDetailInfoTable
*
* @param parent
*/
public void createTablesDetailInfoTable(Composite parent) {
final Composite tableComposite = new Composite(parent, SWT.NONE);
tableComposite.setLayout(new FillLayout());
tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
tableListView = new TableViewer(tableComposite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
tableListView.getTable().setHeaderVisible(true);
tableListView.getTable().setLinesVisible(true);
final TableViewerColumn columnTableName = new TableViewerColumn(tableListView, SWT.LEFT);
columnTableName.getColumn().setWidth(150);
columnTableName.getColumn().setText(Messages.tablesDetailInfoPartColTableName);
columnTableName.getColumn().addSelectionListener(new SelectionAdapter() {
boolean isAsc = false;
public void widgetSelected(SelectionEvent e) {
tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_NAME));
tableListView.getTable().setSortColumn(columnTableName.getColumn());
tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
isAsc = !isAsc;
}
});
final TableViewerColumn columnTableDesc = new TableViewerColumn(tableListView, SWT.LEFT);
columnTableDesc.getColumn().setWidth(200);
columnTableDesc.getColumn().setText(Messages.tablesDetailInfoPartColTableMemo);
columnTableDesc.getColumn().addSelectionListener(new SelectionAdapter() {
boolean isAsc = false;
public void widgetSelected(SelectionEvent e) {
tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_MEMO));
tableListView.getTable().setSortColumn(columnTableDesc.getColumn());
tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
isAsc = !isAsc;
}
});
final TableViewerColumn columnRecordsCount = new TableViewerColumn(tableListView, SWT.LEFT);
columnRecordsCount.getColumn().setWidth(60);
columnRecordsCount.getColumn().setText(Messages.tablesDetailInfoPartColRecordsCount);
columnRecordsCount.getColumn().addSelectionListener(new SelectionAdapter() {
boolean isAsc = false;
public void widgetSelected(SelectionEvent e) {
tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_RECORD));
tableListView.getTable().setSortColumn(columnRecordsCount.getColumn());
tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
isAsc = !isAsc;
}
});
final TableViewerColumn columnColumnsCount = new TableViewerColumn(tableListView, SWT.LEFT);
columnColumnsCount.getColumn().setWidth(80);
columnColumnsCount.getColumn().setText(Messages.tablesDetailInfoPartColColumnsCount);
columnColumnsCount.getColumn().addSelectionListener(new SelectionAdapter() {
boolean isAsc = false;
public void widgetSelected(SelectionEvent e) {
tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_COLUMN));
tableListView.getTable().setSortColumn(columnColumnsCount.getColumn());
tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
isAsc = !isAsc;
}
});
final TableViewerColumn columnPK = new TableViewerColumn(tableListView, SWT.LEFT);
columnPK.getColumn().setWidth(50);
columnPK.getColumn().setText(Messages.tablesDetailInfoPartColPK);
columnPK.getColumn().addSelectionListener(new SelectionAdapter() {
boolean isAsc = false;
public void widgetSelected(SelectionEvent e) {
tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_PK));
tableListView.getTable().setSortColumn(columnPK.getColumn());
tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
isAsc = !isAsc;
}
});
final TableViewerColumn columnTableUK = new TableViewerColumn(tableListView, SWT.LEFT);
columnTableUK.getColumn().setWidth(50);
columnTableUK.getColumn().setText(Messages.tablesDetailInfoPartColUK);
columnTableUK.getColumn().addSelectionListener(new SelectionAdapter() {
boolean isAsc = false;
public void widgetSelected(SelectionEvent e) {
tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_UK));
tableListView.getTable().setSortColumn(columnTableUK.getColumn());
tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
isAsc = !isAsc;
}
});
final TableViewerColumn columnFK = new TableViewerColumn(tableListView, SWT.LEFT);
columnFK.getColumn().setWidth(50);
columnFK.getColumn().setText(Messages.tablesDetailInfoPartColFK);
columnFK.getColumn().addSelectionListener(new SelectionAdapter() {
boolean isAsc = false;
public void widgetSelected(SelectionEvent e) {
tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_FK));
tableListView.getTable().setSortColumn(columnFK.getColumn());
tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
isAsc = !isAsc;
}
});
final TableViewerColumn columnIndex = new TableViewerColumn(tableListView, SWT.LEFT);
columnIndex.getColumn().setWidth(50);
columnIndex.getColumn().setText(Messages.tablesDetailInfoPartColIndex);
columnIndex.getColumn().addSelectionListener(new SelectionAdapter() {
boolean isAsc = false;
public void widgetSelected(SelectionEvent e) {
tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_INDEX));
tableListView.getTable().setSortColumn(columnIndex.getColumn());
tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
isAsc = !isAsc;
}
});
final TableViewerColumn columnRecordsSize = new TableViewerColumn(tableListView, SWT.LEFT);
columnRecordsSize.getColumn().setWidth(100);
columnRecordsSize.getColumn().setText(Messages.tablesDetailInfoPartColTableRecordsSize);
columnRecordsSize.getColumn().addSelectionListener(new SelectionAdapter() {
boolean isAsc = false;
public void widgetSelected(SelectionEvent e) {
tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_SIZE));
tableListView.getTable().setSortColumn(columnRecordsSize.getColumn());
tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
isAsc = !isAsc;
}
});
tableListView.setContentProvider(new TableDashboardContentProvider());
tableListView.setLabelProvider(new TableDashboardLabelProvider());
tableListView.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
TableDetailInfo oneTableDetail = (TableDetailInfo) selection.getFirstElement();
openTableDetail(oneTableDetail);
}
});
tableListView.getTable().addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent event) {
if ((event.stateMask & SWT.CTRL) != 0 && event.keyCode == 'c') {
copySelectedTableNamesToClipboard();
} else if (event.keyCode == SWT.CR) {
showEditDialog(tableListView.getTable(), tableListView.getTable().getSelectionIndex());
}
}
});
registerContextMenu();
}
Aggregations