List of usage examples for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_SPACING
int HORIZONTAL_SPACING
To view the source code for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_SPACING.
Click Source Link
From source file:org.eclipse.wst.xquery.internal.ui.wizards.XQDTNewModuleWizardPage.java
License:Open Source License
protected 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 {/*from ww w . jav a 2 s. c o m*/ layout.marginWidth = 0; layout.marginHeight = 0; } return layout; }
From source file:org.eclipse.wst.xsd.ui.internal.widgets.XSDEditSchemaInfoDialog.java
License:Open Source License
protected Control __internalCreateDialogArea(Composite parent) { // create a composite with standard margins and spacing Composite composite = new Composite(parent, 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 av a 2 s .c o m composite.setLayoutData(new GridData(GridData.FILL_BOTH)); return composite; }
From source file:org.eclipse.xtend.ide.formatting.preferences.FormatterModifyDialog.java
License:Open Source License
@Override @SuppressWarnings("rawtypes") protected Control createDialogArea(Composite parent) { if (isOldAPIVersion()) { return super.createDialogArea(parent); }//from ww w . ja va 2 s. co m try { // copied from Eclipse Oxygen to support old dialog in Eclipse Photon final Composite composite = new Composite(parent, 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); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(composite); Composite nameComposite = new Composite(composite, SWT.NONE); nameComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); nameComposite.setLayout(new GridLayout(3, false)); // use reflection to not break API Field fProfileNameField = ModifyDialog.class.getDeclaredField("fProfileNameField"); fProfileNameField.setAccessible(true); StringDialogField f = new StringDialogField(); fProfileNameField.set(this, f); f.setLabelText("&Profile name:"); f.setText(fProfile.getName()); f.getLabelControl(nameComposite).setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); f.getTextControl(nameComposite).setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); f.setDialogFieldListener(new IDialogFieldListener() { @Override public void dialogFieldChanged(DialogField field) { try { Method doValidate = ModifyDialog.class.getDeclaredMethod("doValidate"); doValidate.setAccessible(true); doValidate.invoke(FormatterModifyDialog.this); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { XtendActivator.getInstance().getLog() .log(new Status(IStatus.ERROR, XtendActivator.PLUGIN_ID, e.getMessage(), e)); } } }); // use reflection to not break API Field fSaveButton = ModifyDialog.class.getDeclaredField("fSaveButton"); fSaveButton.setAccessible(true); fSaveButton.set(this, createButton(nameComposite, IDialogConstants.CLIENT_ID + 1, "E&xport...", false)); fTabFolder = new TabFolder(composite, SWT.NONE); fTabFolder.setFont(composite.getFont()); fTabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); // use reflection to not break API Field fWorkingValues = ModifyDialog.class.getDeclaredField("fWorkingValues"); fWorkingValues.setAccessible(true); addPages((Map) fWorkingValues.get(this)); applyDialogFont(composite); fTabFolder.addSelectionListener(new SelectionListener() { @Override public void widgetDefaultSelected(SelectionEvent e) { } @Override public void widgetSelected(SelectionEvent e) { final TabItem tabItem = (TabItem) e.item; final IModifyDialogTabPage page = (IModifyDialogTabPage) tabItem.getData(); fDialogSettings.put(fKeyLastFocus, fTabPages.indexOf(page)); page.makeVisible(); } }); // use reflection to not break API Method doValidate = ModifyDialog.class.getDeclaredMethod("doValidate"); doValidate.setAccessible(true); doValidate.invoke(this); PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, getHelpContextId()); return composite; } catch (NoSuchMethodException | SecurityException | IllegalArgumentException | IllegalAccessException | InvocationTargetException | NoSuchFieldException e) { XtendActivator.getInstance().getLog() .log(new Status(IStatus.ERROR, XtendActivator.PLUGIN_ID, e.getMessage(), e)); return null; } }
From source file:org.eclipse.xtext.ui.codetemplates.ui.preferences.EditTemplateDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite ancestor) { Composite parent = new Composite(ancestor, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2;//from ww w.j ava 2 s. c o m layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); parent.setLayout(layout); parent.setLayoutData(new GridData(GridData.FILL_BOTH)); ModifyListener listener = new ModifyListener() { @Override public void modifyText(ModifyEvent e) { doTextWidgetChanged(e.widget); } }; if (fIsNameModifiable) { createLabel(parent, TemplateDialogMessages.EditTemplateDialog_name); Composite composite = new Composite(parent, SWT.NONE); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); layout = new GridLayout(); layout.numColumns = 4; layout.marginWidth = 0; layout.marginHeight = 0; composite.setLayout(layout); fNameText = createText(composite); createLabel(composite, TemplateDialogMessages.EditTemplateDialog_context); fContextCombo = new Combo(composite, SWT.READ_ONLY); fContextCombo.setVisibleItemCount(30); // default for (int i = 0; i < fContextTypes.length; i++) { fContextCombo.add(fContextTypes[i][1]); } fContextCombo.addModifyListener(listener); fAutoInsertCheckbox = createCheckbox(composite, TemplateDialogMessages.EditTemplateDialog_autoinsert); fAutoInsertCheckbox.setSelection(fTemplate.isAutoInsertable()); } createLabel(parent, TemplateDialogMessages.EditTemplateDialog_description); int descFlags = fIsNameModifiable ? SWT.BORDER : SWT.BORDER | SWT.READ_ONLY; fDescriptionText = new Text(parent, descFlags); fDescriptionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fDescriptionText.addModifyListener(listener); Label patternLabel = createLabel(parent, TemplateDialogMessages.EditTemplateDialog_pattern); patternLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); fPatternEditor = createEditor(parent); Label filler = new Label(parent, SWT.NONE); filler.setLayoutData(new GridData()); Composite composite = new Composite(parent, SWT.NONE); layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; composite.setLayout(layout); composite.setLayoutData(new GridData()); fInsertVariableButton = new Button(composite, SWT.NONE); fInsertVariableButton.setLayoutData(getButtonGridData()); fInsertVariableButton.setText(TemplateDialogMessages.EditTemplateDialog_insert_variable); fInsertVariableButton.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { fPatternEditor.getTextWidget().setFocus(); fPatternEditor.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); fDescriptionText.setText(fTemplate.getDescription()); if (fIsNameModifiable) { fNameText.setText(fTemplate.getName()); fNameText.addModifyListener(listener); fContextCombo.select(getIndex(fTemplate.getContextTypeId())); } else { fPatternEditor.getControl().setFocus(); } applyDialogFont(parent); return composite; }
From source file:org.eclipsetrader.internal.brokers.paper.AccountPropertyPage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.marginHeight = layout.marginWidth = 0; layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout);/*from w ww . java 2 s . c o m*/ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(composite); Label label = new Label(composite, SWT.NONE); label.setText(Messages.AccountPropertyPage_Name); name = new Text(composite, SWT.BORDER); name.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); label = new Label(composite, SWT.NONE); label.setText(Messages.AccountPropertyPage_Currency); currency = new ComboViewer(composite, SWT.DROP_DOWN | SWT.READ_ONLY); currency.setLabelProvider(new LabelProvider()); currency.setContentProvider(new ArrayContentProvider()); currency.setSorter(new ViewerSorter()); Locale[] l = Locale.getAvailableLocales(); Set<Currency> c = new HashSet<Currency>(); for (int i = 0; i < l.length; i++) { try { c.add(Currency.getInstance(l[i])); } catch (Exception e) { // Ignore, some locales may throw an exception } } currency.setInput(c.toArray()); label = new Label(composite, SWT.NONE); label.setText(Messages.AccountPropertyPage_Balance); balance = new Spinner(composite, SWT.BORDER); balance.setValues(0, 0, 999999999, 2, 10000, 100000); label = new Label(composite, SWT.NONE); label.setText(Messages.AccountPropertyPage_ExpensesScheme); expenses = new ComboViewer(composite, SWT.DROP_DOWN | SWT.READ_ONLY); expenses.setLabelProvider(new LabelProvider()); expenses.setContentProvider(new ArrayContentProvider()); expenses.setInput(availableSchemes); name.addModifyListener(modifyListener); currency.addSelectionChangedListener(selectionChangedListener); balance.addModifyListener(modifyListener); expenses.addSelectionChangedListener(selectionChangedListener); performDefaults(); return composite; }
From source file:org.entirej.applicationframework.rwt.application.form.containers.EJRWTAbstractDialog.java
License:Apache License
protected Control createButtonBar(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); // create a layout with spacing and margins appropriate for the font // size.// w w w.ja v a 2 s. c o m GridLayout layout = new GridLayout(); layout.numColumns = 0; // this is incremented by createButton layout.makeColumnsEqualWidth = true; layout.marginWidth = 0; 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_END | GridData.VERTICAL_ALIGN_CENTER); composite.setLayoutData(data); composite.setFont(parent.getFont()); // Add the buttons to the button bar. createButtonsForButtonBar(composite); if (composite.getChildren().length == 0) { data.heightHint = 0; data.widthHint = 0; } return composite; }
From source file:org.entirej.applicationframework.tmt.pages.EJTMTScreenPage.java
License:Apache License
protected Control createButtonBar(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); // create a layout with spacing and margins appropriate for the font // size./*from w ww .j a va 2 s. co m*/ GridLayout layout = new GridLayout(); layout.numColumns = 0; // this is incremented by createButton layout.makeColumnsEqualWidth = true; layout.marginWidth = (IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = (IDialogConstants.VERTICAL_MARGIN); layout.horizontalSpacing = (IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = (IDialogConstants.VERTICAL_SPACING); composite.setLayout(layout); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER); composite.setLayoutData(data); composite.setFont(parent.getFont()); // Add the buttons to the button bar. createButtonsForButtonBar(composite); return composite; }
From source file:org.entirej.applicationframework.tmt.pages.EJTMTScreenPage.java
License:Apache License
protected Control createDialogArea(Composite parent) { // create a composite with standard margins and spacing Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = (IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = (IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = (IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = (IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout);// ww w .ja v a 2s . co m composite.setLayoutData(new GridData(GridData.FILL_BOTH)); createBody(composite); return composite; }
From source file:org.hawk.service.api.dt.ui.MONDOServersPreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { initializeDialogUnits(parent);// w ww . ja v a 2s .com Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); composite.setLayout(layout); servers = serverStore.readAllServers(); final ListViewer lServerURLs = new ListViewer(composite); lServerURLs.setLabelProvider(new ServerLabelProvider()); lServerURLs.setContentProvider(new ListContentProvider()); lServerURLs.setInput(servers); lServerURLs.getList().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); final Composite cButtons = new Composite(composite, SWT.NONE); cButtons.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false)); cButtons.setLayout(new FillLayout(SWT.HORIZONTAL)); final Button btnAdd = new Button(cButtons, SWT.NULL); btnAdd.setText("Add..."); btnAdd.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); final ServerConfigurationDialog scDialog = new ServerConfigurationDialog(shell, "Add server", "http://localhost:8080/"); if (scDialog.open() == Dialog.OK) { final Server newServer = new Server(scDialog.getLocation()); try { credsStore.put(scDialog.getLocation(), scDialog.getCredentials()); servers.add(newServer); lServerURLs.setInput(servers); } catch (Exception ex) { Activator.getDefault().logError(ex); } } } }); final Button btnRemove = new Button(cButtons, SWT.NULL); btnRemove.setText("Remove"); btnRemove.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final ISelection selection = lServerURLs.getSelection(); if (selection instanceof IStructuredSelection) { final IStructuredSelection ssel = (IStructuredSelection) lServerURLs.getSelection(); final Server server = (Server) ssel.getFirstElement(); try { credsStore.remove(server.getBaseURL()); servers.remove(server); lServerURLs.setInput(servers); } catch (Exception ex) { Activator.getDefault().logError(ex); } } } }); final Button btnEdit = new Button(cButtons, SWT.NULL); btnEdit.setText("Edit..."); btnEdit.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final ISelection selection = lServerURLs.getSelection(); if (selection instanceof IStructuredSelection) { final IStructuredSelection ssel = (IStructuredSelection) lServerURLs.getSelection(); final Server server = (Server) ssel.getFirstElement(); final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); final ServerConfigurationDialog scDialog = new ServerConfigurationDialog(shell, "Add server", "http://localhost:8080/"); Credentials creds; try { creds = credsStore.get(server.getBaseURL()); if (creds != null) { scDialog.setCredentials(creds); } } catch (Exception ex) { Activator.getDefault().logError(ex); } if (scDialog.open() == Dialog.OK) { try { credsStore.put(server.getBaseURL(), scDialog.getCredentials()); } catch (Exception ex) { Activator.getDefault().logError(ex); } } } } }); Dialog.applyDialogFont(composite); return composite; }
From source file:org.hibernate.eclipse.launch.AddPropertyDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { String dialogTitle = HibernateConsoleMessages.AddPropertyDialog_add_exporter_property; String editTitle = HibernateConsoleMessages.AddPropertyDialog_add_property_to; if (flagEdit) { dialogTitle = HibernateConsoleMessages.AddPropertyDialog_edit_exporter_property; editTitle = HibernateConsoleMessages.AddPropertyDialog_edit_property_to; }/*from w w w . j a v a2s . c om*/ getShell().setText(dialogTitle); setTitle(editTitle + ef.getExporterDefinition().getDescription()); Composite control = (Composite) super.createDialogArea(parent); Composite composite = new Composite(control, SWT.NONE); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); GridLayout layout = new GridLayout(3, 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); Label label = new Label(composite, SWT.NONE); label.setText(HibernateConsoleMessages.AddPropertyDialog_name); final Combo combo = new Combo(composite, SWT.BORDER | SWT.DROP_DOWN); GridData pgd = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); pgd.horizontalSpan = 2; combo.setLayoutData(pgd); combo.setFocus(); combo.addModifyListener(modifyListener); propertyCombo = new ComboViewer(combo); combo.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) { } public void keyReleased(KeyEvent e) { if (e.keyCode == SWT.ARROW_UP || e.keyCode == SWT.ARROW_DOWN) { //linux doesn't call selectionChanged event on this events propertyCombo.setSelection(propertyCombo.getSelection(), false); return; } for (int i = 0; i < combo.getItemCount(); i++) { if (combo.getText().equals(combo.getItem(i))) { if (combo.getSelectionIndex() != i) { combo.select(i); propertyCombo.setSelection(propertyCombo.getSelection(), false); } return; } } disposeBrowseButton(); createTextValueComposite(2); } }); if (flagEdit) { propertyCombo.getControl().setEnabled(false); } label = new Label(composite, SWT.NONE); label.setText(HibernateConsoleMessages.AddPropertyDialog_value); value = new Text(composite, SWT.BORDER); value.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL)); ((Text) value).addModifyListener(modifyListener); initDefaultNames(ef, propertyCombo); return control; }