use of org.eclipse.jface.viewers.TableViewerColumn in project cubrid-manager by CUBRID.
the class UnifyHostConfigEditor method createCubridConfTableData.
/**
* create table data by cubridConfConfig model
*/
public void createCubridConfTableData() {
//remove column
int oldCount = cubridConfTabTableViewer.getTable().getColumnCount();
for (int i = 0; i < oldCount; i++) {
cubridConfTabTableViewer.getTable().getColumn(0).dispose();
}
//create column
TableViewerColumn column = new TableViewerColumn(cubridConfTabTableViewer, SWT.LEFT);
column.getColumn().setWidth(150);
column.getColumn().setText(Messages.unifyHostConfTableColumnPropName);
column.setEditingSupport(new PropValueEditingSupport(cubridConfTabTableViewer, 0));
int columnIndex = 0;
for (Entry<String, CubridConfConfig> entry : cubridConfConfigDataMap.entrySet()) {
CubridConfConfig cubridConfConfig = entry.getValue();
for (int i = 0; i < cubridConfConfig.getPropertyList().size(); i++) {
TableViewerColumn propColumn = new TableViewerColumn(cubridConfTabTableViewer, SWT.LEFT);
propColumn.getColumn().setWidth(160);
propColumn.getColumn().setText(Messages.unifyHostCubridConfTableTitle + columnIndex);
propColumn.setEditingSupport(new PropValueEditingSupport(cubridConfTabTableViewer, columnIndex + 1));
propColumn.getColumn().addSelectionListener(new SelectionAdapter() {
@SuppressWarnings("all")
public void widgetSelected(SelectionEvent event) {
}
});
columnIndex++;
}
}
cubridConfTabTableViewer.setLabelProvider(new UnifyHostCubridConfTableLabelProvider());
cubridConfTabTableViewer.setInput(cubridConfConfigListData);
cubridConfConfigListData.clear();
cubridConfConfigListData.addAll(unifyHostConfigUtil.parseCubridConfConfigToCommonTableValue(cubridConfConfigDataMap));
cubridConfTabTableViewer.refresh();
}
use of org.eclipse.jface.viewers.TableViewerColumn in project cubrid-manager by CUBRID.
the class MultiHostEditDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
getShell().setText(Messages.multiEditServerDialogTitle);
Composite parentComp = (Composite) super.createDialogArea(parent);
setTitle(Messages.multiEditServerDialogTitle);
setMessage(Messages.multiEditServerDialogMessages);
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);
@SuppressWarnings("all") final TableViewerColumn //emty column can make image not take no use place at first column
empty = new TableViewerColumn(serverTable, SWT.NONE);
final TableViewerColumn columnName = new TableViewerColumn(serverTable, SWT.NONE);
columnName.getColumn().setWidth(130);
columnName.getColumn().setText(Messages.multiEditServerDialogColumnName);
columnName.setEditingSupport(new HostEditingSupport(0, serverTable));
final TableViewerColumn columnHost = new TableViewerColumn(serverTable, SWT.NONE);
columnHost.getColumn().setWidth(100);
columnHost.getColumn().setText(Messages.multiConnectServerDialogColumnHostAddress);
columnHost.setEditingSupport(new HostEditingSupport(1, serverTable));
final TableViewerColumn columnPort = new TableViewerColumn(serverTable, SWT.NONE);
columnPort.getColumn().setWidth(50);
columnPort.getColumn().setText(Messages.multiEditServerDialogColumnPort);
columnPort.setEditingSupport(new HostEditingSupport(2, serverTable));
final TableViewerColumn columnDriver = new TableViewerColumn(serverTable, SWT.NONE);
columnDriver.getColumn().setWidth(160);
columnDriver.getColumn().setText(Messages.multiEditServerDialogColumnDriver);
columnDriver.setEditingSupport(new HostEditingSupport(3, serverTable));
final TableViewerColumn columnUser = new TableViewerColumn(serverTable, SWT.NONE);
columnUser.getColumn().setWidth(80);
columnUser.getColumn().setText(Messages.multiConnectServerDialogColumnUser);
columnUser.setEditingSupport(new HostEditingSupport(4, serverTable));
final TableViewerColumn columnPassword = new TableViewerColumn(serverTable, SWT.NONE);
columnPassword.getColumn().setWidth(70);
columnPassword.getColumn().setText(Messages.multiEditServerDialogColumnPassword);
columnPassword.setEditingSupport(new HostEditingSupport(5, serverTable));
final TableViewerColumn columnAutosavePassword = new TableViewerColumn(serverTable, SWT.NONE);
columnAutosavePassword.getColumn().setWidth(40);
columnAutosavePassword.getColumn().setText(Messages.multiEditServerDialogColumnAutosavePassword);
columnAutosavePassword.getColumn().setToolTipText(Messages.multiEditServerDialogColumnAutosavePassword);
columnAutosavePassword.setEditingSupport(new AutosavePasswordSupport(serverTable));
serverTable.setContentProvider(new ServerListContentProvider());
serverTable.setLabelProvider(new ServerListLabelProvider());
serverTable.setInput(tmpServerList);
return parentComp;
}
use of org.eclipse.jface.viewers.TableViewerColumn 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.TableViewerColumn in project cubrid-manager by CUBRID.
the class UnifyHostConfigEditor method createCubridCMConfTabItem.
/**
* create cubrid CM table
*/
public void createCubridCMConfTabItem() {
Composite comp = new Composite(confTabFolder, SWT.NONE);
comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
comp.setLayout(new GridLayout(1, false));
cubridCMConfTableCTabItem = new CTabItem(confTabFolder, SWT.NONE);
cubridCMConfTableCTabItem.setText("cm.conf");
cubridCMConfTabTableViewer = new TableViewer(comp, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
cubridCMConfTabTableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
cubridCMConfTabTableViewer.getTable().setHeaderVisible(true);
cubridCMConfTabTableViewer.getTable().setLinesVisible(true);
cubridCMConfTabTableViewer.setUseHashlookup(true);
//create column
TableViewerColumn column = new TableViewerColumn(cubridCMConfTabTableViewer, SWT.LEFT);
column.getColumn().setWidth(0);
column.getColumn().setText("");
cubridCMConfTabTableViewer.setContentProvider(new UnifyHostCubridCMConfTableContentProvider());
cubridCMConfTabTableViewer.setLabelProvider(new UnifyHostCubridCMConfTableLabelProvider());
//use to mark click point, the right click menu use this point
cubridCMConfTabTableViewer.getTable().addListener(SWT.MouseDown, new Listener() {
public void handleEvent(Event event) {
cubridCMConfTableClickPoint = new Point(event.x, event.y);
cubridCMConfTableClickPointTiming = System.currentTimeMillis();
}
});
registerCubridCMConfTableContextMenu();
cubridCMConfTableCTabItem.setControl(comp);
if (confTabFolder.getSelection() == null) {
confTabFolder.setSelection(cubridCMConfTableCTabItem);
}
}
use of org.eclipse.jface.viewers.TableViewerColumn in project cubrid-manager by CUBRID.
the class UnifyHostConfigDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
setTitle(Messages.unifyHostConfigDialogTitle);
setMessage(Messages.unifyHostConfigDialogMessage, IMessageProvider.INFORMATION);
Composite parentComp = (Composite) super.createDialogArea(parent);
Composite btnComposite = new Composite(parentComp, SWT.NONE);
{
btnComposite.setLayoutData(new GridData());
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
btnComposite.setLayout(layout);
}
editCubridConfBtn = new Button(btnComposite, SWT.CHECK);
editCubridConfBtn.setText(com.cubrid.cubridmanager.ui.spi.Messages.editCubridConf + "(cubrid.conf)");
editCubridConfBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
validate();
}
});
editBrokerConfBtn = new Button(btnComposite, SWT.CHECK);
editBrokerConfBtn.setText(com.cubrid.cubridmanager.ui.spi.Messages.editBrokerConf + "(cubrid_broker.conf)");
editBrokerConfBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
validate();
}
});
editCMConfBtn = new Button(btnComposite, SWT.CHECK);
editCMConfBtn.setText(com.cubrid.cubridmanager.ui.spi.Messages.editCmConf + "(cm.conf)");
editCMConfBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
validate();
}
});
// editHAConfBtn = new Button(btnComposite, SWT.CHECK);
// editHAConfBtn.setText(com.cubrid.cubridmanager.ui.spi.Messages.editHaConf+ "(cubrid_ha.conf)");
// editHAConfBtn.addSelectionListener(new SelectionAdapter() {
// public void widgetSelected(SelectionEvent event) {
// validate();
// }
// });
//
//
// editACLConfBtn = new Button(btnComposite, SWT.CHECK);
// editACLConfBtn.setText(Messages.unifyHostConfigDialogACLConfBtnLabel);
// editACLConfBtn.addSelectionListener(new SelectionAdapter() {
// public void widgetSelected(SelectionEvent event) {
// validate();
// }
// });
tableComposite = new Composite(parentComp, SWT.NONE);
{
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 1;
gd.heightHint = 80;
tableComposite.setLayoutData(gd);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
tableComposite.setLayout(layout);
}
hostTableViewer = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL);
hostTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
hostTableViewer.getTable().setLinesVisible(true);
hostTableViewer.getTable().setHeaderVisible(false);
final TableViewerColumn databaseCol = new TableViewerColumn(hostTableViewer, SWT.NONE);
databaseCol.getColumn().setWidth(500);
databaseCol.getColumn().setText("");
hostTableViewer.setContentProvider(new HostTableContentProvider());
hostTableViewer.setLabelProvider(new HostTableLabelProvider());
registerContextMenu();
setInput();
// setAllChecked();
return parent;
}
Aggregations