use of com.cubrid.cubridquery.ui.connection.editor.DatabaseInfoTableViewerLabelProvider in project cubrid-manager by CUBRID.
the class ImportExportConnectionDialog method createTable.
private void createTable(Composite composite) {
hostListView = CheckboxTableViewer.newCheckList(composite, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.FULL_SELECTION);
tblHostList = hostListView.getTable();
final GridData gdColumnsTable = new GridData(SWT.FILL, SWT.FILL, true, true);
gdColumnsTable.horizontalSpan = 3;
gdColumnsTable.heightHint = 189;
tblHostList.setLayoutData(gdColumnsTable);
tblHostList.setLinesVisible(true);
tblHostList.setHeaderVisible(true);
final TableColumn hostName = new TableColumn(tblHostList, SWT.NONE);
hostName.setAlignment(SWT.LEFT);
hostName.setWidth(WIDTH_NAME);
hostName.setText(Messages.columnHeaderServerInfo);
if (export) {
hostName.setImage(CommonUIPlugin.getImage("icons/checked_green.png"));
} else {
hostName.setImage(CommonUIPlugin.getImage("icons/unchecked.gif"));
}
hostName.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
selectAll = !selectAll;
hostListView.setAllChecked(selectAll);
Image image = selectAll ? CommonUIPlugin.getImage("icons/checked_green.png") : CommonUIPlugin.getImage("icons/unchecked.gif");
hostName.setImage(image);
handleSelectAll(selectAll);
}
});
final TableColumn hostAddress = new TableColumn(tblHostList, SWT.NONE);
hostAddress.setAlignment(SWT.CENTER);
hostAddress.setWidth(WIDTH_ADDRESS);
hostAddress.setText(Messages.columnHeaderServerAddress);
final TableColumn hostPort = new TableColumn(tblHostList, SWT.NONE);
hostPort.setAlignment(SWT.CENTER);
hostPort.setWidth(WIDTH_PORT);
hostPort.setText(Messages.columnHeaderServerPort);
final TableColumn jdbcVer = new TableColumn(tblHostList, SWT.NONE);
jdbcVer.setAlignment(SWT.CENTER);
jdbcVer.setWidth(WIDTH_JDBC);
jdbcVer.setText(Messages.columnHeaderServerJdbcVersion);
final TableColumn hostUser = new TableColumn(tblHostList, SWT.NONE);
hostUser.setAlignment(SWT.CENTER);
hostUser.setWidth(WIDTH_USER);
hostUser.setText(Messages.columnHeaderServerUserName);
final TableColumn savedPass = new TableColumn(tblHostList, SWT.NONE);
savedPass.setAlignment(SWT.CENTER);
savedPass.setWidth(WIDTH_SAVEPASS);
savedPass.setText(Messages.columnHeaderServerAutoSave);
DatabaseInfoTableViewerContentProvider contentProvider = new DatabaseInfoTableViewerContentProvider();
DatabaseInfoTableViewerLabelProvider labelProvider = new DatabaseInfoTableViewerLabelProvider();
hostListView.setContentProvider(contentProvider);
hostListView.setLabelProvider(labelProvider);
hostListView.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
boolean isSelect = event.getChecked();
Object obj = event.getElement();
if (obj instanceof DatabaseUIWrapper) {
((DatabaseUIWrapper) obj).setSeleted(isSelect);
}
updateWidgetStatus();
}
});
hostListView.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent arg0) {
ImportExportConnectionDialog.this.getButton(IDialogConstants.OK_ID).setEnabled(hostListView.getCheckedElements().length > 0);
}
});
if (export) {
initTableData();
setSelectAll(true);
}
}
Aggregations