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:net.rim.ejde.internal.ui.wizards.AbstractBlackBerryWizardPage.java
License:Open Source License
/** * Initialize the given grid layout./*ww w .j a v a 2 s .c o m*/ * * @param layout * The grid layout * @param margins * boolean indicating if the margin is required * @return The initialized <code>GridLayout</code> */ public 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 = 0; layout.marginHeight = 0; } return layout; }
From source file:net.sf.eclipsefp.haskell.ui.internal.wizards.NewProjectWizardPage.java
License:Open Source License
protected GridLayout initGridLayout(final GridLayout layout, final 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 {// w w w .j ava 2s .c om layout.marginWidth = 0; layout.marginHeight = 0; } return layout; }
From source file:net.sf.eclipsensis.dialogs.StatusMessageDialog.java
License:Open Source License
/** * @param parent/*from ww w . jav a2 s . com*/ */ protected void createControlAndMessageArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(1, false); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); composite.setLayout(layout); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); Control control = createControl(composite); control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); Label label = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); label.setLayoutData(data); composite = new Composite(parent, SWT.NONE); layout = new GridLayout(); layout.numColumns = 2; composite.setLayout(layout); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); mMessage = getMessage(); createMessageArea(composite); }
From source file:net.sourceforge.eclipsetrader.charts.dialogs.CustomPeriodDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { Composite content = new Composite(parent, SWT.NONE); GridLayout gridLayout = new GridLayout(4, false); gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); gridLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); gridLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); content.setLayout(gridLayout);//from w w w . j a va 2 s . co m content.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); Label label = new Label(content, SWT.NONE); label.setText(Messages.CustomPeriodDialog_BeginDate); begin = new Combo(content, SWT.READ_ONLY); begin.setVisibleItemCount(25); label = new Label(content, SWT.NONE); label.setText(Messages.CustomPeriodDialog_EndDate); end = new Combo(content, SWT.READ_ONLY); end.setVisibleItemCount(25); int first = -1, last = -1; SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); //$NON-NLS-1$ for (int i = 0; i < history.size(); i++) { Bar bar = (Bar) history.get(i); begin.add(dateFormat.format(bar.getDate())); end.add(dateFormat.format(bar.getDate())); if (first == -1 && beginDate != null && (bar.getDate().equals(beginDate) || bar.getDate().after(beginDate))) first = i; if (last == -1 && endDate != null && (bar.getDate().equals(endDate) || bar.getDate().after(endDate))) last = i; } begin.select(first != -1 ? first : 0); end.select(last != -1 ? last : end.getItemCount() - 1); return content; }
From source file:net.sourceforge.eclipsetrader.core.ui.dialogs.CurrencyConversionDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { Composite content = new Composite(parent, SWT.NONE); GridLayout gridLayout = new GridLayout(5, false); gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); gridLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); gridLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); content.setLayout(gridLayout);/*from www . ja v a2s . c o m*/ content.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); Label label = new Label(content, SWT.NONE); label.setText(Messages.CurrencyConversionDialog_Convert); label.setLayoutData(new GridData(60, SWT.DEFAULT)); amount = new Spinner(content, SWT.BORDER); amount.setMinimum(1); amount.setMaximum(999999999); amount.setDigits(2); amount.setIncrement(100); amount.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { update(); } }); from = new Combo(content, SWT.READ_ONLY); from.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false)); from.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { update(); } }); label = new Label(content, SWT.NONE); label.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); label = new Label(content, SWT.NONE); label = new Label(content, SWT.NONE); label.setText(Messages.CurrencyConversionDialog_To); label.setLayoutData(new GridData(60, SWT.DEFAULT)); to = new Combo(content, SWT.READ_ONLY); to.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false)); to.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { update(); } }); label = new Label(content, SWT.NONE); label.setText(Messages.CurrencyConversionDialog_Equal); result = new Text(content, SWT.BORDER | SWT.READ_ONLY); result.setLayoutData(new GridData(80, SWT.DEFAULT)); List list = CurrencyConverter.getInstance().getCurrencies(); Collections.sort(list, new Comparator() { public int compare(Object arg0, Object arg1) { return ((String) arg0).compareTo((String) arg1); } }); for (Iterator iter = list.iterator(); iter.hasNext();) { String symbol = (String) iter.next(); from.add(symbol); to.add(symbol); } String locale = Currency.getInstance(Locale.getDefault()).getCurrencyCode(); if (defaultFrom == null) defaultFrom = locale.equals("EUR") ? "USD" : "EUR"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ if (defaultTo == null) defaultTo = locale; from.setText(defaultFrom); to.setText(defaultTo); amount.setSelection(100); update(); return content; }
From source file:net.sourceforge.eclipsetrader.core.ui.dialogs.EventDetailsDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { Composite content = new Composite(parent, SWT.NONE); GridLayout gridLayout = new GridLayout(3, false); gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); gridLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); gridLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); content.setLayout(gridLayout);/*w w w. j a v a2 s .c o m*/ content.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); Label label = new Label(content, SWT.NONE); label.setText(Messages.EventDetailsDialog_Date); label.setLayoutData(new GridData(60, SWT.DEFAULT)); date = new Label(content, SWT.NONE); Composite buttons = new Composite(content, SWT.NONE); gridLayout = new GridLayout(1, false); gridLayout.marginWidth = gridLayout.marginHeight = 0; buttons.setLayout(gridLayout); buttons.setLayoutData(new GridData(GridData.BEGINNING, GridData.FILL, false, false, 1, 3)); createNavigationButtons(buttons); label = new Label(content, SWT.NONE); label.setText(Messages.EventDetailsDialog_Security); label.setLayoutData(new GridData(60, SWT.DEFAULT)); security = new Label(content, SWT.NONE); label = new Label(content, SWT.NONE); label.setText(Messages.EventDetailsDialog_Message); label.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false)); message = new Text(content, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false); gridData.widthHint = 300; gridData.heightHint = 40; message.setLayoutData(gridData); label = new Label(content, SWT.NONE); label.setText(Messages.EventDetailsDialog_Details); label.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 3, 1)); longMessage = new Text(content, SWT.BORDER | SWT.READ_ONLY | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP); gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false, 3, 1); gridData.widthHint = 350; gridData.heightHint = 150; longMessage.setLayoutData(gridData); updateEvent(); return content; }
From source file:net.sourceforge.eclipsetrader.core.ui.dialogs.ExchangeRateDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { Composite content = new Composite(parent, SWT.NONE); GridLayout gridLayout = new GridLayout(6, false); gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); gridLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); gridLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); content.setLayout(gridLayout);/*from w ww. j a va 2s . co m*/ content.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); Label label = new Label(content, SWT.NONE); label.setText(Messages.ExchangeRateDialog_Date); label.setLayoutData(new GridData(60, SWT.DEFAULT)); text = new Text(content, SWT.BORDER); text.setSize(80, SWT.DEFAULT); GridData gridData = new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 5, 1); gridData.widthHint = 80; text.setLayoutData(gridData); text.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent e) { try { Date date = dateParse.parse(text.getText()); text.setText(dateFormat.format(date)); } catch (Exception e1) { text.setText(dateFormat.format(Calendar.getInstance().getTime())); } update(); } }); text.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.keyCode == SWT.ARROW_UP) { try { Calendar calendar = Calendar.getInstance(); calendar.setTime(dateParse.parse(text.getText())); calendar.add(Calendar.DATE, 1); text.setText(dateFormat.format(calendar.getTime())); } catch (Exception e1) { text.setText(dateFormat.format(Calendar.getInstance().getTime())); } update(); } else if (e.keyCode == SWT.ARROW_DOWN) { try { Calendar calendar = Calendar.getInstance(); calendar.setTime(dateParse.parse(text.getText())); calendar.add(Calendar.DATE, -1); text.setText(dateFormat.format(calendar.getTime())); } catch (Exception e1) { text.setText(dateFormat.format(Calendar.getInstance().getTime())); } update(); } } }); label = new Label(content, SWT.NONE); from = new Combo(content, SWT.READ_ONLY); from.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false)); from.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { update(); } }); label = new Label(content, SWT.NONE); label.setText(Messages.ExchangeRateDialog_To); to = new Combo(content, SWT.READ_ONLY); to.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false)); to.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { update(); } }); label = new Label(content, SWT.NONE); label.setText(Messages.ExchangeRateDialog_Equals); ratio = new Spinner(content, SWT.BORDER); ratio.setMinimum(1); ratio.setMaximum(999999999); ratio.setDigits(4); ratio.setIncrement(100); List list = CurrencyConverter.getInstance().getCurrencies(); Collections.sort(list, new Comparator() { public int compare(Object arg0, Object arg1) { return ((String) arg0).compareTo((String) arg1); } }); for (Iterator iter = list.iterator(); iter.hasNext();) { String symbol = (String) iter.next(); from.add(symbol); to.add(symbol); } text.setText(dateFormat.format(Calendar.getInstance().getTime())); String locale = Currency.getInstance(Locale.getDefault()).getCurrencyCode(); from.setText(locale.equals(Messages.ExchangeRateDialog_DefaultTo) ? Messages.ExchangeRateDialog_DefaultFrom : Messages.ExchangeRateDialog_DefaultTo); to.setText(locale.equals(Messages.ExchangeRateDialog_DefaultTo) ? Messages.ExchangeRateDialog_DefaultTo : Messages.ExchangeRateDialog_DefaultFrom); update(); return content; }
From source file:net.sourceforge.sqlexplorer.dialogs.CreateAliasDlg.java
License:Open Source License
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 va2 s . com*/ final GridData gd_composite = new GridData(SWT.FILL, SWT.FILL, true, true); gd_composite.heightHint = 238; 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.CENTER, true, false); data.heightHint = 211; 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(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.horizontalSpan = 2; data.widthHint = SIZING_TEXT_FIELD_WIDTH; 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(); }; }); 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 = SQLExplorerPlugin.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.getName().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() { public void widgetSelected(SelectionEvent event) { PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn(getShell(), null, new String[] { DriverPreferencePage.class.getName() }, null); if (dlg.open() == IDialogConstants.OK_ID) populateCombo(); } }); 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() { public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { int selIndex = cboDriver.getSelectionIndex(); ManagedDriver driver = comboDriverIndexes.get(selIndex); urlField.setText(driver.getUrl()); CreateAliasDlg.this.validate(); }; }); 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 = 2; connectionPropertiesComposite.setLayout(gridLayout); new Label(nameGroup, SWT.NONE); new Label(nameGroup, SWT.NONE); /* final Button */ autoLogonButton = new Button(connectionPropertiesComposite, SWT.CHECK); autoLogonButton.setToolTipText("If set, SQLExplorer will try to logon without prompting"); final GridData gd_autoLogonButton = new GridData(158, SWT.DEFAULT); autoLogonButton.setLayoutData(gd_autoLogonButton); autoLogonButton.setText("Auto logon"); /* final Button */ autoCommitButton = new Button(connectionPropertiesComposite, SWT.CHECK); autoCommitButton.setToolTipText("Sets the default for new SQL Editors"); autoCommitButton.setText("Auto Commit"); /* final Button */ logonAtStartupButton = new Button(connectionPropertiesComposite, SWT.CHECK); logonAtStartupButton.setToolTipText("If set, SQLExplorer will establish a connection during startup"); logonAtStartupButton.setText("Logon during startup"); /* final Button */ commitOnCloseButton = new Button(connectionPropertiesComposite, SWT.CHECK); commitOnCloseButton.setToolTipText("Sets the default for new SQL editors"); commitOnCloseButton.setText("Commit on close"); new Label(nameGroup, SWT.NONE); autoLogonButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { boolean checked = autoLogonButton.getSelection(); logonAtStartupButton.setEnabled(checked); if (!checked) logonAtStartupButton.setSelection(false); } }); logonAtStartupButton.setEnabled(alias.isConnectAtStartup()); logonAtStartupButton.setSelection(alias.isConnectAtStartup()); autoLogonButton.setSelection(alias.isConnectAtStartup()); autoCommitButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { commitOnCloseButton.setEnabled(!autoCommitButton.getSelection()); } }); User user = alias.getDefaultUser(); if (user != null) { autoCommitButton.setSelection(user.isAutoCommit()); commitOnCloseButton.setEnabled(!user.isAutoCommit()); commitOnCloseButton.setSelection(user.isCommitOnClose()); } noUsernameRequired.addSelectionListener(new SelectionAdapter() { 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) { userField.setText(alias.getDefaultUser().getUserName()); passwordField.setText(alias.getDefaultUser().getPassword()); } } if (type != Type.CREATE) { if (alias.getDriver() != null) cboDriver.setText(alias.getDriver().getName()); urlField.setText(alias.getUrl()); } return parentComposite; }
From source file:net.sourceforge.sqlexplorer.dialogs.CreateDriverDlg.java
License:Open Source License
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 ava 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 = 3; 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(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.horizontalSpan = 2; data.widthHint = SIZING_TEXT_FIELD_WIDTH; 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(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; data.horizontalSpan = 2; 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(); loadData(); return parentComposite; }
From source file:net.sourceforge.sqlexplorer.dialogs.PasswordConnDlg.java
License:Open Source License
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 .jav a 2 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().getName()); 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));//$NON-NLS-1$ fAutoCommitBox.setSelection(store.getBoolean(IConstants.AUTO_COMMIT));//$NON-NLS-1$ if (fAutoCommitBox.getSelection()) { fCommitOnCloseBox.setEnabled(false); } else fCommitOnCloseBox.setEnabled(true); } }); return parentComposite; }