use of org.eclipse.jface.viewers.TableViewer in project azure-tools-for-java by Microsoft.
the class QueueFileEditor method createTable.
private void createTable(Composite parent) {
queueTable = new Table(parent, SWT.BORDER | SWT.FULL_SELECTION);
queueTable.setHeaderVisible(true);
queueTable.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;
queueTable.setLayout(gridLayoutTable);
queueTable.setLayoutData(gridData);
for (int i = 0; i < 6; i++) {
TableColumn column = new TableColumn(queueTable, SWT.FILL);
column.setWidth(100);
}
queueTable.getColumn(0).setText("Id");
queueTable.getColumn(1).setText("Message Text Preview");
queueTable.getColumn(2).setText("Size");
queueTable.getColumn(3).setText("Insertion Time (UTC)");
queueTable.getColumn(4).setText("Expiration Time (UTC)");
queueTable.getColumn(5).setText("Dequeue count");
tableViewer = new TableViewer(queueTable);
tableViewer.setContentProvider(new QueueContentProvider());
tableViewer.setLabelProvider(new QueueLabelProvider());
fillGrid();
}
use of org.eclipse.jface.viewers.TableViewer in project azure-tools-for-java by Microsoft.
the class TableFileEditor method createTable.
private void createTable(Composite parent) {
entitiesTable = new org.eclipse.swt.widgets.Table(parent, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION);
entitiesTable.setHeaderVisible(true);
entitiesTable.setLinesVisible(true);
GridData gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.verticalAlignment = SWT.FILL;
gridData.grabExcessVerticalSpace = true;
gridData.grabExcessHorizontalSpace = true;
entitiesTable.setLayoutData(gridData);
tableViewer = new TableViewer(entitiesTable);
tableViewer.setUseHashlookup(true);
tableViewer.setContentProvider(new TableContentProvider());
tableViewer.setLabelProvider(new TableLabelProvider());
fillGrid();
}
use of org.eclipse.jface.viewers.TableViewer 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.TableViewer in project cubrid-manager by CUBRID.
the class DatabaseDashboardEditor method createBrokerComposite.
/**
* craete broker composite
*
* @param bar
* @param bar index
*
*/
public void createBrokerComposite(ExpandBar bar, int index) {
ExpandItem brokerItem = new ExpandItem(bar, SWT.NONE, index);
brokerItem.setText(Messages.exportDashboardBrokerTableTitle);
Composite brokerComposite = new Composite(bar, SWT.None);
brokerComposite.setLayout(new FillLayout());
brokerInfoTableViewer = new TableViewer(brokerComposite, SWT.BORDER | SWT.FULL_SELECTION);
brokerInfoTable = brokerInfoTableViewer.getTable();
brokerInfoTable.setHeaderVisible(true);
brokerInfoTable.setLinesVisible(true);
final TableViewerColumn columnVolumn = new TableViewerColumn(brokerInfoTableViewer, SWT.CENTER);
columnVolumn.getColumn().setWidth(100);
columnVolumn.getColumn().setText("Broker");
columnVolumn.getColumn().setToolTipText(com.cubrid.cubridmanager.ui.host.Messages.tipBrokerName);
final TableViewerColumn columnType = new TableViewerColumn(brokerInfoTableViewer, SWT.CENTER);
columnType.getColumn().setWidth(80);
columnType.getColumn().setText("ID");
columnType.getColumn().setToolTipText(Messages.brokerTableIDColumnTip);
final TableViewerColumn columnSize = new TableViewerColumn(brokerInfoTableViewer, SWT.CENTER);
columnSize.getColumn().setWidth(100);
columnSize.getColumn().setText("PID");
columnSize.getColumn().setToolTipText(Messages.brokerTablePIDColumnTip);
final TableViewerColumn columnQPS = new TableViewerColumn(brokerInfoTableViewer, SWT.CENTER);
columnQPS.getColumn().setWidth(100);
columnQPS.getColumn().setText("QPS");
columnQPS.getColumn().setToolTipText(com.cubrid.cubridmanager.ui.host.Messages.tipQps);
final TableViewerColumn columnFreeSize = new TableViewerColumn(brokerInfoTableViewer, SWT.CENTER);
columnFreeSize.getColumn().setWidth(100);
columnFreeSize.getColumn().setText("LQS");
columnFreeSize.getColumn().setToolTipText(Messages.brokerTableLQSColumnTip);
final TableViewerColumn columnTotalSize = new TableViewerColumn(brokerInfoTableViewer, SWT.CENTER);
columnTotalSize.getColumn().setWidth(80);
columnTotalSize.getColumn().setText(Messages.multiDatabaseLoginDialogColumnStatus);
columnTotalSize.getColumn().setToolTipText(Messages.multiDatabaseLoginDialogColumnStatus);
final TableViewerColumn columnLocation = new TableViewerColumn(brokerInfoTableViewer, SWT.CENTER);
columnLocation.getColumn().setWidth(140);
columnLocation.getColumn().setText(Messages.brokerTableLastConnectTimeColumnLabel);
columnLocation.getColumn().setToolTipText(Messages.brokerTableLastConnectTimeColumnLabel);
brokerInfoTableViewer.setContentProvider(new TableContentProvider());
brokerInfoTableViewer.setLabelProvider(new TableLabelProvider());
brokerInfoTableViewer.setInput(brokerInfoListData);
brokerItem.setControl(brokerComposite);
brokerItem.setHeight(140);
brokerItem.setExpanded(true);
Menu menu = new Menu(this.getSite().getShell(), SWT.POP_UP);
final MenuItem itemRestartCAS = new MenuItem(menu, SWT.PUSH);
itemRestartCAS.setText(Messages.exportDashboardMenuRestartServer);
itemRestartCAS.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
int i = brokerInfoTable.getSelectionIndex();
if (i < 0) {
return;
}
String brokerName = brokerInfoTable.getItem(i).getText(0);
String serverId = brokerInfoTable.getItem(i).getText(1);
if (!CommonUITool.openConfirmBox(Messages.bind(com.cubrid.cubridmanager.ui.broker.Messages.restartBrokerServerMsg, serverId))) {
return;
}
ServerInfo serverInfo = database.getServer().getServerInfo();
RestartBrokerTask restartTask = new RestartBrokerTask(serverInfo);
restartTask.setBrokerName(brokerName);
restartTask.setApplyServerNum(serverId);
TaskExecutor taskExecutor = new CommonTaskExec(Messages.bind(com.cubrid.cubridmanager.ui.broker.Messages.restartBrokerServerTaskName, serverId));
taskExecutor.addTask(restartTask);
new ExecTaskWithProgress(taskExecutor).exec();
if (taskExecutor.isSuccess()) {
// refresh
brokerInfoListData.clear();
asinfoLst.clear();
brokerInfoTable.remove(i);
loadBrokerInfo();
//recompute database's qps
long qps = 0;
for (HashMap<String, ApplyServerInfo> brokerValueMap : asinfoLst) {
for (Entry<String, ApplyServerInfo> entry : brokerValueMap.entrySet()) {
ApplyServerInfo applyServerInfo = entry.getValue();
qps += Long.valueOf(applyServerInfo.getAs_num_query());
}
}
Map<String, String> dbInfoMap = brokerInfoListData.get(0);
dbInfoMap.put("2", Long.toString(qps));
if (CompatibleUtil.isSupportGetCPUAndMemoryInfo(database.getDatabaseInfo())) {
dbInfoTableViewer.refresh();
}
brokerInfoTableViewer.refresh();
}
}
});
final MenuItem itemShowSqlLog = new MenuItem(menu, SWT.PUSH);
itemShowSqlLog.setText(Messages.exportDashboardMenuShowSQLLog);
itemShowSqlLog.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
showLogView("sql");
}
});
final MenuItem itemShowSlowQueryLog = new MenuItem(menu, SWT.PUSH);
itemShowSlowQueryLog.setText(Messages.exportDashboardMenuShowSlowQueryLog);
itemShowSlowQueryLog.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
showLogView("slow");
}
});
menu.addMenuListener(new MenuListener() {
public void menuHidden(MenuEvent e) {
}
public void menuShown(MenuEvent e) {
int i = brokerInfoTable.getSelectionIndex();
if (i < 0) {
Menu menu = (Menu) e.getSource();
menu.setVisible(false);
}
}
});
brokerInfoTable.setMenu(menu);
tableViewOnBarIndexMap.put(brokerInfoTableViewer, index);
}
use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.
the class DatabaseDashboardEditor method createLockAndTransactionComposite.
/**
* create lock and transaction composite
*
* @param bar ExpandBar
* @param bar index
*
*/
public void createLockAndTransactionComposite(ExpandBar bar, int index) {
ExpandItem lockAndTransactionItem = new ExpandItem(bar, SWT.NONE, index);
lockAndTransactionItem.setText(Messages.exportDashboardLockTableTitle);
Composite lockAndTransactionComposite = new Composite(bar, SWT.NONE);
lockAndTransactionComposite.setLayout(new FillLayout());
lockAndTransactionTableViewer = new TableViewer(lockAndTransactionComposite, SWT.BORDER | SWT.FULL_SELECTION);
lockAndTransactionTable = lockAndTransactionTableViewer.getTable();
lockAndTransactionTable.setHeaderVisible(true);
lockAndTransactionTable.setLinesVisible(true);
final TableViewerColumn columnTranIndex = new TableViewerColumn(lockAndTransactionTableViewer, SWT.CENTER);
columnTranIndex.getColumn().setWidth(80);
columnTranIndex.getColumn().setText(Messages.tblColTranInfoTranIndex);
columnTranIndex.getColumn().setToolTipText(Messages.tblColTranInfoTranIndex);
final TableViewerColumn columnUserName = new TableViewerColumn(lockAndTransactionTableViewer, SWT.CENTER);
columnUserName.getColumn().setWidth(80);
columnUserName.getColumn().setText(Messages.tblColTranInfoUserName);
columnUserName.getColumn().setToolTipText(Messages.tblColTranInfoUserName);
final TableViewerColumn columnHost = new TableViewerColumn(lockAndTransactionTableViewer, SWT.CENTER);
columnHost.getColumn().setWidth(130);
columnHost.getColumn().setText(Messages.tblColTranInfoHost);
columnHost.getColumn().setToolTipText(Messages.tblColTranInfoHost);
final TableViewerColumn columnPid = new TableViewerColumn(lockAndTransactionTableViewer, SWT.CENTER);
columnPid.getColumn().setWidth(80);
columnPid.getColumn().setText(Messages.tblColTranInfoProcessId);
columnPid.getColumn().setToolTipText(Messages.tblColTranInfoProcessId);
final TableViewerColumn columnType = new TableViewerColumn(lockAndTransactionTableViewer, SWT.BEGINNING);
columnType.getColumn().setWidth(320);
columnType.getColumn().setText(Messages.tblColLockInfoObjectType);
columnType.getColumn().setToolTipText(Messages.tblColLockInfoObjectType);
columnPid.getColumn().setAlignment(SWT.CENTER);
final TableViewerColumn columnMode = new TableViewerColumn(lockAndTransactionTableViewer, SWT.CENTER);
columnMode.getColumn().setWidth(100);
columnMode.getColumn().setText(Messages.tblColLockInfoMode);
columnMode.getColumn().setToolTipText(Messages.tblColLockInfoMode);
lockAndTransactionTableViewer.setContentProvider(new TableContentProvider());
lockAndTransactionTableViewer.setLabelProvider(new TableLabelProvider());
lockAndTransactionTableViewer.setInput(lockAndTransactionListData);
lockAndTransactionItem.setControl(lockAndTransactionComposite);
lockAndTransactionItem.setHeight(140);
lockAndTransactionItem.setExpanded(true);
Menu menu = new Menu(this.getSite().getShell(), SWT.POP_UP);
final MenuItem itemKillTran = new MenuItem(menu, SWT.PUSH);
itemKillTran.setText(Messages.menuKillTransaction);
itemKillTran.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
int i = lockAndTransactionTable.getSelectionIndex();
if (i < 0) {
return;
}
String pid = lockAndTransactionTable.getItem(i).getText(3);
if (i >= 0 && dbTransactionList != null && dbTransactionList.getTransationInfo() != null && dbTransactionList.getTransationInfo().getTransactionList() != null) {
KillTransactionDialog dlg = new KillTransactionDialog(Display.getCurrent().getActiveShell());
Transaction bean = null;
for (Transaction t : dbTransactionList.getTransationInfo().getTransactionList()) {
if (pid.equals(t.getPid())) {
bean = t;
}
}
dlg.setTransationInfo(bean);
dlg.setDatabase(database);
if (dlg.open() == IDialogConstants.CANCEL_ID) {
return;
}
dbTransactionList.getTransationInfo().setTransactionList(dlg.getKillTransactionList().getTransationInfo().getTransactionList());
lockAndTransactionListData.clear();
lockAndTransactionTableViewer.getTable().clearAll();
loadTransactionInfo();
lockAndTransactionTableViewer.refresh();
}
}
});
menu.addMenuListener(new MenuListener() {
public void menuHidden(MenuEvent e) {
}
public void menuShown(MenuEvent e) {
int i = lockAndTransactionTableViewer.getTable().getSelectionIndex();
if (i < 0) {
Menu menu = (Menu) e.getSource();
menu.setVisible(false);
}
}
});
lockAndTransactionTable.setMenu(menu);
tableViewOnBarIndexMap.put(lockAndTransactionTableViewer, index);
}
Aggregations