List of usage examples for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_MARGIN
int HORIZONTAL_MARGIN
To view the source code for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_MARGIN.
Click Source Link
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 v a 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. j a 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 w w. j a v a 2s .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; }
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 w ww . ja 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);//w w w . j a v a2 s . c om 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 ww w .j a v a 2 s.c om 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; }
From source file:com.telink.tc32eclipse.ui.dialogs.TCDBUserInputDialog.java
License:Open Source License
@Override protected Control createButtonBar(final Composite parent) { final Composite buttonBar = new Composite(parent, SWT.NONE); final GridLayout layout = new GridLayout(); layout.numColumns = 2;/*w w w . j a va 2 s . c o m*/ layout.makeColumnsEqualWidth = false; layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); buttonBar.setLayout(layout); final GridData data = new GridData(SWT.FILL, SWT.BOTTOM, true, false); data.grabExcessHorizontalSpace = true; data.grabExcessVerticalSpace = false; buttonBar.setLayoutData(data); buttonBar.setFont(parent.getFont()); // place a button on the left final Button leftButton = new Button(buttonBar, SWT.PUSH); leftButton.setText("Left!"); final GridData leftButtonData = new GridData(SWT.LEFT, SWT.CENTER, true, true); leftButtonData.grabExcessHorizontalSpace = true; leftButtonData.horizontalIndent = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); leftButton.setLayoutData(leftButtonData); // add the dialog's button bar to the right final Control buttonControl = super.createButtonBar(buttonBar); buttonControl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false)); return buttonBar; }
From source file:com.ultimatetech.cim.dialogs.FindClass.java
License:Open Source License
protected void createSearchFieldAndList(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 1;// w w w.j a v a 2 s . com layout.makeColumnsEqualWidth = false; layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); composite.setLayout(layout); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_CENTER); data.minimumWidth = 600; data.heightHint = 400; composite.setLayoutData(data); composite.setFont(parent.getFont()); Label title = new Label(composite, SWT.NONE); title.setText("Type the name of the class you are searching for. OK will select it in the tree."); //GridData gd = new GridData(); //gd.horizontalAlignment = SWT.LEFT; //title.setLayoutData(gd); GridData gridData = new GridData(); gridData.grabExcessHorizontalSpace = true; gridData.minimumWidth = 400; findClassName = new Text(composite, SWT.SINGLE | SWT.BORDER); findClassName.setLayoutData(gridData); findClassName.addKeyListener(new SearchKeyListener()); Composite tableComp = new Composite(composite, SWT.NONE); GridData tcgd = new GridData(); tcgd.grabExcessHorizontalSpace = true; tcgd.minimumWidth = 400; tableComp.setLayoutData(tcgd); //add table with all classes viewer = new TableViewer(tableComp, SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL); viewer.setContentProvider(new ViewContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); viewer.setInput(elements); viewer.getTable().setSize(400, 300); addTableColumns(viewer.getTable()); viewer.getTable().setHeaderVisible(false); viewer.addSelectionChangedListener(new SelectionListener()); //viewer.setSorter(new ViewerSorter()); }
From source file:com.ultimatetech.cim.dialogs.UsernamePasswordDialog.java
License:Open Source License
protected void createUsernameAndPasswordFields(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2;//from w w w . j a v a 2s . c om layout.makeColumnsEqualWidth = false; layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); composite.setLayout(layout); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_CENTER); data.minimumWidth = 300; composite.setLayoutData(data); composite.setFont(parent.getFont()); GridData gridData = new GridData(); gridData.grabExcessHorizontalSpace = true; gridData.minimumWidth = 150; Label title = new Label(composite, SWT.NONE); title.setText("Enter username and password to connect to CIMOM"); GridData gd = new GridData(); gd.horizontalAlignment = SWT.LEFT; gd.horizontalSpan = 2; title.setLayoutData(gd); Label usernameLabel = new Label(composite, SWT.NONE); usernameLabel.setText("Username:"); usernameValue = new Text(composite, SWT.SINGLE | SWT.BORDER); usernameValue.setLayoutData(gridData); Label passLabel = new Label(composite, SWT.NONE); passLabel.setText("Password:"); passValue = new Text(composite, SWT.SINGLE | SWT.BORDER); passValue.setEchoChar('*'); passValue.setLayoutData(gridData); }
From source file:com.windowtester.eclipse.ui.dialogs.ExceptionDetailsDialog.java
License:Open Source License
/** * Create the product information area// w w w . ja v a 2s . co m * * @param parent the parent of the product information area * @return the product information area */ protected Composite createProductInfoArea(Composite parent) { Composite composite = new Composite(parent, SWT.NULL); composite.setLayoutData(new GridData()); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); composite.setLayout(layout); new Label(composite, SWT.NONE).setText("Provider:"); new Label(composite, SWT.NONE).setText("Google, Inc."); new Label(composite, SWT.NONE).setText("Plug-in Name:"); new Label(composite, SWT.NONE).setText("WindowTester-Pro"); // new Label(composite, SWT.NONE).setText("Plug-in ID:"); // new Label(composite, SWT.NONE).setText(product.getPluginId()); // new Label(composite, SWT.NONE).setText("Version:"); // new Label(composite, SWT.NONE).setText(product.getVersion().toString()); return composite; }