List of usage examples for org.eclipse.jface.dialogs IDialogConstants VERTICAL_MARGIN
int VERTICAL_MARGIN
To view the source code for org.eclipse.jface.dialogs IDialogConstants VERTICAL_MARGIN.
Click Source Link
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 w w.java 2 s. com*/ 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 ww w.j av a 2 s .co 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 {// w ww. j av a 2s . c o m 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 ww w . j a va 2 s . c o m*/ 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);/*from w w w. java 2 s. co m*/ 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/*from w w w. ja v a 2s.c om*/ * @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);/*from w ww. j a va 2 s . c om*/ 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; }
From source file:com.safi.workshop.sqlexplorer.dialogs.CreateDriverDlg.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);/*from ww w .j a v a 2 s . c o m*/ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); 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(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); nameGroup.setLayoutData(data); Composite topComposite = new Composite(nameGroup, SWT.NONE); data = new GridData(GridData.FILL_VERTICAL | GridData.FILL_HORIZONTAL); data.horizontalSpan = 3; topComposite.setLayoutData(data); topComposite.setLayout(new GridLayout()); Group topGroup = new Group(topComposite, SWT.NULL); topGroup.setText(Messages.getString("Driver_14")); data = new GridData(GridData.FILL_VERTICAL | GridData.FILL_HORIZONTAL); data.horizontalSpan = 3; data.widthHint = SIZING_TEXT_FIELD_WIDTH; topGroup.setLayoutData(data); layout = new GridLayout(); layout.numColumns = 4; layout.marginWidth = 5; topGroup.setLayout(layout); Label label = new Label(topGroup, SWT.WRAP); label.setText(Messages.getString("Name_15")); nameField = new Text(topGroup, SWT.BORDER); data = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1); data.widthHint = 250; nameField.setLayoutData(data); nameField.addKeyListener(new KeyListener() { public void keyPressed(org.eclipse.swt.events.KeyEvent e) { CreateDriverDlg.this.validate(); }; public void keyReleased(org.eclipse.swt.events.KeyEvent e) { CreateDriverDlg.this.validate(); }; }); Label label5 = new Label(topGroup, SWT.WRAP); label5.setText(Messages.getString("Example_URL_16")); exampleUrlField = new Text(topGroup, SWT.BORDER); data = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1); data.widthHint = 250; exampleUrlField.setLayoutData(data); exampleUrlField.addKeyListener(new KeyListener() { public void keyPressed(org.eclipse.swt.events.KeyEvent e) { CreateDriverDlg.this.validate(); }; public void keyReleased(org.eclipse.swt.events.KeyEvent e) { CreateDriverDlg.this.validate(); }; }); Composite centralComposite = new Composite(nameGroup, SWT.NONE); data = new GridData(GridData.FILL_VERTICAL | GridData.FILL_HORIZONTAL); data.horizontalSpan = 3; data.verticalSpan = 4; data.heightHint = 200; centralComposite.setLayoutData(data); centralComposite.setLayout(new FillLayout()); TabFolder tabFolder = new TabFolder(centralComposite, SWT.NULL); TabItem item1 = new TabItem(tabFolder, SWT.NULL); item1.setText(Messages.getString("Java_Class_Path_17")); TabItem item2 = new TabItem(tabFolder, SWT.NULL); item2.setText(Messages.getString("Extra_Class_Path_18")); createJavaClassPathPanel(tabFolder, item1); createExtraClassPathPanel(tabFolder, item2); Label label4 = new Label(nameGroup, SWT.WRAP); label4.setText(Messages.getString("Driver_Class_Name_19")); combo = new Combo(nameGroup, SWT.BORDER | SWT.DROP_DOWN); data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; data.horizontalSpan = 2; combo.setLayoutData(data); combo.addSelectionListener(new org.eclipse.swt.events.SelectionListener() { public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) { } public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { CreateDriverDlg.this.validate(); }; }); combo.addKeyListener(new KeyListener() { public void keyPressed(org.eclipse.swt.events.KeyEvent e) { CreateDriverDlg.this.validate(); }; public void keyReleased(org.eclipse.swt.events.KeyEvent e) { CreateDriverDlg.this.validate(); }; }); nameGroup.layout(); guideUrlLabel = new Label(topGroup, SWT.NONE); guideUrlLabel.setText("Guide URL:"); guideUrlField = new Text(topGroup, SWT.BORDER); final GridData gd_guideUrlField = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1); guideUrlField.setLayoutData(gd_guideUrlField); urlRegexPatternLabel = new Label(topGroup, SWT.NONE); urlRegexPatternLabel.setText("URL Regex Pattern:"); regexField = new Text(topGroup, SWT.BORDER); final GridData gd_regexField = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1); regexField.setLayoutData(gd_regexField); testButton = new Button(topGroup, SWT.NONE); testButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { try { if (Pattern.matches(regexField.getText(), exampleUrlField.getText())) { MessageDialog.openInformation(getShell(), "Success", "The pattern matches the example URL: " + exampleUrlField.getText()); } else { MessageDialog.openError(getShell(), "Failed", "The pattern does not match the example URL: " + exampleUrlField.getText()); } } catch (Exception e2) { MessageDialog.openError(getShell(), "Invalid", "The pattern does not seem to be a valid regex pattern"); } } }); testButton.setToolTipText("Test example URL against regex pattern"); testButton.setText("test"); defaultPortLabel = new Label(topGroup, SWT.NONE); defaultPortLabel.setToolTipText("Used to establish SSH tunnel"); defaultPortLabel.setText("Default Port:"); portSpinner = new Spinner(topGroup, SWT.BORDER); portSpinner.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1)); portSpinner.setTextLimit(6); portSpinner.setMaximum(66000); new Label(topGroup, SWT.NONE); loadData(); return parentComposite; }
From source file:com.safi.workshop.sqlexplorer.dialogs.PasswordConnDlg.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);/*from w w w.j a va2 s. c o m*/ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setFont(parentComposite.getFont()); Composite nameGroup = new Composite(composite, SWT.NONE); layout = new GridLayout(); layout.numColumns = 2; layout.marginWidth = 10; nameGroup.setLayout(layout); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); nameGroup.setLayoutData(data); Label label = new Label(nameGroup, SWT.WRAP); label.setText(Messages.getString("Alias_1")); //$NON-NLS-1$ Label aliasTxt = new Label(nameGroup, SWT.WRAP); aliasTxt.setText(alias.getName()); Label label2 = new Label(nameGroup, SWT.WRAP); label2.setText(Messages.getString("Driver_2")); //$NON-NLS-1$ Label driverTxt = new Label(nameGroup, SWT.WRAP); driverTxt.setText(alias.getDriver().getId()); Label label3 = new Label(nameGroup, SWT.WRAP); label3.setText(Messages.getString("Url_3")); //$NON-NLS-1$ Label urlTxt = new Label(nameGroup, SWT.WRAP); urlTxt.setText(alias.getUrl()); Label label4 = new Label(nameGroup, SWT.WRAP); label4.setText(Messages.getString("User_4")); //$NON-NLS-1$ userTxt = new Text(nameGroup, SWT.BORDER); if (user != null) userTxt.setText(user.getUserName()); data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; data.horizontalSpan = 1; userTxt.setLayoutData(data); Label label5 = new Label(nameGroup, SWT.WRAP); label5.setText(Messages.getString("Password_5")); //$NON-NLS-1$ pswdTxt = new Text(nameGroup, SWT.BORDER); if (user != null) pswdTxt.setText(user.getPassword()); pswdTxt.setEchoChar('*'); data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; data.horizontalSpan = 1; pswdTxt.setLayoutData(data); pswdTxt.setFocus(); fAutoCommitBox = new Button(nameGroup, SWT.CHECK); fAutoCommitBox.setText(Messages.getString("PasswordConnDlg.AutoCommit_1")); //$NON-NLS-1$ GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalAlignment = GridData.BEGINNING; gd.horizontalSpan = 1; fAutoCommitBox.setLayoutData(gd); fCommitOnCloseBox = new Button(nameGroup, SWT.CHECK); fCommitOnCloseBox.setText(Messages.getString("PasswordConnDlg.Commit_On_Close_2")); //$NON-NLS-1$ gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalAlignment = GridData.BEGINNING; gd.horizontalSpan = 2; fCommitOnCloseBox.setLayoutData(gd); fAutoCommitBox.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { if (fAutoCommitBox.getSelection()) { fCommitOnCloseBox.setEnabled(false); } else fCommitOnCloseBox.setEnabled(true); } }); fAutoCommitBox.getDisplay().asyncExec(new Runnable() { public void run() { IPreferenceStore store = SQLExplorerPlugin.getDefault().getPreferenceStore(); fCommitOnCloseBox.setSelection(store.getBoolean(IConstants.COMMIT_ON_CLOSE)); fAutoCommitBox.setSelection(store.getBoolean(IConstants.AUTO_COMMIT)); if (fAutoCommitBox.getSelection()) { fCommitOnCloseBox.setEnabled(false); } else fCommitOnCloseBox.setEnabled(true); } }); return parentComposite; }
From source file:com.safi.workshop.sqlexplorer.dialogs.SaveOutsideProjectDlg.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);//from w w w .j a v a2 s. c o m composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setFont(parentComposite.getFont()); Label label = new Label(composite, SWT.WRAP); String msg = Messages.getString("Confirm.SaveOutsideProject.Intro") + "\n\n"; IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); if (projects == null || projects.length == 0) msg = msg + Messages.getString("Confirm.SaveOutsideProject.NoProjectsConfigured"); msg = msg + Messages.getString("Confirm.SaveOutsideProject.SaveInProject"); label.setText(msg); return parentComposite; }