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:org2.eclipse.php.internal.debug.ui.launching.ApplicationFileSelectionDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { if (!fAllowExternalFiles) { return super.createDialogArea(parent); }/* w w w.jav a 2s. c o m*/ Font font = parent.getFont(); Composite composite = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(1, false); layout.marginHeight = 0; layout.marginLeft = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); composite.setFont(font); // Attach the regular dialog area super.createDialogArea(composite); // Attach the checkbox fExternalFilesBt = new Button(composite, SWT.CHECK); fExternalFilesBt.setText("Show non-workspace files"); GridData data = new GridData(); data.grabExcessHorizontalSpace = true; data.horizontalIndent = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); fExternalFilesBt.setLayoutData(data); // Add a listener fExternalFilesBt.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateView(fExternalFilesBt.getSelection()); } }); // Set the current state as saved in the preferences. String shouldShowExternals = fStore.getString(SHOW_EXTERNAL_FILES); if (shouldShowExternals.length() == 0) { fExternalFilesBt.setSelection(true); updateView(true); } else { boolean show = Boolean.valueOf(shouldShowExternals).booleanValue(); fExternalFilesBt.setSelection(show); updateView(show); } getTreeViewer().setComparator(comparator); return composite; }
From source file:ummisco.gama.ui.viewers.image.SaveImageAsDialog.java
@Override protected Control createDialogArea(final Composite parent) { final Composite parentComposite = (Composite) super.createDialogArea(parent); // create a composite with standard margins and spacing to put // out image specific stuff final Group composite = new Group(parentComposite, SWT.NONE); composite.setText("Image Information"); final GridLayout layout = new GridLayout(); // TODO: this isn't leaving any margin around the edge of the Group // in the dialog layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.numColumns = 2;/*from ww w . j a va 2 s . co m*/ composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); composite.setFont(parentComposite.getFont()); final Label l = new Label(composite, SWT.RIGHT); l.setText("Type:"); GridData gd = new GridData(); l.setLayoutData(gd); imageTypeCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY | SWT.DROP_DOWN); gd = new GridData(); gd.grabExcessHorizontalSpace = true; gd.horizontalAlignment = SWT.FILL; imageTypeCombo.setLayoutData(gd); // initialize the imageType drop-down // TODO: filter by what's actually going to work when saving for (final String element : IMAGE_LABELS) { imageTypeCombo.add(element); } if (initialImageTypeIndex >= 0 && initialImageTypeIndex < IMAGE_TYPES.length) { imageTypeCombo.select(initialImageTypeIndex); selectedImageTypeIndex = initialImageTypeIndex; } else { imageTypeCombo.select(0); selectedImageTypeIndex = 0; } // change the filename extension when the imageType is changed imageTypeCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { final int index = imageTypeCombo.getSelectionIndex(); IPath path = Path.fromPortableString(getFileName()); path = path.removeFileExtension().addFileExtension(IMAGE_EXTS[index]); setFileName(path.toPortableString()); } }); return parentComposite; }