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.aptana.formatter.ui.preferences.CreateProfileDialog.java
License:Open Source License
@Override public Control createDialogArea(Composite parent) { final int numColumns = 2; GridData gd;/*from w w w . j a v a 2 s.co m*/ final GridLayout layout = new GridLayout(numColumns, 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); final Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(layout); // Create "Profile name:" label gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = numColumns; gd.widthHint = convertWidthInCharsToPixels(60); final Label nameLabel = new Label(composite, SWT.WRAP); nameLabel.setText(FormatterMessages.CreateProfileDialog_profileName); nameLabel.setLayoutData(gd); // Create text field to enter name gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = numColumns; fNameText = new Text(composite, SWT.SINGLE | SWT.BORDER); fNameText.setLayoutData(gd); fNameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { doValidation(); } }); // Create "Initialize settings ..." label gd = new GridData(); gd.horizontalSpan = numColumns; Label profileLabel = new Label(composite, SWT.WRAP); profileLabel.setText(FormatterMessages.CreateProfileDialog_initSettings); profileLabel.setLayoutData(gd); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = numColumns; fProfileCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); fProfileCombo.setLayoutData(gd); // "Open the edit dialog now" checkbox gd = new GridData(); gd.horizontalSpan = numColumns; fProfileCombo.setItems(fSortedNames); String selectedProfile = fProfileManager.getSelected(fProject).getName(); if (fProfileCombo.indexOf(selectedProfile) > -1) { fProfileCombo.setText(selectedProfile); } else { fProfileCombo.select(0); } updateStatus(fEmpty); applyDialogFont(composite); fNameText.setFocus(); return composite; }
From source file:com.aptana.formatter.ui.preferences.FormatterModifyTabPage.java
License:Open Source License
public Composite createContents(IFormatterControlManager manager, Composite parent) { final int numColumns = 4; if (fPixelConverter == null) { fPixelConverter = new PixelConverter(parent); }//from w w w. ja v a 2 s. c o m final SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL); sashForm.setFont(parent.getFont()); Composite scrollContainer = new Composite(sashForm, SWT.NONE); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); scrollContainer.setLayoutData(gridData); scrollContainer.setFont(sashForm.getFont()); GridLayout layout = new GridLayout(2, false); layout.marginHeight = 0; layout.marginWidth = 0; layout.horizontalSpacing = 0; layout.verticalSpacing = 0; scrollContainer.setLayout(layout); ScrolledPageContent scroll = new ScrolledPageContent(scrollContainer, SWT.V_SCROLL | SWT.H_SCROLL); scroll.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); final Composite settingsContainer = scroll.getBody(); settingsContainer.setLayout(new PageLayout(scroll, 400, 400)); settingsContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); Composite settingsPane = new Composite(settingsContainer, SWT.NONE); settingsPane.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); layout = new GridLayout(1, false); layout.verticalSpacing = (int) (1.5 * fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING)); layout.horizontalSpacing = fPixelConverter .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.marginHeight = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); settingsPane.setLayout(layout); createOptions(manager, settingsPane); settingsContainer.setSize(settingsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT)); Label sashHandle = new Label(scrollContainer, SWT.SEPARATOR | SWT.VERTICAL); gridData = new GridData(SWT.RIGHT, SWT.FILL, false, true); sashHandle.setLayoutData(gridData); final Composite previewPane = new Composite(sashForm, SWT.NONE); previewPane.setLayout(createGridLayout(numColumns, true)); previewPane.setFont(sashForm.getFont()); doCreatePreviewPane(previewPane, numColumns); sashForm.setWeights(new int[] { 3, 3 }); return sashForm; }
From source file:com.aptana.formatter.ui.preferences.FormatterModifyTabPage.java
License:Open Source License
protected GridLayout createGridLayout(int numColumns, boolean margins) { final GridLayout layout = new GridLayout(numColumns, false); layout.verticalSpacing = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = fPixelConverter .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); if (margins) { layout.marginHeight = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); } else {//from w w w .jav a 2 s .co m layout.marginHeight = 0; layout.marginWidth = 0; } return layout; }
From source file:com.aptana.ide.editors.preferences.CodeAssistExpressionInfoDialog.java
License:Open Source License
/** * Creates and returns the contents of the upper part * of the dialog (above the button bar). * * Subclasses should overide./* w w w .ja v a 2 s .co m*/ * * @param parent the parent composite to contain the dialog area * @return the dialog area control */ protected Control createDialogArea(Composite parent) { // top level composite Composite parentComposite = (Composite) super.createDialogArea(parent); // create a composite with standard margins and spacing Composite contents = 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); layout.numColumns = 2; contents.setLayout(layout); contents.setLayoutData(new GridData(GridData.FILL_BOTH)); contents.setFont(parentComposite.getFont()); setTitle(CodeAssistMessages.CodeAssistExpressionInfoDialog_AddXPathExpression); setMessage(CodeAssistMessages.CodeAssistExpressionInfoDialog_AddXPathExpressionToTriggerAttributes); // begin the layout Label label = new Label(contents, SWT.LEFT); label.setText( StringUtils.makeFormLabel(CodeAssistMessages.CodeAssistExpressionInfoDialog_AttributeExpression)); GridData data = new GridData(); data.horizontalAlignment = GridData.FILL; label.setLayoutData(data); label.setFont(parent.getFont()); message = new Text(contents, SWT.SINGLE | SWT.BORDER); message.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent event) { if (event.widget == message) { if (okButton != null) { okButton.setEnabled(validateErrorDescriptor()); } } } }); data = new GridData(); data.horizontalAlignment = GridData.FILL; data.grabExcessHorizontalSpace = true; message.setLayoutData(data); message.setFocus(); Label labelXPath = new Label(contents, SWT.LEFT); labelXPath.setText( StringUtils.makeFormLabel(CodeAssistMessages.CodeAssistExpressionInfoDialog_AttributeXPath)); data = new GridData(); data.horizontalAlignment = GridData.FILL; labelXPath.setLayoutData(data); labelXPath.setFont(parent.getFont()); xPath = new Text(contents, SWT.SINGLE | SWT.BORDER); xPath.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent event) { if (event.widget == xPath) { if (okButton != null) { okButton.setEnabled(validateErrorDescriptor()); } } } }); data = new GridData(); data.horizontalAlignment = GridData.FILL; data.grabExcessHorizontalSpace = true; xPath.setLayoutData(data); Dialog.applyDialogFont(parentComposite); if (expression != null) { message.setText(expression.getExpression()); xPath.setText(expression.getXPath()); } return contents; }
From source file:com.aptana.ide.editors.preferences.ErrorDescriptorInfoDialog.java
License:Open Source License
/** * Creates and returns the contents of the upper part * of the dialog (above the button bar). * * Subclasses should overide./*from w w w . ja va2 s . co m*/ * * @param parent the parent composite to contain the dialog area * @return the dialog area control */ protected Control createDialogArea(Composite parent) { // top level composite Composite parentComposite = (Composite) super.createDialogArea(parent); // create a composite with standard margins and spacing Composite contents = 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); layout.numColumns = 2; contents.setLayout(layout); contents.setLayoutData(new GridData(GridData.FILL_BOTH)); contents.setFont(parentComposite.getFont()); setTitle(CodeAssistMessages.ErrorDescriptorInfoDialog_IgnoreWarningError); setMessage(CodeAssistMessages.ErrorDescriptorInfoDialog_AddRegEx); // begin the layout Label label = new Label(contents, SWT.LEFT); label.setText(StringUtils.makeFormLabel(CodeAssistMessages.ErrorDescriptorInfoDialog_Message)); GridData data = new GridData(); data.horizontalAlignment = GridData.FILL; label.setLayoutData(data); label.setFont(parent.getFont()); message = new Text(contents, SWT.SINGLE | SWT.BORDER); message.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent event) { if (event.widget == message) { if (okButton != null) { okButton.setEnabled(validateErrorDescriptor()); } } } }); data = new GridData(); data.horizontalAlignment = GridData.FILL; data.grabExcessHorizontalSpace = true; message.setLayoutData(data); message.setFocus(); if (error != null) { message.setText(error.getMessage()); } Dialog.applyDialogFont(parentComposite); return contents; }
From source file:com.aptana.ide.ui.editors.preferences.formatter.CreateProfileDialog.java
License:Open Source License
/** * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) *///from ww w . j av a 2 s .c o m public Control createDialogArea(Composite parent) { final int numColumns = 2; GridData gd; final GridLayout layout = new GridLayout(numColumns, 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); final Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(layout); // Create "Profile name:" label gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = numColumns; gd.widthHint = convertWidthInCharsToPixels(60); final Label nameLabel = new Label(composite, SWT.WRAP); nameLabel.setText(FormatterMessages.CreateProfileDialog_profile_name_label_text); nameLabel.setLayoutData(gd); // Create text field to enter name gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = numColumns; fNameText = new Text(composite, SWT.SINGLE | SWT.BORDER); fNameText.setLayoutData(gd); fNameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { doValidation(); } }); // Create "Initialize settings ..." label gd = new GridData(); gd.horizontalSpan = numColumns; Label profileLabel = new Label(composite, SWT.WRAP); profileLabel.setText(FormatterMessages.CreateProfileDialog_base_profile_label_text); profileLabel.setLayoutData(gd); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = numColumns; fProfileCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); fProfileCombo.setLayoutData(gd); // "Open the edit dialog now" checkbox gd = new GridData(); gd.horizontalSpan = numColumns; fEditCheckbox = new Button(composite, SWT.CHECK); fEditCheckbox.setText(FormatterMessages.CreateProfileDialog_open_edit_dialog_checkbox_text); fEditCheckbox.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { fOpenEditDialog = ((Button) e.widget).getSelection(); } public void widgetDefaultSelected(SelectionEvent e) { } }); final IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings();//.get(PREF_OPEN_EDIT_DIALOG); if (dialogSettings.get(PREF_OPEN_EDIT_DIALOG) != null) { fOpenEditDialog = dialogSettings.getBoolean(PREF_OPEN_EDIT_DIALOG); } else { fOpenEditDialog = true; } fEditCheckbox.setSelection(fOpenEditDialog); fProfileCombo.setItems(fSortedNames); fProfileCombo.setText(fProfileManager.getDefaultProfile().getName()); updateStatus(fEmpty); applyDialogFont(composite); fNameText.setFocus(); return composite; }
From source file:com.aptana.ide.ui.editors.preferences.formatter.ModifyDialogTabPage.java
License:Open Source License
/** * Create the contents of this tab page. Subclasses cannot override this, * instead they must implement <code>doCreatePreferences</code>. <code>doCreatePreview</code> may also * be overridden as necessary./*from w ww .j av a2s.c o m*/ * @param parent The parent composite * @return Created content control */ public final Composite createContents(Composite parent) { final int numColumns = 4; if (fPixelConverter == null) { fPixelConverter = new PixelConverter(parent); } final SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL); sashForm.setFont(parent.getFont()); Composite scrollContainer = new Composite(sashForm, SWT.NONE); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); scrollContainer.setLayoutData(gridData); GridLayout layout = new GridLayout(2, false); layout.marginHeight = 0; layout.marginWidth = 0; layout.horizontalSpacing = 0; layout.verticalSpacing = 0; scrollContainer.setLayout(layout); ScrolledComposite scroll = new ScrolledComposite(scrollContainer, SWT.V_SCROLL | SWT.H_SCROLL); scroll.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); scroll.setExpandHorizontal(true); scroll.setExpandVertical(true); final Composite settingsContainer = new Composite(scroll, SWT.NONE); settingsContainer.setFont(sashForm.getFont()); scroll.setContent(settingsContainer); settingsContainer.setLayout(new PageLayout(scroll, 400, 400)); settingsContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); Composite settingsPane = new Composite(settingsContainer, SWT.NONE); settingsPane.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); layout = new GridLayout(numColumns, false); layout.verticalSpacing = (int) (1.5 * fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING)); layout.horizontalSpacing = fPixelConverter .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.marginHeight = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); settingsPane.setLayout(layout); doCreatePreferences(settingsPane, numColumns); settingsContainer.setSize(settingsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT)); scroll.addControlListener(new ControlListener() { public void controlMoved(ControlEvent e) { } public void controlResized(ControlEvent e) { settingsContainer.setSize(settingsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT)); } }); Label sashHandle = new Label(scrollContainer, SWT.SEPARATOR | SWT.VERTICAL); gridData = new GridData(SWT.RIGHT, SWT.FILL, false, true); sashHandle.setLayoutData(gridData); final Composite previewPane = new Composite(sashForm, SWT.NONE); previewPane.setLayout(createGridLayout(numColumns, true)); previewPane.setFont(sashForm.getFont()); doCreatePreviewPane(previewPane, numColumns); initializePage(); sashForm.setWeights(new int[] { 3, 3 }); return sashForm; }
From source file:com.aptana.ide.ui.editors.preferences.formatter.ModifyDialogTabPage.java
License:Open Source License
/** * Create a GridLayout with the default margin and spacing settings, as * well as the specified number of columns. * @param numColumns/*from ww w . jav a2 s .co m*/ * @param margins * @return GridLayout */ protected GridLayout createGridLayout(int numColumns, boolean margins) { GridLayout layout = new GridLayout(numColumns, false); layout.verticalSpacing = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = fPixelConverter .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); if (margins) { layout.marginHeight = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); } else { layout.marginHeight = 0; layout.marginWidth = 0; } return layout; }
From source file:com.aptana.ide.ui.io.auth.PasswordPromptDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite dialogArea = (Composite) super.createDialogArea(parent); titleImage = IOUIPlugin.getImageDescriptor("/icons/full/wizban/security.png").createImage(); //$NON-NLS-1$ dialogArea.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (titleImage != null) { setTitleImage(null);/*from ww w .j av a 2s. c om*/ titleImage.dispose(); titleImage = null; } } }); setTitleImage(titleImage); setTitle(title); setMessage(message); Composite container = new Composite(dialogArea, SWT.NONE); container.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); container.setLayout(GridLayoutFactory.swtDefaults() .margins(convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN), convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN)) .spacing(convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING), convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING)) .numColumns(2).create()); /* row 1 */ Label label = new Label(container, SWT.NONE); label.setLayoutData(GridDataFactory.swtDefaults().create()); label.setText(StringUtil.makeFormLabel(Messages.PasswordPromptDialog_UserName)); loginText = new Text(container, SWT.SINGLE | SWT.BORDER); loginText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); if (login != null) { loginText.setText(login); } loginText.setEnabled(false); /* row 2 */ label = new Label(container, SWT.NONE); label.setLayoutData(GridDataFactory.swtDefaults().create()); label.setText(StringUtil.makeFormLabel(Messages.PasswordPromptDialog_Password)); passwordText = new Text(container, SWT.SINGLE | SWT.PASSWORD | SWT.BORDER); passwordText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); if (password != null) { passwordText.setText(String.copyValueOf(password)); } /* row 3 */ new Label(container, SWT.NONE).setLayoutData(GridDataFactory.swtDefaults().create()); savePasswordButton = new Button(container, SWT.CHECK); savePasswordButton.setLayoutData(GridDataFactory.fillDefaults().create()); savePasswordButton.setText(Messages.PasswordPromptDialog_SavePassword); savePasswordButton.setSelection(savePassword); return dialogArea; }
From source file:com.aptana.ide.update.ui.BrowserDialog.java
License:Open Source License
@Override protected Control createButtonBar(Composite parent) { Composite composite = new Composite(parent, SWT.None); GridLayout layout = new GridLayout(); layout.marginWidth = 0;/*from w w w. j ava 2s .co m*/ layout.marginHeight = 0; layout.horizontalSpacing = 0; composite.setLayout(layout); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); composite.setFont(parent.getFont()); // create help control if needed if (isHelpAvailable()) { Control helpControl = createHelpControl(composite); ((GridData) helpControl.getLayoutData()).horizontalIndent = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_MARGIN); } Composite checkboxComposite = new Composite(composite, SWT.NONE); GridLayout layout2 = new GridLayout(); layout2.numColumns = 2; layout2.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout2.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout2.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout2.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); checkboxComposite.setLayout(layout2); checkboxComposite.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false)); checkboxComposite.setFont(parent.getFont()); bTurnOffThisAnnouncement = new Button(checkboxComposite, SWT.CHECK); bTurnOffThisAnnouncement.setText(Messages.BrowserDialog_Label_DoNotShowThisAnnouncementAgain); new Label(checkboxComposite, SWT.None); bTurnOffAllAnnouncements = new Button(checkboxComposite, SWT.CHECK); bTurnOffAllAnnouncements.setText(Messages.BrowserDialog_Label_DoNotShowAllAnnouncements); Button okButton = createButton(composite, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); GridData okGridData = (GridData) okButton.getLayoutData(); okGridData.grabExcessVerticalSpace = false; okGridData.horizontalSpan = 2; okGridData.verticalAlignment = SWT.END; okGridData.horizontalAlignment = SWT.END; return composite; }