List of usage examples for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_SPACING
int HORIZONTAL_SPACING
To view the source code for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_SPACING.
Click Source Link
From source file:com.nokia.carbide.remoteconnections.ui.ClientServiceSiteUI.java
License:Open Source License
public void createComposite(Composite parent) { initializeDialogUnits(parent);/* w w w . j a v a2s . co m*/ Group group = new Group(parent, SWT.NONE); group.setText(Messages.getString("ClientServiceSiteUI.UseConnectionGroupLabel")); //$NON-NLS-1$ group.setLayout(new GridLayout()); group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); group.setData(UID, "useConnectionGroup"); //$NON-NLS-1$ viewer = new ComboViewer(group, SWT.READ_ONLY); viewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { Check.checkContract(element instanceof IConnection); return ((IConnection) element).getDisplayName(); } }); viewer.setContentProvider(new ArrayContentProvider()); GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); viewer.getCombo().setLayoutData(gd); viewer.getControl().setData(UID, "viewer"); //$NON-NLS-1$ viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection selection = (IStructuredSelection) event.getSelection(); IConnection connection = (IConnection) selection.getFirstElement(); if (!connection.equals(ClientServiceSiteUI.this.connection)) { ClientServiceSiteUI.this.connection = connection; fireConnectionSelected(); } } }); final Composite composite = new Composite(group, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.makeColumnsEqualWidth = true; layout.marginWidth = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = Dialog.convertVerticalDLUsToPixels(fm, IDialogConstants.VERTICAL_MARGIN); layout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = Dialog.convertVerticalDLUsToPixels(fm, IDialogConstants.VERTICAL_SPACING); composite.setLayout(layout); gd = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER); composite.setLayoutData(gd); composite.setFont(parent.getFont()); newButton = new Button(composite, SWT.PUSH); newButton.setText(Messages.getString("ClientServiceSiteUI.NewButtonLabel")); //$NON-NLS-1$ newButton.setFont(JFaceResources.getDialogFont()); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); int widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH); Point minSize = newButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); gd.widthHint = Math.max(widthHint, minSize.x); newButton.setLayoutData(gd); newButton.setData(UID, "newButton"); //$NON-NLS-1$ newButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { SettingsWizard wizard = new SettingsWizard(null, service); wizard.open(composite.getShell()); setViewerInput(wizard.getConnectionToEdit()); } }); editButton = new Button(composite, SWT.PUSH); editButton.setText(Messages.getString("ClientServiceSiteUI.EditButtonLabel")); //$NON-NLS-1$ editButton.setFont(JFaceResources.getDialogFont()); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH); minSize = editButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); gd.widthHint = Math.max(widthHint, minSize.x); editButton.setLayoutData(gd); editButton.setData(UID, "editButton"); //$NON-NLS-1$ editButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection selection = (IStructuredSelection) viewer.getSelection(); Object value = selection.getFirstElement(); if (value instanceof IConnection) { SettingsWizard wizard = new SettingsWizard((IConnection) value, service); wizard.open(composite.getShell()); setViewerInput(wizard.getConnectionToEdit()); } } }); setViewerInput(null); }
From source file:com.nokia.carbide.search.system.internal.ui.SearchDialog.java
License:Open Source License
protected Control createButtonBar(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 0; // create 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);//from w ww. j a v a2 s . c o m composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // create help control if needed if (isHelpAvailable()) { createHelpControl(composite); } fCustomizeButton = createButton(composite, CUSTOMIZE_ID, SearchMessages.SearchDialog_customize, true); Label filler = new Label(composite, SWT.NONE); filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); layout.numColumns++; fReplaceButton = createActionButton(composite, REPLACE_ID, SearchMessages.SearchDialog_replaceAction, true); fReplaceButton.setVisible(fCurrentPage instanceof IReplacePage); Button searchButton = createActionButton(composite, SEARCH_ID, SearchMessages.SearchDialog_searchAction, true); searchButton.setEnabled(fDescriptors.size() > 0); super.createButtonsForButtonBar(composite); // cancel button return composite; }
From source file:com.nokia.carbide.search.system.internal.ui.text.ReplaceDialog2.java
License:Open Source License
protected Control createButtonBar(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 0; // createActionButton increments 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);//from www . j ava 2 s. co m composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fReplaceButton = createActionButton(composite, REPLACE, SearchMessages.ReplaceDialog_replace, true); fReplaceAllInFileButton = createActionButton(composite, REPLACE_ALL_IN_FILE, SearchMessages.ReplaceDialog_replaceAllInFile, false); Label filler = new Label(composite, SWT.NONE); filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); fReplaceAllButton = createActionButton(composite, REPLACE_ALL, SearchMessages.ReplaceDialog_replaceAll, false); fSkipButton = createActionButton(composite, SKIP, SearchMessages.ReplaceDialog_skip, false); fSkipFileButton = createActionButton(composite, SKIP_FILE, SearchMessages.ReplaceDialog_skipFile, false); filler = new Label(composite, SWT.NONE); filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); super.createButtonsForButtonBar(composite); // cancel button layout.numColumns = 4; // createActionButton increments return composite; }
From source file:com.nokia.cdt.internal.debug.launch.newwizard.ConnectToDeviceDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { initializeDialogUnits(parent);//from w ww . ja v a 2s . c o m final Composite composite = initDialogArea(parent, Messages.getString("ConnectToDeviceDialog.Title"), //$NON-NLS-1$ LaunchWizardHelpIds.WIZARD_DIALOG_CHANGE_CONNECTION); Group viewerGroup = new Group(composite, SWT.NONE); viewerGroup.setText(Messages.getString("ConnectToDeviceDialog.GroupLabel")); //$NON-NLS-1$ GridDataFactory.fillDefaults().applyTo(viewerGroup); GridLayoutFactory.swtDefaults().applyTo(viewerGroup); viewer = new ComboViewer(viewerGroup, SWT.READ_ONLY); viewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof IConnection) return ((IConnection) element).getDisplayName(); return Messages.getString("ConnectToDeviceDialog.NoCurrentItem"); //$NON-NLS-1$ } }); viewer.setContentProvider(new ArrayContentProvider()); Combo combo = viewer.getCombo(); GridDataFactory.defaultsFor(combo).grab(true, false).applyTo(combo); viewer.getControl().setData(UID, "combo_viewer"); //$NON-NLS-1$ viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { if (getDialogArea() != null) connectionSelected(getConnectionFromSelection(event.getSelection())); } }); manager.addConnectionListener(this); parent.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { manager.removeConnectionListener(ConnectToDeviceDialog.this); if (currentServiceListener != null) currentServiceListener.removeStatusChangedListener(ConnectToDeviceDialog.this); } }); final Composite buttonGroup = new Composite(viewerGroup, SWT.NONE); int w = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_MARGIN); int h = Dialog.convertVerticalDLUsToPixels(fm, IDialogConstants.VERTICAL_MARGIN); int hs = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_SPACING); int vs = Dialog.convertVerticalDLUsToPixels(fm, IDialogConstants.VERTICAL_SPACING); GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(true).margins(w, h).spacing(hs, vs) .applyTo(buttonGroup); GridDataFactory.swtDefaults().align(SWT.END, SWT.CENTER).applyTo(buttonGroup); buttonGroup.setFont(parent.getFont()); newButton = new Button(buttonGroup, SWT.PUSH); newButton.setText(Messages.getString("ConnectToDeviceDialog.NewLabel")); //$NON-NLS-1$ newButton.setFont(JFaceResources.getDialogFont()); int widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH); Point minSize = newButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); widthHint = Math.max(widthHint, minSize.x); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.TOP).hint(widthHint, SWT.DEFAULT).applyTo(newButton); newButton.setData(UID, "newButton"); //$NON-NLS-1$ newButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { SettingsWizard wizard = new SettingsWizard(null, connectionData.getService()); wizard.open(composite.getShell()); IConnection connection = wizard.getConnectionToEdit(); setViewerInput(connection); } }); editButton = new Button(buttonGroup, SWT.PUSH); editButton.setText(Messages.getString("ConnectToDeviceDialog.EditLabel")); //$NON-NLS-1$ editButton.setFont(JFaceResources.getDialogFont()); widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH); minSize = editButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); widthHint = Math.max(widthHint, minSize.x); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).hint(widthHint, SWT.DEFAULT).applyTo(editButton); editButton.setData(UID, "editButton"); //$NON-NLS-1$ editButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IConnection connection = getConnectionFromSelection(viewer.getSelection()); if (connection != null) { SettingsWizard wizard = new SettingsWizard(connection, connectionData.getService()); wizard.open(composite.getShell()); } } }); descriptionLabel = new Label(composite, SWT.WRAP); GridDataFactory.defaultsFor(descriptionLabel).grab(false, true).applyTo(descriptionLabel); composite.addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { descriptionLabel.pack(); } }); setViewerInput(connectionData.getConnection()); return composite; }
From source file:com.nokia.tools.variant.common.ui.dialogs.OptionalMessageDialog.java
License:Open Source License
protected Control createCustomArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout);/*from w ww. j av a 2s.c o m*/ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); hideDialogCheckBox = new Button(composite, SWT.CHECK | SWT.LEFT); hideDialogCheckBox.setText(checkBoxText); hideDialogCheckBox.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { setDialogEnabled(id, !((Button) e.widget).getSelection()); } }); applyDialogFont(hideDialogCheckBox); return hideDialogCheckBox; }
From source file:com.nokia.tools.variant.compare.ui.wizards.ImportDataWizardPageOne.java
License:Open Source License
private GridLayout initGridLayout(GridLayout layout, boolean margins) { layout.horizontalSpacing = pixelConverter .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = pixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); if (margins) { layout.marginWidth = pixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = pixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); } else {/*from w w w .j a va 2 s .c om*/ layout.marginWidth = 0; layout.marginHeight = 0; } return layout; }
From source file:com.nokia.tools.variant.resourcelibrary.handlers.commands.ResourcePickDialog.java
License:Open Source License
private Control createRenameBar(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); 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);/*from w w w .j av a 2 s .com*/ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); if (resource.size() == 1) { dialogField = new StringDialogField(); String filename = ""; if ((resource != null) && (resource.size() > 0)) { filename = resource.get(0).getName(); } dialogField.setLabelText("File/Folder name: "); dialogField.setText(filename); dialogField.setDialogFieldListener(this); dialogField.doFillIntoGrid(composite, 2); LayoutUtil.setHorizontalGrabbing(dialogField.getTextControl(composite)); } return composite; }
From source file:com.nokia.tools.vct.internal.common.secure.ui.dialogs.InputPasswordDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) parent; GridLayout layout = new GridLayout(1, true); 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);// w w w . j a va 2 s .c om Label label = new Label(composite, SWT.WRAP); label.setText("Enter your private key password"); GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); label.setLayoutData(data); text = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD); text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); chkSavePassword = new Button(composite, SWT.CHECK); chkSavePassword.setText("Save password"); return composite; }
From source file:com.pps.webos.wizards.NewWebOSProjectWizardPage1.java
License:Open Source License
/** * @param layout/* w ww . j a v a 2s .c o m*/ * @param margins * @return */ private GridLayout initGridLayout(GridLayout layout, boolean margins) { layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); if (margins) { layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); } else { layout.marginWidth = 4; layout.marginHeight = 7; } return layout; }
From source file:com.safi.workshop.sqlexplorer.dialogs.CreateAliasDlg.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { // top level composite Composite parentComposite = (Composite) super.createDialogArea(parent); // create a composite with standard margins and spacing Composite composite = new Composite(parentComposite, SWT.NONE); GridLayout layout = new GridLayout(); 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);//w ww.ja v a2s. c o m final GridData gd_composite = new GridData(SWT.FILL, SWT.FILL, true, true); gd_composite.heightHint = 350; composite.setLayoutData(gd_composite); composite.setFont(parentComposite.getFont()); Composite nameGroup = new Composite(composite, SWT.NONE); layout = new GridLayout(); layout.numColumns = 3; layout.marginWidth = 10; nameGroup.setLayout(layout); GridData data = new GridData(SWT.FILL, SWT.TOP, true, false); data.heightHint = 345; nameGroup.setLayoutData(data); Label label = new Label(nameGroup, SWT.WRAP); label.setText("Name"); //$NON-NLS-1$ nameField = new Text(nameGroup, SWT.BORDER); if (type != Type.CREATE) nameField.setText(alias.getName()); data = new GridData(SWT.FILL, SWT.CENTER, true, false); data.widthHint = 250; nameField.setLayoutData(data); nameField.addKeyListener(new KeyListener() { public void keyPressed(org.eclipse.swt.events.KeyEvent e) { CreateAliasDlg.this.validate(); }; public void keyReleased(org.eclipse.swt.events.KeyEvent e) { CreateAliasDlg.this.validate(); }; }); final Button wizardButton = new Button(nameGroup, SWT.NONE); wizardButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final DBConnectionWizard connectionWizard = new DBConnectionWizard(); connectionWizard.setAlias(alias); connectionWizard.setDriver(getSelectedDriver()); connectionWizard.setAuthRequired(!noUsernameRequired.getSelection()); connectionWizard.setUser(userField.getText()); connectionWizard.setConnectionName(nameField.getText()); connectionWizard.setPassword(passwordField.getText()); connectionWizard.setProperties(localProperties); connectionWizard.setUrl(urlField.getText()); WizardDialog dialog = new DBConnectionWizardDialog(getShell(), connectionWizard); int result = dialog.open(); if (Window.OK == result) { urlField.setText(connectionWizard.getUrl()); userField.setText(connectionWizard.getUser()); passwordField.setText(connectionWizard.getPassword()); noUsernameRequired.setSelection(!connectionWizard.isAuthRequired()); nameField.setText(connectionWizard.getConnectionName()); } validate(); } }); wizardButton.setToolTipText("Open Database Connection Wizard"); /* * wizardButton.setImage(ResourceManager.getPluginImage(SQLExplorerPlugin.getDefault(), * "icons/new_connection.gif")); */ wizardButton .setImage(AsteriskDiagramEditorPlugin.getDefault().getBundledImage("icons/DBCreationWizard.gif")); final GridData gd_wizardButton = new GridData(SWT.CENTER, SWT.CENTER, true, false); wizardButton.setLayoutData(gd_wizardButton); Label label2 = new Label(nameGroup, SWT.WRAP); label2.setText("Driver"); //$NON-NLS-1$ cboDriver = new Combo(nameGroup, SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY); final GridData gd_driver = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); gd_driver.widthHint = SIZING_TEXT_FIELD_WIDTH; cboDriver.setLayoutData(gd_driver); String defaultDriverName = AsteriskDiagramEditorPlugin.getDefault().getPluginPreferences() .getString(IConstants.DEFAULT_DRIVER); ManagedDriver defaultDriver = null; int defaultDriverIndex = 0; populateCombo(); for (Entry<Integer, ManagedDriver> entry : comboDriverIndexes.entrySet()) { ManagedDriver driver = entry.getValue(); if (driver.getId().startsWith(defaultDriverName)) { defaultDriver = driver; defaultDriverIndex = entry.getKey(); break; } } Button btnListDrivers = new Button(nameGroup, SWT.NULL); btnListDrivers.setText(Messages.getString("AliasDialog.EditDrivers")); //$NON-NLS-1$ final GridData gd_btnListDrivers = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); btnListDrivers.setLayoutData(gd_btnListDrivers); btnListDrivers.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { DriverMaintenanceDialog dlg = new DriverMaintenanceDialog(SafiWorkshopEditorUtil.getActiveShell()); int result = dlg.open(); if (result == Window.OK) { populateCombo(); SafiWorkshopEditorUtil.getSafiNavigator().refresh(); } } }); Label label3 = new Label(nameGroup, SWT.WRAP); label3.setText("URL"); //$NON-NLS-1$ urlField = new Text(nameGroup, SWT.BORDER); data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.horizontalSpan = 2; data.widthHint = SIZING_TEXT_FIELD_WIDTH; urlField.setLayoutData(data); urlField.addKeyListener(new KeyListener() { public void keyPressed(org.eclipse.swt.events.KeyEvent e) { CreateAliasDlg.this.validate(); }; public void keyReleased(org.eclipse.swt.events.KeyEvent e) { CreateAliasDlg.this.validate(); }; }); new Label(nameGroup, SWT.NONE); noUsernameRequired = new Button(nameGroup, SWT.CHECK); noUsernameRequired.setText("Username is not required for this database"); new Label(nameGroup, SWT.NONE); Label label4 = new Label(nameGroup, SWT.WRAP); label4.setText("User Name"); //$NON-NLS-1$ userField = new Text(nameGroup, SWT.BORDER); data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.horizontalSpan = 2; data.widthHint = SIZING_TEXT_FIELD_WIDTH; userField.setLayoutData(data); userField.addKeyListener(new KeyListener() { public void keyPressed(org.eclipse.swt.events.KeyEvent e) { CreateAliasDlg.this.validate(); }; public void keyReleased(org.eclipse.swt.events.KeyEvent e) { CreateAliasDlg.this.validate(); }; }); Label label5 = new Label(nameGroup, SWT.WRAP); label5.setText("Password"); //$NON-NLS-1$ passwordField = new Text(nameGroup, SWT.BORDER); passwordField.setEchoChar('*'); data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.horizontalSpan = 2; data.widthHint = SIZING_TEXT_FIELD_WIDTH; passwordField.setLayoutData(data); cboDriver.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { ManagedDriver driver = getSelectedDriver(); urlField.setText(driver.getUrl()); CreateAliasDlg.this.validate(); wizardButton.setEnabled(true); }; }); if (!comboDriverIndexes.isEmpty() && defaultDriver != null) { cboDriver.select(defaultDriverIndex); urlField.setText(defaultDriver.getUrl()); } new Label(nameGroup, SWT.NONE); final Composite connectionPropertiesComposite = new Composite(nameGroup, SWT.NONE); connectionPropertiesComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); final GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 3; connectionPropertiesComposite.setLayout(gridLayout); new Label(nameGroup, SWT.NONE); /* final Button */ /* final Button *//* final Button */ /* final Button */new Label(nameGroup, SWT.NONE); User user = alias.getDefaultUser(); final Label connectTimeoutLabel = new Label(connectionPropertiesComposite, SWT.NONE); connectTimeoutLabel.setText("Connect timeout(sec)"); timeoutSpinner = new Spinner(connectionPropertiesComposite, SWT.BORDER); timeoutSpinner.setLayoutData(new GridData()); DBConnection connection = alias.getConnection(); timeoutSpinner.setSelection(connection.getLoginTimeout()); commitOnCloseButton = new Button(connectionPropertiesComposite, SWT.CHECK); commitOnCloseButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false)); commitOnCloseButton.setToolTipText("Sets the default for new SQL editors"); commitOnCloseButton.setText("Commit on close"); if (user != null) { commitOnCloseButton.setEnabled(!user.isAutoCommit()); commitOnCloseButton.setSelection(user.isCommitOnClose()); } noUsernameRequired.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { userField.setEnabled(!noUsernameRequired.getSelection()); passwordField.setEnabled(!noUsernameRequired.getSelection()); } }); if (alias.hasNoUserName()) { noUsernameRequired.setSelection(true); userField.setEnabled(false); passwordField.setEnabled(false); } else { noUsernameRequired.setSelection(false); userField.setEnabled(true); passwordField.setEnabled(true); if (alias.getDefaultUser() != null) { String userName = alias.getDefaultUser().getUserName(); userField.setText(userName == null ? "" : userName); String password = alias.getDefaultUser().getPassword(); passwordField.setText(password == null ? "" : password); } } wizardButton.setEnabled(false); if (type != Type.CREATE) { if (alias.getDriver() != null) { cboDriver.setText(alias.getDriver().getId()); wizardButton.setEnabled(true); } urlField.setText(alias.getUrl()); Properties props = alias.getConnection().getProperties(); if (props != null) localProperties = (Properties) props.clone(); else localProperties = new Properties(); } else { localProperties = new Properties(); if (navSelectedDriver != null) { cboDriver.select(cboDriver.indexOf(navSelectedDriver.getId())); urlField.setText(navSelectedDriver.getUrl()); wizardButton.setEnabled(true); } } final Group pool = new Group(nameGroup, SWT.NONE); pool.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false)); pool.setText("Pool info"); final GridLayout gridLayout_1 = new GridLayout(); gridLayout_1.numColumns = 4; pool.setLayout(gridLayout_1); final Label minLabel = new Label(pool, SWT.NONE); minLabel.setText("Min"); minSpinner = new Spinner(pool, SWT.BORDER); minSpinner.setSelection(connection.getMinPoolSize()); final Label maxLabel = new Label(pool, SWT.NONE); maxLabel.setText("Max"); maxSpinner = new Spinner(pool, SWT.BORDER); maxSpinner.setSelection(connection.getMaxPoolSize()); final Label acquireInc = new Label(pool, SWT.NONE); final GridData gd_acquireInc = new GridData(); acquireInc.setLayoutData(gd_acquireInc); acquireInc.setText("Increment"); incSpinner = new Spinner(pool, SWT.BORDER); incSpinner.setSelection(connection.getAcquireIncrement()); final Label maxIdlesecLabel = new Label(pool, SWT.NONE); maxIdlesecLabel.setText("Max Idle (sec)"); idleSpinner = new Spinner(pool, SWT.BORDER); idleSpinner.setSelection(connection.getMaxIdleTime()); new Label(nameGroup, SWT.NONE); new Label(nameGroup, SWT.NONE); final Composite composite_1 = new Composite(nameGroup, SWT.NONE); composite_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 2, 1)); final GridLayout gridLayout_2 = new GridLayout(); gridLayout_2.marginTop = 10; gridLayout_2.numColumns = 2; composite_1.setLayout(gridLayout_2); final Button editAdditionalPropertiesButton = new Button(composite_1, SWT.NONE); final GridData gd_editAdditionalPropertiesButton = new GridData(SWT.RIGHT, SWT.CENTER, false, false); gd_editAdditionalPropertiesButton.widthHint = 120; editAdditionalPropertiesButton.setLayoutData(gd_editAdditionalPropertiesButton); editAdditionalPropertiesButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (propertyDialog == null) { propertyDialog = new PropertyEditorDialog(getShell(), localProperties); propertyDialog.open(); } else { propertyDialog.open(); } } }); editAdditionalPropertiesButton.setText("Additional Properties"); final Button testconnectionButton = new Button(composite_1, SWT.NONE); final GridData gd_testconnectionButton = new GridData(SWT.RIGHT, SWT.CENTER, false, false); gd_testconnectionButton.widthHint = 120; testconnectionButton.setLayoutData(gd_testconnectionButton); testconnectionButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { String result = createConnection(); if (result == null) MessageDialog.openInformation(getShell(), "Test Connection", "Connection Established"); else MessageDialog.openError(getShell(), "Test Connection", "Connection could not be established: " + result); } }); testconnectionButton.setText("Test Connection"); new Label(nameGroup, SWT.NONE); return parentComposite; }