use of org.eclipse.swt.widgets.TabItem in project azure-tools-for-java by Microsoft.
the class AzureNewDockerLoginPage method createControl.
/**
* Create contents of the wizard.
* @param parent
*/
public void createControl(Composite parent) {
Composite mainContainer = new Composite(parent, SWT.NONE);
setControl(mainContainer);
mainContainer.setLayout(new GridLayout(2, false));
dockerHostImportKeyvaultCredsRadioButton = new Button(mainContainer, SWT.RADIO);
GridData gd_dockerHostImportKeyvaultCredsRadioButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_dockerHostImportKeyvaultCredsRadioButton.horizontalIndent = 5;
dockerHostImportKeyvaultCredsRadioButton.setLayoutData(gd_dockerHostImportKeyvaultCredsRadioButton);
dockerHostImportKeyvaultCredsRadioButton.setText("Import credentials from Azure Key Vault:");
dockerHostImportKeyvaultComboBox = new Combo(mainContainer, SWT.READ_ONLY);
GridData gd_dockerHostImportKeyvaultComboBox = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_dockerHostImportKeyvaultComboBox.widthHint = 230;
dockerHostImportKeyvaultComboBox.setLayoutData(gd_dockerHostImportKeyvaultComboBox);
dockerHostNewCredsRadioButton = new Button(mainContainer, SWT.RADIO);
GridData gd_dockerHostNewCredsRadioButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_dockerHostNewCredsRadioButton.horizontalIndent = 5;
dockerHostNewCredsRadioButton.setLayoutData(gd_dockerHostNewCredsRadioButton);
dockerHostNewCredsRadioButton.setText("New log in credentials:");
new Label(mainContainer, SWT.NONE);
credsTabfolder = new TabFolder(mainContainer, SWT.NONE);
GridData gd_credsTabfolder = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 2);
gd_credsTabfolder.heightHint = 235;
credsTabfolder.setLayoutData(gd_credsTabfolder);
vmCredsTableItem = new TabItem(credsTabfolder, SWT.NONE);
vmCredsTableItem.setText("VM Credentials");
Composite vmCredsComposite = new Composite(credsTabfolder, SWT.NONE);
vmCredsTableItem.setControl(vmCredsComposite);
vmCredsComposite.setLayout(new GridLayout(6, false));
Label lblUsername = new Label(vmCredsComposite, SWT.NONE);
GridData gd_lblUsername = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
gd_lblUsername.horizontalIndent = 5;
lblUsername.setLayoutData(gd_lblUsername);
lblUsername.setText("Username:");
dockerHostUsernameTextField = new Text(vmCredsComposite, SWT.BORDER);
GridData gd_dockerHostUsernameTextField = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_dockerHostUsernameTextField.widthHint = 150;
dockerHostUsernameTextField.setLayoutData(gd_dockerHostUsernameTextField);
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
Label lblPassword = new Label(vmCredsComposite, SWT.NONE);
GridData gd_lblPassword = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
gd_lblPassword.horizontalIndent = 5;
lblPassword.setLayoutData(gd_lblPassword);
lblPassword.setText("Password:");
dockerHostFirstPwdField = new Text(vmCredsComposite, SWT.BORDER | SWT.PASSWORD);
GridData gd_dockerHostFirstPwdField = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_dockerHostFirstPwdField.widthHint = 150;
dockerHostFirstPwdField.setLayoutData(gd_dockerHostFirstPwdField);
dockerHostPwdLabel = new Label(vmCredsComposite, SWT.NONE);
dockerHostPwdLabel.setText("(Optional)");
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
Label lblConfirm = new Label(vmCredsComposite, SWT.NONE);
GridData gd_lblConfirm = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
gd_lblConfirm.horizontalIndent = 5;
lblConfirm.setLayoutData(gd_lblConfirm);
lblConfirm.setText("Confirm:");
dockerHostSecondPwdField = new Text(vmCredsComposite, SWT.BORDER | SWT.PASSWORD);
GridData gd_dockerHostSecondPwdField = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_dockerHostSecondPwdField.widthHint = 150;
dockerHostSecondPwdField.setLayoutData(gd_dockerHostSecondPwdField);
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
Label lblSsh = new Label(vmCredsComposite, SWT.NONE);
GridData gd_lblSsh = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_lblSsh.horizontalIndent = 5;
lblSsh.setLayoutData(gd_lblSsh);
lblSsh.setText("SSH");
Label label = new Label(vmCredsComposite, SWT.SEPARATOR | SWT.HORIZONTAL);
label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 5, 1));
dockerHostNoSshRadioButton = new Button(vmCredsComposite, SWT.RADIO);
GridData gd_dockerHostNoSshRadioButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1);
gd_dockerHostNoSshRadioButton.horizontalIndent = 5;
dockerHostNoSshRadioButton.setLayoutData(gd_dockerHostNoSshRadioButton);
dockerHostNoSshRadioButton.setText("None");
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
dockerHostAutoSshRadioButton = new Button(vmCredsComposite, SWT.RADIO);
GridData gd_dockerHostAutoSshRadioButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1);
gd_dockerHostAutoSshRadioButton.horizontalIndent = 5;
dockerHostAutoSshRadioButton.setLayoutData(gd_dockerHostAutoSshRadioButton);
dockerHostAutoSshRadioButton.setText("Auto-generate");
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
dockerHostImportSshRadioButton = new Button(vmCredsComposite, SWT.RADIO);
GridData gd_dockerHostImportSshRadioButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1);
gd_dockerHostImportSshRadioButton.horizontalIndent = 5;
dockerHostImportSshRadioButton.setLayoutData(gd_dockerHostImportSshRadioButton);
dockerHostImportSshRadioButton.setText("Import from directory:");
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
dockerHostImportSSHTextField = new Text(vmCredsComposite, SWT.BORDER);
GridData gd_dockerHostImportSSHTextField = new GridData(SWT.FILL, SWT.CENTER, true, false, 5, 1);
gd_dockerHostImportSSHTextField.horizontalIndent = 24;
dockerHostImportSSHTextField.setLayoutData(gd_dockerHostImportSSHTextField);
dockerHostImportSSHBrowseButton = new Button(vmCredsComposite, SWT.NONE);
dockerHostImportSSHBrowseButton.setText("Browse...");
daemonCredsTableItem = new TabItem(credsTabfolder, SWT.NONE);
daemonCredsTableItem.setText("Docker Daemon Credentials");
Composite daemonCredsComposite = new Composite(credsTabfolder, SWT.NONE);
daemonCredsTableItem.setControl(daemonCredsComposite);
daemonCredsComposite.setLayout(new GridLayout(4, false));
Label lblDockerDaemonPort = new Label(daemonCredsComposite, SWT.NONE);
GridData gd_lblDockerDaemonPort = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
gd_lblDockerDaemonPort.horizontalIndent = 5;
lblDockerDaemonPort.setLayoutData(gd_lblDockerDaemonPort);
lblDockerDaemonPort.setText("Docker daemon port:");
dockerDaemonPortTextField = new Text(daemonCredsComposite, SWT.BORDER);
GridData gd_dockerDaemonPortTextField = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_dockerDaemonPortTextField.widthHint = 50;
dockerDaemonPortTextField.setLayoutData(gd_dockerDaemonPortTextField);
new Label(daemonCredsComposite, SWT.NONE);
Label lblTlsSecurity = new Label(daemonCredsComposite, SWT.NONE);
GridData gd_lblTlsSecurity = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_lblTlsSecurity.horizontalIndent = 5;
lblTlsSecurity.setLayoutData(gd_lblTlsSecurity);
lblTlsSecurity.setText("TLS security");
Label label_1 = new Label(daemonCredsComposite, SWT.SEPARATOR | SWT.HORIZONTAL);
label_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
dockerHostNoTlsRadioButton = new Button(daemonCredsComposite, SWT.RADIO);
GridData gd_dockerHostNoTlsRadioButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
gd_dockerHostNoTlsRadioButton.horizontalIndent = 5;
dockerHostNoTlsRadioButton.setLayoutData(gd_dockerHostNoTlsRadioButton);
dockerHostNoTlsRadioButton.setText("None");
new Label(daemonCredsComposite, SWT.NONE);
dockerHostAutoTlsRadioButton = new Button(daemonCredsComposite, SWT.RADIO);
GridData gd_dockerHostAutoTlsRadioButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
gd_dockerHostAutoTlsRadioButton.horizontalIndent = 5;
dockerHostAutoTlsRadioButton.setLayoutData(gd_dockerHostAutoTlsRadioButton);
dockerHostAutoTlsRadioButton.setText("Auto-generate");
new Label(daemonCredsComposite, SWT.NONE);
dockerHostImportTlsRadioButton = new Button(daemonCredsComposite, SWT.RADIO);
GridData gd_dockerHostImportTlsRadioButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
gd_dockerHostImportTlsRadioButton.horizontalIndent = 5;
dockerHostImportTlsRadioButton.setLayoutData(gd_dockerHostImportTlsRadioButton);
dockerHostImportTlsRadioButton.setText("Import from directory:");
new Label(daemonCredsComposite, SWT.NONE);
dockerHostImportTLSTextField = new Text(daemonCredsComposite, SWT.BORDER);
GridData gd_dockerHostImportTLSTextField = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1);
gd_dockerHostImportTLSTextField.horizontalIndent = 24;
dockerHostImportTLSTextField.setLayoutData(gd_dockerHostImportTLSTextField);
dockerHostImportTLSBrowseButton = new Button(daemonCredsComposite, SWT.NONE);
dockerHostImportTLSBrowseButton.setText("Browse...");
dockerHostSaveCredsCheckBox = new Button(mainContainer, SWT.CHECK);
GridData gd_dockerHostSaveCredsCheckBox = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_dockerHostSaveCredsCheckBox.horizontalIndent = 5;
dockerHostSaveCredsCheckBox.setLayoutData(gd_dockerHostSaveCredsCheckBox);
dockerHostSaveCredsCheckBox.setText("Save credentials into a new Azure Key Vault:");
dockerHostNewKeyvaultTextField = new Text(mainContainer, SWT.BORDER);
GridData gd_dockerHostNewKeyvaultTextField = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_dockerHostNewKeyvaultTextField.widthHint = 210;
dockerHostNewKeyvaultTextField.setLayoutData(gd_dockerHostNewKeyvaultTextField);
FormToolkit toolkit = new FormToolkit(mainContainer.getDisplay());
toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER);
managedForm = new ManagedForm(mainContainer);
errMsgForm = managedForm.getForm();
errMsgForm.setVisible(false);
// errMsgForm.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
// errMsgForm.setBackground(mainContainer.getBackground());
errDispatcher = managedForm.getMessageManager();
// errDispatcher.addMessage("dockerHostNameTextField", "Test error", null, IMessageProvider.ERROR, dockerHostNameTextField);
// errMsgForm.setMessage("This is an error message", IMessageProvider.ERROR);
initUIMainContainer(mainContainer);
mainContainer.setTabList(new Control[] { dockerHostImportKeyvaultCredsRadioButton, dockerHostImportKeyvaultComboBox, dockerHostNewCredsRadioButton, credsTabfolder, dockerHostSaveCredsCheckBox, dockerHostNewKeyvaultTextField });
}
use of org.eclipse.swt.widgets.TabItem in project cubrid-manager by CUBRID.
the class EditFunctionDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
isCommentSupport = CompatibleUtil.isCommentSupports(database.getDatabaseInfo());
Composite parentComp = (Composite) super.createDialogArea(parent);
Composite composite = new Composite(parentComp, SWT.NONE);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
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);
composite.setLayout(layout);
tabFolder = new TabFolder(composite, SWT.NONE);
tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
layout = new GridLayout();
tabFolder.setLayout(layout);
TabItem item = new TabItem(tabFolder, SWT.NONE);
item.setText(Messages.tabItemFuncSetting);
Composite functionComposite = createFunctionSettingComposite();
item.setControl(functionComposite);
item = new TabItem(tabFolder, SWT.NONE);
item.setText(Messages.tabItemSQLScript);
Composite sqlComp = createSqlScriptComposite();
item.setControl(sqlComp);
tabFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (tabFolder.getSelectionIndex() == 0) {
funcNameText.setFocus();
} else if (tabFolder.getSelectionIndex() == tabFolder.getItemCount() - 1) {
sqlScriptText.setText(getSQLScript());
}
}
});
initialize();
if (isNewFlag()) {
setTitle(Messages.titleAddFunctionDialog);
setMessage(Messages.msgAddFunctionDialog);
funcNameText.setFocus();
} else {
setTitle(Messages.titleEditFunctionDialog);
setMessage(Messages.msgEditFunctionDialog);
}
return parentComp;
}
use of org.eclipse.swt.widgets.TabItem in project cubrid-manager by CUBRID.
the class EditProcedureDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
isCommentSupport = CompatibleUtil.isCommentSupports(database.getDatabaseInfo());
Composite parentComp = (Composite) super.createDialogArea(parent);
Composite composite = new Composite(parentComp, SWT.NONE);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
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);
composite.setLayout(layout);
tabFolder = new TabFolder(composite, SWT.NONE);
tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
layout = new GridLayout();
tabFolder.setLayout(layout);
TabItem item = new TabItem(tabFolder, SWT.NONE);
item.setText(Messages.tabItemProcSetting);
Composite procedureSettingComposite = createProcedureSettingComposite();
item.setControl(procedureSettingComposite);
item = new TabItem(tabFolder, SWT.NONE);
item.setText(Messages.tabItemProcSQLScript);
Composite sqlCompo = createSqlScriptComposite();
item.setControl(sqlCompo);
tabFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (tabFolder.getSelectionIndex() == 0) {
procNameText.setFocus();
} else if (tabFolder.getSelectionIndex() == tabFolder.getItemCount() - 1) {
sqlScriptText.setText(getSQLScript());
}
}
});
initialize();
if (isNewFlag()) {
setTitle(Messages.titleAddProcedureDialog);
setMessage(Messages.msgAddProcedureDialog);
procNameText.setFocus();
} else {
setTitle(Messages.titleEditProcedureDialog);
setMessage(Messages.msgEditProcedureDialog);
}
return parentComp;
}
use of org.eclipse.swt.widgets.TabItem in project cubrid-manager by CUBRID.
the class CreateTriggerDialog method createDialogArea.
/**
* Create dialog area content
*
* @param parent the parent composite
*
* @return the composite
*/
protected Control createDialogArea(Composite parent) {
isCommentSupport = CompatibleUtil.isCommentSupports(database.getDatabaseInfo());
Composite parentComp = (Composite) super.createDialogArea(parent);
parentComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
Composite tabComposite = new Composite(parentComp, SWT.NONE);
{
final GridData gdComposite = new GridData(SWT.FILL, SWT.FILL, true, true);
tabComposite.setLayoutData(gdComposite);
GridLayout tabCompositeLayout = new GridLayout();
tabCompositeLayout.numColumns = 1;
tabCompositeLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
tabCompositeLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
tabCompositeLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
tabCompositeLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
tabCompositeLayout.numColumns = 1;
tabComposite.setLayout(tabCompositeLayout);
}
tabFolder = new TabFolder(tabComposite, SWT.NONE);
tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
//create trigger tab
final TabItem triggerTabItem = new TabItem(tabFolder, SWT.NONE);
triggerTabItem.setText(Messages.infoTriggerTab);
triggerTabItem.setControl(createTriggerComposite(tabFolder));
//create the SQL tab
final Composite sqlScriptComposite = new Composite(tabFolder, SWT.NONE);
sqlScriptComposite.setLayout(new GridLayout());
final TabItem sqlScriptTabItem = new TabItem(tabFolder, SWT.NONE);
sqlScriptTabItem.setText(Messages.infoSQLScriptTab);
sqlScriptTabItem.setControl(sqlScriptComposite);
sqlText = new StyledText(sqlScriptComposite, SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY | SWT.H_SCROLL | SWT.BORDER);
CommonUITool.registerContextMenu(sqlText, false);
sqlText.setBackground(white);
sqlText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
setTitle(Messages.newTriggerMSGTitle);
setMessage(Messages.newTriggerMsg);
createInit();
alterInit();
addListener();
return parentComp;
}
use of org.eclipse.swt.widgets.TabItem in project cubrid-manager by CUBRID.
the class EditVirtualTableDialog method createFkIndexTabItem.
/**
* Create foreign key/Index tab item.
*
* @param tabFolder the object of TabFolder
*/
private void createFkIndexTabItem(final TabFolder tabFolder) {
final TabItem foreignKeyTabItem = new TabItem(tabFolder, SWT.NONE);
foreignKeyTabItem.setText(Messages.infoIndexesTab);
final Composite composite = new Composite(tabFolder, SWT.NONE);
GridLayout gridLayout = new GridLayout();
composite.setLayout(gridLayout);
foreignKeyTabItem.setControl(composite);
// create the fk table viewer
final Label fkLabel = new Label(composite, SWT.NONE);
fkLabel.setText(Messages.lblFK);
fkTableView = new TableViewer(composite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
fkTable = fkTableView.getTable();
final GridData gdFkTable = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1);
fkTable.setLayoutData(gdFkTable);
fkTable.setLinesVisible(true);
fkTable.setHeaderVisible(true);
TableColumn tblCol = new TableColumn(fkTable, SWT.NONE);
tblCol.setWidth(100);
tblCol.setText(Messages.tblColumnFK);
tblCol = new TableColumn(fkTable, SWT.NONE);
tblCol.setWidth(119);
tblCol.setText(Messages.tblColumnColumnName);
tblCol = new TableColumn(fkTable, SWT.NONE);
tblCol.setWidth(93);
tblCol.setText(Messages.tblColumnForeignTable);
tblCol = new TableColumn(fkTable, SWT.NONE);
tblCol.setWidth(143);
tblCol.setText(Messages.tblColumnForeignColumnName);
tblCol = new TableColumn(fkTable, SWT.NONE);
tblCol.setWidth(84);
tblCol.setText(Messages.tblColumnUpdateRule);
tblCol = new TableColumn(fkTable, SWT.NONE);
tblCol.setWidth(86);
tblCol.setText(Messages.tblColumnDeleteRule);
tblCol = new TableColumn(fkTable, SWT.NONE);
tblCol.setWidth(100);
tblCol.setText(Messages.tblColumnCacheColumn);
FKTableViewerContentProvider fkContentProvider = new FKTableViewerContentProvider();
FKTableViewerLabelProvider fkLabelProvider = new FKTableViewerLabelProvider(database.getDatabaseInfo(), erSchema);
fkTableView.setContentProvider(fkContentProvider);
fkTableView.setLabelProvider(fkLabelProvider);
fkTableView.setInput(getNewSchemaInfo());
final Composite fkBtnComposite = new Composite(composite, SWT.NONE);
final GridData gdBtnComposite = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
fkBtnComposite.setLayoutData(gdBtnComposite);
gridLayout = new GridLayout();
gridLayout.numColumns = 3;
fkBtnComposite.setLayout(gridLayout);
final GridData gdFKBTN = new GridData(SWT.LEFT, SWT.CENTER, false, false);
final Button addFKBTN = new Button(fkBtnComposite, SWT.NONE);
addFKBTN.setLayoutData(gdFKBTN);
addFKBTN.setText(Messages.btnAddFk);
addFKBTN.addSelectionListener(new AddFkBtnListenerOnFkIndexTab());
final Button editFKBTN = new Button(fkBtnComposite, SWT.NONE);
editFKBTN.setLayoutData(gdFKBTN);
editFKBTN.setEnabled(false);
editFKBTN.setText(Messages.btnEditFk);
editFKBTN.addSelectionListener(new EditFkBtnListenerOnFkIndexTab());
final Button deleteFKBTN = new Button(fkBtnComposite, SWT.NONE);
deleteFKBTN.setLayoutData(gdFKBTN);
deleteFKBTN.setEnabled(false);
deleteFKBTN.setText(Messages.btnDelFk);
deleteFKBTN.addSelectionListener(new DelFkBtnListenerOnFkIndexTab());
fkTable.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
SchemaInfo newSchemaInfo = getNewSchemaInfo();
if (database == null || database.getDatabaseInfo() == null || newSchemaInfo == null) {
return;
}
TableItem[] items = fkTable.getSelection();
if (items == null || items.length == 0) {
deleteFKBTN.setEnabled(false);
editFKBTN.setEnabled(false);
} else {
deleteFKBTN.setEnabled(true);
editFKBTN.setEnabled(items.length == 1);
for (TableItem item : items) {
String fkName = item.getText(0);
List<SchemaInfo> superList = SuperClassUtil.getSuperClasses(database.getDatabaseInfo(), newSchemaInfo.getSuperClasses());
if (newSchemaInfo.isInSuperClasses(superList, fkName)) {
deleteFKBTN.setEnabled(false);
editFKBTN.setEnabled(false);
}
}
}
}
});
// create index table view
final Label indexLabel = new Label(composite, SWT.NONE);
indexLabel.setText(Messages.lblIndexes);
indexTableView = new TableViewer(composite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
indexTable = indexTableView.getTable();
indexTable.setLinesVisible(true);
indexTable.setHeaderVisible(true);
final GridData gdIndexTable = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1);
indexTable.setLayoutData(gdIndexTable);
tblCol = new TableColumn(indexTable, SWT.NONE);
tblCol.setWidth(150);
tblCol.setText(Messages.tblColumnIndexName);
tblCol = new TableColumn(indexTable, SWT.NONE);
tblCol.setWidth(78);
tblCol.setText(Messages.tblColumnIndexType);
tblCol = new TableColumn(indexTable, SWT.NONE);
tblCol.setWidth(218);
tblCol.setText(Messages.tblColumnOnColumns);
tblCol = new TableColumn(indexTable, SWT.NONE);
tblCol.setWidth(282);
tblCol.setText(Messages.tblColumnIndexRule);
IndexTableViewerContentProvider indexContentProvider = new IndexTableViewerContentProvider();
IndexTableViewerLabelProvider indexLabelProvider = new IndexTableViewerLabelProvider();
indexTableView.setContentProvider(indexContentProvider);
indexTableView.setLabelProvider(indexLabelProvider);
indexTableView.setInput(getNewSchemaInfo());
indexTableView.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
StructuredSelection selected = (StructuredSelection) event.getSelection();
if (selected == null) {
return;
}
Constraint constraint = (Constraint) selected.getFirstElement();
openEditIndexDialog(constraint);
}
});
final Composite indexBtnComposite = new Composite(composite, SWT.NONE);
final GridData gdIndexBtnComposite = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
indexBtnComposite.setLayoutData(gdIndexBtnComposite);
gridLayout = new GridLayout();
gridLayout.numColumns = 3;
indexBtnComposite.setLayout(gridLayout);
final GridData gdIndexBTN = new GridData(SWT.LEFT, SWT.CENTER, false, false);
final Button addIndexBTN = new Button(indexBtnComposite, SWT.NONE);
addIndexBTN.setLayoutData(gdIndexBTN);
addIndexBTN.setText(Messages.btnAddIndex);
addIndexBTN.addSelectionListener(new AddIndexBtnListenerOnFkIndexTab());
final Button editIndexBTN = new Button(indexBtnComposite, SWT.NONE);
editIndexBTN.setLayoutData(gdIndexBTN);
editIndexBTN.setEnabled(false);
editIndexBTN.setText(Messages.btnEditIndex);
editIndexBTN.addSelectionListener(new EditIndexBtnListenerOnFkIndexTab());
final Button deleteIndexBTN = new Button(indexBtnComposite, SWT.NONE);
deleteIndexBTN.setLayoutData(gdIndexBTN);
deleteIndexBTN.setEnabled(false);
deleteIndexBTN.setText(Messages.btnDelIndex);
deleteIndexBTN.addSelectionListener(new DelIndexBtnListenerOnFkIndexTab());
indexTable.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
TableItem[] items = indexTable.getSelection();
if (items == null || items.length == 0) {
deleteIndexBTN.setEnabled(false);
editIndexBTN.setEnabled(false);
} else {
deleteIndexBTN.setEnabled(true);
editIndexBTN.setEnabled(items.length == 1);
}
}
});
}
Aggregations