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.e4.ui.progress.internal.ProgressInfoItem.java
License:Open Source License
/** * Create the child widgets of the receiver. *//*from w w w .jav a2 s .c o m*/ protected void createChildren() { FormLayout layout = new FormLayout(); setLayout(layout); jobImageLabel = new Label(this, SWT.NONE); Image infoImage = getInfoImage(); jobImageLabel.setImage(infoImage); FormData imageData = new FormData(); if (infoImage != null) { // position it in the center imageData.top = new FormAttachment(50, -infoImage.getBounds().height / 2); } else { imageData.top = new FormAttachment(0, IDialogConstants.VERTICAL_SPACING); } imageData.left = new FormAttachment(0, IDialogConstants.HORIZONTAL_SPACING / 2); jobImageLabel.setLayoutData(imageData); progressLabel = new Label(this, SWT.NONE); setMainText(); actionBar = new ToolBar(this, SWT.FLAT); actionBar.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_ARROW)); // set cursor to overwrite any busy cursor we might have actionButton = new ToolItem(actionBar, SWT.NONE); actionButton.setToolTipText(ProgressMessages.NewProgressView_CancelJobToolTip); actionButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { actionButton.setEnabled(false); cancelOrRemove(); } }); actionBar.addListener(SWT.Traverse, new Listener() { @Override public void handleEvent(Event event) { if (indexListener == null) { return; } int detail = event.detail; if (detail == SWT.TRAVERSE_ARROW_NEXT) { indexListener.selectNext(); } if (detail == SWT.TRAVERSE_ARROW_PREVIOUS) { indexListener.selectPrevious(); } } }); updateToolBarValues(); FormData progressData = new FormData(); progressData.top = new FormAttachment(0, IDialogConstants.VERTICAL_SPACING); progressData.left = new FormAttachment(jobImageLabel, IDialogConstants.HORIZONTAL_SPACING / 2); progressData.right = new FormAttachment(actionBar, IDialogConstants.HORIZONTAL_SPACING * -1); progressLabel.setLayoutData(progressData); mouseListener = new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { if (indexListener != null) { indexListener.select(); } } }; addMouseListener(mouseListener); jobImageLabel.addMouseListener(mouseListener); progressLabel.addMouseListener(mouseListener); setLayoutsForNoProgress(); refresh(); }
From source file:org.eclipse.e4.ui.progress.internal.ProgressInfoItem.java
License:Open Source License
/** * Set the layout of the widgets for the no progress case. * *//*w w w . j av a2s . c om*/ private void setLayoutsForNoProgress() { FormData buttonData = new FormData(); buttonData.top = new FormAttachment(progressLabel, 0, SWT.TOP); buttonData.right = new FormAttachment(100, IDialogConstants.HORIZONTAL_SPACING * -1); actionBar.setLayoutData(buttonData); if (taskEntries.size() > 0) { FormData linkData = new FormData(); linkData.top = new FormAttachment(progressLabel, IDialogConstants.VERTICAL_SPACING); linkData.left = new FormAttachment(progressLabel, 0, SWT.LEFT); linkData.right = new FormAttachment(actionBar, 0, SWT.LEFT); taskEntries.get(0).setLayoutData(linkData); } }
From source file:org.eclipse.e4.ui.progress.internal.ProgressInfoItem.java
License:Open Source License
/** * Create the progress bar and apply any style bits from style. * * @param style/*w w w .j av a 2 s. c o m*/ */ void createProgressBar(int style) { FormData buttonData = new FormData(); buttonData.top = new FormAttachment(progressLabel, 0); buttonData.right = new FormAttachment(100, IDialogConstants.HORIZONTAL_SPACING * -1); actionBar.setLayoutData(buttonData); progressBar = new ProgressBar(this, SWT.HORIZONTAL | style); FormData barData = new FormData(); barData.top = new FormAttachment(actionBar, IDialogConstants.VERTICAL_SPACING, SWT.TOP); barData.left = new FormAttachment(progressLabel, 0, SWT.LEFT); barData.right = new FormAttachment(actionBar, IDialogConstants.HORIZONTAL_SPACING * -1); barData.height = MAX_PROGRESS_HEIGHT; barData.width = 0;// default is too large progressBar.setLayoutData(barData); if (taskEntries.size() > 0) { // Reattach the link label if there is one FormData linkData = new FormData(); linkData.top = new FormAttachment(progressBar, IDialogConstants.VERTICAL_SPACING); linkData.left = new FormAttachment(progressBar, 0, SWT.LEFT); linkData.right = new FormAttachment(progressBar, 0, SWT.RIGHT); // Give an initial value so as to constrain the link shortening linkData.width = 20; taskEntries.get(0).setLayoutData(linkData); } }
From source file:org.eclipse.eatop.workspace.ui.wizards.pages.EastADLProjectWizardFirstPage.java
License:Open Source License
private Layout initGridLayout(GridLayout gridLayout, boolean margins) { gridLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); gridLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); if (margins) { gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); } else {/*from w w w . j a va2 s. co m*/ gridLayout.marginWidth = 0; gridLayout.marginHeight = 0; } return gridLayout; }
From source file:org.eclipse.edt.ide.ui.internal.contentassist.EGLContentAssistProcessor.java
License:Open Source License
private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = EDTUIPlugin.getActiveWorkbenchShell(); String title = EGLTextMessages.ContentAssistProcessor_all_disabled_title; String message = EGLTextMessages.ContentAssistProcessor_all_disabled_message; // see PreferencePage#createControl for the 'defaults' label final String restoreButtonLabel = JFaceResources.getString("defaults"); //$NON-NLS-1$ final String linkMessage = Messages.format( EGLTextMessages.ContentAssistProcessor_all_disabled_preference_link, LegacyActionTools.removeMnemonics(restoreButtonLabel)); final int restoreId = IDialogConstants.CLIENT_ID + 10; final int settingsId = IDialogConstants.CLIENT_ID + 11; final OptionalMessageDialog dialog = new OptionalMessageDialog(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY, shell, title, null /* default image */, message, MessageDialog.WARNING, new String[] { restoreButtonLabel, IDialogConstants.CLOSE_LABEL }, 1) { /*// w w w . jav a 2 s .c o m * @see org.eclipse.jdt.internal.ui.dialogs.OptionalMessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite) */ protected Control createCustomArea(Composite composite) { // wrap link and checkbox in one composite without space Composite parent = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = 0; parent.setLayout(layout); Composite linkComposite = new Composite(parent, SWT.NONE); layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); linkComposite.setLayout(layout); Link link = new Link(linkComposite, SWT.NONE); link.setText(linkMessage); link.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { setReturnCode(settingsId); close(); } }); GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); gridData.widthHint = this.getMinimumMessageWidth(); link.setLayoutData(gridData); super.createCustomArea(parent); return parent; } protected void createButtonsForButtonBar(Composite parent) { Button[] buttons = new Button[2]; buttons[0] = createButton(parent, restoreId, restoreButtonLabel, false); buttons[1] = createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true); setButtons(buttons); } }; int returnValue = dialog.open(); if (restoreId == returnValue || settingsId == returnValue) { if (restoreId == returnValue) { IPreferenceStore store = EDTUIPlugin.getDefault().getPreferenceStore(); store.setToDefault(EDTUIPreferenceConstants.CODEASSIST_CATEGORY_ORDER); store.setToDefault(EDTUIPreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES); } if (settingsId == returnValue) PreferencesUtil .createPreferenceDialogOn(shell, "org.eclipse.edt.ide.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$ .open(); fComputerRegistry.reload(); return true; } } return false; }
From source file:org.eclipse.edt.ide.ui.internal.externaltype.wizards.javatype.ExternalTypeFromJavaPage.java
License:Open Source License
protected Composite createSelectionButtons(Composite parent, int nColumns) { Composite buttonComposite = new Composite(parent, SWT.RIGHT); buttonComposite.setFont(parent.getFont()); GridLayout layout = new GridLayout(); layout.numColumns = 1;/*w w w .ja v a 2 s . co m*/ layout.marginHeight = 0; layout.marginWidth = 0; layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); buttonComposite.setLayout(layout); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL); gd.horizontalSpan = nColumns; buttonComposite.setLayoutData(gd); SelectionListener listener = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Object[] viewerElements = fContentProvider.getElements(fInput); for (int i = 0; i < viewerElements.length; i++) { javaTypeViewer.setSubtreeChecked(viewerElements[i], true); } storeSelectedClass(); validatePage(); } }; createButton(buttonComposite, NewExternalTypeWizardMessages.NewExternalTypeWizardPage_SelectAll_message, listener); listener = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { javaTypeViewer.setCheckedElements(new Object[0]); storeSelectedClass(); validatePage(); } }; createButton(buttonComposite, NewExternalTypeWizardMessages.NewExternalTypeWizardPage_DeSelectAll_message, listener); return buttonComposite; }
From source file:org.eclipse.edt.ide.ui.internal.formatting.ui.CreateProfileDialog.java
License:Open Source License
public Control createDialogArea(Composite parent) { final int numColumns = 2; GridData gd;/* w w w . j a va 2 s .c o 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(NewWizardMessages.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(NewWizardMessages.InitProfileSetting); 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(NewWizardMessages.OpenEditDlg); fEditCheckbox.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { fOpenEditDialog = ((Button) e.widget).getSelection(); } public void widgetDefaultSelected(SelectionEvent e) { } }); final IDialogSettings dialogSettings = EDTUIPlugin.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(fSortedNames[0]); updateStatus(fEmpty); applyDialogFont(composite); fNameText.setFocus(); return composite; }
From source file:org.eclipse.edt.ide.ui.internal.formatting.ui.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 w w. ja v a 2 s. com * @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 fSashForm = new SashForm(parent, SWT.HORIZONTAL); fSashForm.setFont(parent.getFont()); final Composite settingsPane = new Composite(fSashForm, SWT.NONE); settingsPane.setFont(fSashForm.getFont()); final GridLayout 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); final Composite previewPane = new Composite(fSashForm, SWT.NONE); previewPane.setLayout(createGridLayout(numColumns, true)); previewPane.setFont(fSashForm.getFont()); doCreatePreviewPane(previewPane, numColumns); initializePage(); fSashForm.setWeights(new int[] { 3, 3 }); return fSashForm; }
From source file:org.eclipse.edt.ide.ui.internal.formatting.ui.RenameProfileDialog.java
License:Open Source License
public Control createDialogArea(Composite parent) { final int numColumns = 2; 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 = numColumns;//from w ww. j a va2s . c o m final Composite composite = new Composite(parent, SWT.NULL); composite.setLayout(layout); // Create "Please enter a new name:" label GridData gd = new GridData(); gd.horizontalSpan = numColumns; gd.widthHint = convertWidthInCharsToPixels(60); fNameLabel = new Label(composite, SWT.NONE); fNameLabel.setText(NewWizardMessages.EnterNewName); fNameLabel.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); String profileDisplayName = fProfileManager.getProfileDisplayName(fProfileOrDefaultProfile); fNameText.setText(profileDisplayName); fNameText.setSelection(0, profileDisplayName.length()); fNameText.setLayoutData(gd); fNameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { doValidation(); } }); fNameText.setText(profileDisplayName); fNameText.selectAll(); applyDialogFont(composite); return composite; }
From source file:org.eclipse.edt.ide.ui.preferences.CompilerAndGeneratorControls.java
License:Open Source License
public void createGeneratorsComposite(Composite parent) { if (fPixelConverter == null) { fPixelConverter = new PixelConverter(parent); }// w w w . j av a 2s .c o m Composite settingsPane = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.verticalSpacing = (int) (1.5 * fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING)); layout.horizontalSpacing = fPixelConverter .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.marginHeight = 0; layout.marginWidth = fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); settingsPane.setLayout(layout); settingsPane.setLayoutData(new GridData(GridData.FILL_BOTH)); createPageBookAndTree(settingsPane); initializePage(); }