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:melnorme.util.swt.MetricsUtil.java
License:Open Source License
/** Initializes a layout with dialog unit settings. * @param testControl the control used to obtain FontMetrics. */ public static void initGridLayoutWithDLUs(GridLayout layout, Control testControl) { FontMetrics fontMetrics = getFontMetrics(testControl); layout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING); layout.marginWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN); }
From source file:msi.gama.lang.gaml.ui.templates.GamlEditTemplateDialog.java
@Override protected Control createDialogArea(final Composite ancestor) { Composite parent = new Composite(ancestor, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2;// w ww . j a v a2s .co 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(final ModifyEvent e) { doTextWidgetChanged(e.widget); } }; 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, "Category:"); Label category = new Label(composite, SWT.NONE); // category.addModifyListener(listener); createLabel(parent, TemplateDialogMessages.EditTemplateDialog_description); fDescriptionText = new Text(parent, SWT.BORDER); 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 = 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(final SelectionEvent e) { fPatternEditor.getTextWidget().setFocus(); fPatternEditor.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); } @Override public void widgetDefaultSelected(final SelectionEvent e) { } }); fDescriptionText.setText(data.getTemplate().getDescription()); fillMenuPath(category); fNameText.setText(data.getTemplate().getName()); fNameText.addModifyListener(listener); applyDialogFont(parent); return composite; }
From source file:name.schedenig.eclipse.grepconsole.util.GridLayoutBuilder.java
License:Open Source License
/** * Initialises the layout and its margins based on the current font. *//*w ww . j a v a2s. co m*/ private void init() { layout = new GridLayout(); if (fontMetrics != null) { layout.marginHeight = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_SPACING); } layout.marginLeft = layout.marginRight = layout.marginWidth; layout.marginTop = layout.marginBottom = layout.marginHeight; layout.marginWidth = layout.marginHeight = 0; }
From source file:net.bioclipse.ui.dialogs.SaveAsDialog.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);//ww w. jav a 2s . c om composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setFont(parentComposite.getFont()); Listener listener = new Listener() { public void handleEvent(Event event) { setDialogComplete(validatePage()); } }; resourceGroup = new ResourceAndContainerGroup(composite, listener, IDEWorkbenchMessages.SaveAsDialog_fileLabel, formats); resourceGroup.setAllowExistingResources(true); return parentComposite; }
From source file:net.enilink.komma.common.ui.dialogs.DiagnosticDialog.java
License:Open Source License
/** * This implementation of the <code>Dialog</code> framework method creates * and lays out a composite. Subclasses that require a different dialog area * may either override this method, or call the <code>super</code> * implementation and add controls to the created composite. *//*w ww . j ava 2 s . c om*/ @Override protected Control createDialogArea(Composite parent) { createMessageArea(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); layout.numColumns = 2; composite.setLayout(layout); GridData childData = new GridData(GridData.FILL_HORIZONTAL); childData.horizontalSpan = 2; composite.setLayoutData(childData); composite.setFont(parent.getFont()); return composite; }
From source file:net.refractions.udig.internal.ui.SendLogDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { setTitle(Messages.SendLogDialog_description); ImageDescriptor image = UiPlugin.getDefault().getImageDescriptor(ImageConstants.LOG_WIZ); if (image != null) setTitleImage(image.createImage()); // create a composite with standard margins and spacing Composite composite = new Composite(parent, SWT.RESIZE); 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 .jav a 2 s . co m composite.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(composite); contactLabel = new Label(composite, SWT.NONE); contactLabel.setLayoutData(new GridData(SWT.NONE, SWT.NONE, false, false)); contactLabel.setText(Messages.SendLogDialog_contact); contact = new Text(composite, SWT.BORDER); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false); gridData = new GridData(SWT.FILL, SWT.FILL, true, false); gridData.horizontalSpan = 2; contact.setLayoutData(gridData); contact.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { refreshButtons(); } }); noteLabel = new Label(composite, SWT.NONE); noteLabel.setLayoutData(new GridData(SWT.NONE, SWT.NONE, false, false)); noteLabel.setText(Messages.SendLogDialog_notes); notes = new Text(composite, SWT.WRAP | SWT.BORDER | SWT.MULTI); gridData = new GridData(SWT.FILL, SWT.FILL, true, false); gridData = new GridData(SWT.FILL, SWT.FILL, true, false); gridData.heightHint = notes.getLineHeight() * 2; gridData.horizontalSpan = 2; notes.setLayoutData(gridData); notes.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { refreshButtons(); } }); logLabel = new Label(composite, SWT.NONE); gridData = new GridData(SWT.FILL, SWT.FILL, true, false); gridData.verticalAlignment = SWT.END; logLabel.setLayoutData(gridData); logLabel.setText(Messages.SendLogDialog_log); log = new Text(composite, SWT.WRAP | SWT.READ_ONLY | SWT.BORDER | SWT.V_SCROLL | SWT.MULTI); log.setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); gridData = new GridData(SWT.FILL, SWT.FILL, true, true); gridData.horizontalSpan = 2; log.setLayoutData(gridData); log.setText(Messages.SendLogDialog_reading); log.setEnabled(false); //start a thread to acquire the log file PopulateLogRunnable populateLog = new PopulateLogRunnable(); PlatformGIS.run(populateLog); contact.setFocus(); return composite; }
From source file:net.refractions.udig.internal.ui.SubmitIssueDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { setTitle(Messages.SendLogDialog_description); // create a composite with standard margins and spacing Composite composite = new Composite(parent, SWT.RESIZE); 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 w w w. j a va2 s . co m*/ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(composite); // add issue tracker instructions with relevant links submitIssueLink = new Link(composite, SWT.WRAP | SWT.READ_ONLY | SWT.MULTI); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false); gridData.horizontalSpan = 2; submitIssueLink.setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); submitIssueLink.setLayoutData(gridData); submitIssueLink.setText(Messages.SubmitIssueDialog_instructions); submitIssueLink.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { UIUtilities.openLink(event.text); } }); logLabel = new Label(composite, SWT.NONE); gridData = new GridData(SWT.FILL, SWT.FILL, true, false); gridData.verticalAlignment = SWT.END; logLabel.setLayoutData(gridData); logLabel.setText(Messages.SendLogDialog_log); // add text widget for displaying log file contents log = new Text(composite, SWT.WRAP | SWT.READ_ONLY | SWT.BORDER | SWT.V_SCROLL | SWT.MULTI); log.setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); gridData = new GridData(SWT.FILL, SWT.FILL, true, true); gridData.horizontalSpan = 2; log.setLayoutData(gridData); log.setText(Messages.SendLogDialog_reading); log.setEnabled(false); // start a thread to acquire the log file PopulateLogRunnable populateLog = new PopulateLogRunnable(); PlatformGIS.run(populateLog); return composite; }
From source file:net.refractions.udig.style.sld.editor.internal.EditorDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { final Composite composite = (Composite) super.createDialogArea(parent); GridLayout parentLayout = ((GridLayout) composite.getLayout()); parentLayout.numColumns = 4;// ww w.ja v a 2 s .c o m parentLayout.marginHeight = 0; parentLayout.marginWidth = 0; parentLayout.verticalSpacing = 0; parentLayout.horizontalSpacing = 0; composite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); Control treeControl = createTreeAreaContents(composite); createSash(composite, treeControl); Label versep = new Label(composite, SWT.SEPARATOR | SWT.VERTICAL); GridData verGd = new GridData(GridData.FILL_VERTICAL | GridData.GRAB_VERTICAL); versep.setLayoutData(verGd); versep.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true)); Composite pageAreaComposite = new Composite(composite, SWT.NONE); pageAreaComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); GridLayout layout = new GridLayout(1, true); layout.marginHeight = 0; layout.marginWidth = 0; pageAreaComposite.setLayout(layout); // Build the title area and separator line Composite titleComposite = new Composite(pageAreaComposite, SWT.NONE); layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = 0; layout.horizontalSpacing = 0; titleComposite.setLayout(layout); GridData titleLayoutData = new GridData(GridData.FILL_HORIZONTAL); titleLayoutData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN; titleComposite.setLayoutData(titleLayoutData); createTitleArea(titleComposite); Label separator = new Label(pageAreaComposite, SWT.HORIZONTAL | SWT.SEPARATOR); separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); // Build the Page container pageContainer = createPageContainer(pageAreaComposite); GridData pageContainerData = (GridData) pageContainer.getLayoutData(); //new GridData(GridData.FILL_BOTH); pageContainerData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN; pageContainer.setLayoutData(pageContainerData); // Build the separator line Label bottomSeparator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR); bottomSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); return composite; }
From source file:net.refractions.udig.style.sld.editor.internal.FilteredEditorDialog.java
License:Open Source License
@Override protected TreeViewer createTreeViewer(Composite parent) { PatternItemFilter filter = new PatternItemFilter(true); int styleBits = SWT.SINGLE | SWT.H_SCROLL; filteredTree = new FilteredComboTree(parent, styleBits, filter); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN; filteredTree.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); TreeViewer tree = filteredTree.getViewer(); filteredTree.setInitialText(Messages.FilteredEditorDialog_type_filter_text_here); setContentAndLabelProviders(tree);// ww w . j a va2 s.co m //alphabetical sort tree.setSorter(new ViewerSorter()); tree.setInput(getEditorPageManager()); //if the tree has only one or zero pages, make the combo area disable if (hasAtMostOnePage(tree)) { filteredTree.getFilterCombo().setEnabled(false); filteredTree.getFilterCombo().setSelection(new Point(0, 0)); } tree.addFilter(new CapabilityFilter()); tree.addSelectionChangedListener(new ISelectionChangedListener() { /* * (non-Javadoc) * * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) */ public void selectionChanged(SelectionChangedEvent event) { handleTreeSelectionChanged(event); } }); super.addListeners(filteredTree.getViewer()); return filteredTree.getViewer(); }
From source file:net.refractions.udig.style.sld.editor.internal.FilteredEditorDialog.java
License:Open Source License
@Override protected Control createTreeAreaContents(Composite parent) { Composite leftArea = new Composite(parent, SWT.NONE); leftArea.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); leftArea.setFont(parent.getFont());//from www. j a va2 s . c om GridLayout leftLayout = new GridLayout(); leftLayout.numColumns = 1; leftLayout.marginHeight = 0; leftLayout.marginTop = IDialogConstants.VERTICAL_MARGIN; leftLayout.marginWidth = 0; leftLayout.marginLeft = IDialogConstants.HORIZONTAL_MARGIN; leftLayout.horizontalSpacing = 0; leftLayout.verticalSpacing = 0; leftArea.setLayout(leftLayout); // Build the tree an put it into the composite. TreeViewer viewer = createTreeViewer(leftArea); setTreeViewer(viewer); updateTreeFont(JFaceResources.getDialogFont()); GridData viewerData = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL); viewer.getControl().getParent().setLayoutData(viewerData); layoutTreeAreaControl(leftArea); return leftArea; }