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:org.eclipse.ui.internal.ide.dialogs.ResourceFilterGroup.java
License:Open Source License
protected Control createButtonBar(Composite parent) { Label label = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginWidth = 0;/*from w w w . j a v a 2 s . c o m*/ layout.marginHeight = 0; layout.horizontalSpacing = 0; composite.setLayout(layout); composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, 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); } Control buttonSection = dialogCreateButtonBar(composite); ((GridData) buttonSection.getLayoutData()).grabExcessHorizontalSpace = true; return composite; }
From source file:org.eclipse.ui.internal.ide.dialogs.ResourceFilterGroup.java
License:Open Source License
private Control dialogCreateButtonBar(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); // create a layout with spacing and margins appropriate for the font // size.//ww w . j a v a 2 s .c o m GridLayout layout = new GridLayout(); layout.numColumns = 0; // this is incremented by createButton layout.makeColumnsEqualWidth = true; layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); 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); return composite; }
From source file:org.eclipse.ui.internal.ide.dialogs.ResourceFilterGroup.java
License:Open Source License
/** * @param font//from ww w . j a v a 2s . com * @param composite * @return the group */ private Composite createGroup(Font font, Composite composite, String text, boolean grabExcessVerticalSpace, boolean group, int columnCounts) { GridLayout layout; GridData data; Composite modeComposite; if (group) { Group modeGroup = new Group(composite, SWT.NONE); modeGroup.setText(text); modeComposite = modeGroup; } else { modeComposite = new Composite(composite, SWT.NONE); } layout = new GridLayout(); layout.verticalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginLeft = 2; layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.numColumns = columnCounts; modeComposite.setLayout(layout); data = new GridData(SWT.FILL, SWT.FILL, true, grabExcessVerticalSpace); modeComposite.setLayoutData(data); modeComposite.setFont(font); return modeComposite; }
From source file:org.eclipse.ui.internal.ide.dialogs.ResourceFilterGroup.java
License:Open Source License
public void create(Composite argumentComposite, Font font) { shell = argumentComposite.getShell(); GridLayout layout = new GridLayout(); layout.numColumns = 1;//from w ww .ja va 2s .c o m layout.marginWidth = 0; layout.marginHeight = 0; layout.horizontalSpacing = 0; layout.verticalSpacing = 0; argumentComposite.setLayout(layout); GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); argumentComposite.setLayoutData(data); argumentComposite.setFont(font); conditionComposite = new Composite(argumentComposite, SWT.NONE); layout = new GridLayout(); layout.numColumns = 2; layout.marginWidth = 0; layout.marginHeight = 0; layout.horizontalSpacing = 0; conditionComposite.setLayout(layout); conditionComposite.setFont(font); data = new GridData(SWT.FILL, SWT.FILL, true, true); conditionComposite.setLayoutData(data); createCustomArgumentsArea(font, conditionComposite); descriptionComposite = new Composite(argumentComposite, SWT.NONE); layout = new GridLayout(); layout.numColumns = 1; layout.marginWidth = dialog.getHorizontalDLUsToPixel(IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = dialog.getVerticalDLUsToPixel(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = 0; descriptionComposite.setLayout(layout); descriptionComposite.setFont(font); data = new GridData(SWT.FILL, SWT.FILL, true, true); descriptionComposite.setLayoutData(data); createDescriptionArea(font, descriptionComposite); initializationComplete = true; }
From source file:org.eclipse.ui.internal.ide.dialogs.ResourceFilterGroup.java
License:Open Source License
private void createCustomArgumentsArea(Font font, Composite composite) { GridData data;/*from w w w .j a va 2 s. c o m*/ multiArgumentComposite = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 3; layout.marginWidth = dialog.getHorizontalDLUsToPixel(IDialogConstants.HORIZONTAL_MARGIN); layout.horizontalSpacing = dialog.getHorizontalDLUsToPixel(IDialogConstants.HORIZONTAL_SPACING); layout.marginTop = dialog.getVerticalDLUsToPixel(IDialogConstants.VERTICAL_SPACING); layout.marginHeight = 0; multiArgumentComposite.setLayout(layout); multiArgumentComposite.setFont(font); data = new GridData(SWT.FILL, SWT.FILL, true, true); multiArgumentComposite.setLayoutData(data); multiKey = new Combo(multiArgumentComposite, SWT.READ_ONLY); multiKey.setItems(getMultiMatcherKeys()); data = new GridData(SWT.LEFT, SWT.TOP, false, false); multiKey.setLayoutData(data); multiKey.setFont(font); multiKey.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { setupMultiOperatorAndField(true); storeMultiSelection(); } }); // calculate max combo width ArrayList allOperators = new ArrayList(); String[] keys = getMultiMatcherKeys(); for (int i = 0; i < keys.length; i++) { allOperators.addAll( Arrays.asList(getLocalOperatorsForKey(MultiMatcherLocalization.getMultiMatcherKey(keys[i])))); } Combo tmp = new Combo(multiArgumentComposite, SWT.READ_ONLY); tmp.setItems((String[]) allOperators.toArray(new String[0])); int maxWidth = tmp.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; tmp.dispose(); multiOperator = new Combo(multiArgumentComposite, SWT.READ_ONLY); data = new GridData(SWT.LEFT, SWT.TOP, false, false); data.widthHint = maxWidth; multiOperator.setLayoutData(data); multiOperator.setFont(font); multiOperator.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { setupMultiOperatorAndField(false); storeMultiSelection(); } }); FileInfoAttributesMatcher.Argument argument = FileInfoAttributesMatcher .decodeArguments((String) filter.getArguments()); String local = MultiMatcherLocalization.getLocalMultiMatcherKey(argument.key); int index = multiKey.indexOf(local); if (index != -1) multiKey.select(index); else multiKey.select(0); setupMultiOperatorAndField(true); }
From source file:org.eclipse.ui.internal.ide.dialogs.ResourceFilterGroup.java
License:Open Source License
public void create(Composite argumentComposite, Font font) { shell = argumentComposite.getShell(); GridLayout layout = new GridLayout(); layout.numColumns = 2;/*w w w. java2 s . c o m*/ layout.marginWidth = dialog.getVerticalDLUsToPixel(IDialogConstants.HORIZONTAL_MARGIN); argumentComposite.setLayout(layout); GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); argumentComposite.setLayoutData(data); argumentComposite.setFont(font); if (filter.hasStringArguments()) createArgumentsArea(font, argumentComposite); createDescriptionArea(font, argumentComposite); if (fContentAssistField != null) fContentAssistField.setEnabled(filter.getId().equals(REGEX_FILTER_ID)); argumentComposite.layout(true); }
From source file:org.eclipse.ui.internal.statushandlers.InternalDialog.java
License:Open Source License
/** * This method creates button bar that is available on the bottom of the * dialog./*from w w w.ja va2 s . c om*/ */ protected Control createButtonBar(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); composite.setLayout(layout); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); linkComposite = createLinkComposite(composite); // Add the buttons to the button bar. createButtonsForButtonBar(composite); composite.layout(); return composite; }
From source file:org.eclipse.ui.internal.views.markers.QuickFixPage.java
License:Open Source License
public void createControl(Composite parent) { initializeDialogUnits(parent);// w ww.j a v a2s . co m // Create a new composite as there is the title bar seperator // to deal with Composite control = new Composite(parent, SWT.NONE); control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); setControl(control); PlatformUI.getWorkbench().getHelpSystem().setHelp(control, IWorkbenchHelpContextIds.PROBLEMS_VIEW); FormLayout layout = new FormLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.spacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); control.setLayout(layout); Label resolutionsLabel = new Label(control, SWT.NONE); resolutionsLabel.setText(MarkerMessages.MarkerResolutionDialog_Resolutions_List_Title); resolutionsLabel.setLayoutData(new FormData()); createResolutionsList(control); FormData listData = new FormData(); listData.top = new FormAttachment(resolutionsLabel, 0); listData.left = new FormAttachment(0); listData.right = new FormAttachment(100, 0); listData.height = convertHeightInCharsToPixels(10); resolutionsList.getControl().setLayoutData(listData); Label title = new Label(control, SWT.NONE); title.setText(MarkerMessages.MarkerResolutionDialog_Problems_List_Title); FormData labelData = new FormData(); labelData.top = new FormAttachment(resolutionsList.getControl(), 0); labelData.left = new FormAttachment(0); title.setLayoutData(labelData); createMarkerTable(control); Composite buttons = createTableButtons(control); FormData buttonData = new FormData(); buttonData.top = new FormAttachment(title, 0); buttonData.right = new FormAttachment(100); buttonData.height = convertHeightInCharsToPixels(10); buttons.setLayoutData(buttonData); FormData tableData = new FormData(); tableData.top = new FormAttachment(buttons, 0, SWT.TOP); tableData.left = new FormAttachment(0); tableData.bottom = new FormAttachment(100); tableData.right = new FormAttachment(buttons, 0); tableData.height = convertHeightInCharsToPixels(10); markersTable.getControl().setLayoutData(tableData); Dialog.applyDialogFont(control); resolutionsList.setSelection(new StructuredSelection(resolutionsList.getElementAt(0))); markersTable.setCheckedElements(selectedMarkers); setPageComplete(markersTable.getCheckedElements().length > 0); }
From source file:org.eclipse.ui.texteditor.ChangeEncodingAction.java
License:Open Source License
public void run() { final IResource resource = getResource(); final Shell parentShell = getTextEditor().getSite().getShell(); final IEncodingSupport encodingSupport = getEncodingSupport(); if (resource == null && encodingSupport == null) { MessageDialog.openInformation(parentShell, fDialogTitle, TextEditorMessages.ChangeEncodingAction_message_noEncodingSupport); return;// w w w. j a v a 2 s .c o m } Dialog dialog = new Dialog(parentShell) { private AbstractEncodingFieldEditor fEncodingEditor; private IPreferenceStore store = null; /* * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) */ protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText(fDialogTitle); } /* * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); composite = new Composite(composite, 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); GridData data = new GridData(GridData.FILL_BOTH); composite.setLayoutData(data); composite.setFont(parent.getFont()); DialogPage page = new MessageDialogPage(composite) { public void setErrorMessage(String newMessage) { super.setErrorMessage(newMessage); setButtonEnabledState(IDialogConstants.OK_ID, newMessage == null); setButtonEnabledState(APPLY_ID, newMessage == null); } private void setButtonEnabledState(int id, boolean state) { Button button = getButton(id); if (button != null) button.setEnabled(state); } }; if (resource != null) { fEncodingEditor = new ResourceEncodingFieldEditor("", composite, resource, null); //$NON-NLS-1$ fEncodingEditor.setPage(page); fEncodingEditor.load(); } else { fEncodingEditor = new EncodingFieldEditor(ENCODING_PREF_KEY, "", null, composite); //$NON-NLS-1$ store = new PreferenceStore(); String defaultEncoding = encodingSupport.getDefaultEncoding(); store.setDefault(ENCODING_PREF_KEY, defaultEncoding); String encoding = encodingSupport.getEncoding(); if (encoding != null) store.setValue(ENCODING_PREF_KEY, encoding); fEncodingEditor.setPreferenceStore(store); fEncodingEditor.setPage(page); fEncodingEditor.load(); if (encoding == null || encoding.equals(defaultEncoding) || encoding.length() == 0) fEncodingEditor.loadDefault(); } return composite; } /* * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) */ protected void createButtonsForButtonBar(Composite parent) { createButton(parent, APPLY_ID, TextEditorMessages.ChangeEncodingAction_button_apply_label, false); super.createButtonsForButtonBar(parent); } /* * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int) */ protected void buttonPressed(int buttonId) { if (buttonId == APPLY_ID) apply(); else super.buttonPressed(buttonId); } /* * @see org.eclipse.jface.dialogs.Dialog#okPressed() */ protected void okPressed() { apply(); super.okPressed(); } private void apply() { fEncodingEditor.store(); if (resource == null) { String encoding = fEncodingEditor.getPreferenceStore() .getString(fEncodingEditor.getPreferenceName()); encodingSupport.setEncoding(encoding); } } }; dialog.open(); }
From source file:org.eclipse.ui.views.markers.internal.DialogProblemFilter.java
License:Open Source License
Composite createSelectedFilterArea(Composite composite) { Composite wrapper = new Composite(composite, SWT.NONE); FormLayout wrapperLayout = new FormLayout(); wrapperLayout.marginHeight = 0;/* w w w . j av a2 s . c om*/ wrapperLayout.marginWidth = 0; wrapper.setLayout(wrapperLayout); systemSettingsLabel = createSystemSettingsLabel(wrapper); systemSettingsLabel.setVisible(false); FormData systemData = new FormData(); systemData.top = new FormAttachment(0, IDialogConstants.VERTICAL_MARGIN); systemData.left = new FormAttachment(0, IDialogConstants.HORIZONTAL_MARGIN); systemData.right = new FormAttachment(100, -1 * IDialogConstants.HORIZONTAL_MARGIN); systemData.bottom = new FormAttachment(100, -1 * IDialogConstants.VERTICAL_MARGIN); systemSettingsLabel.setLayoutData(systemData); userFilterComposite = super.createSelectedFilterArea(wrapper); FormData userData = new FormData(); userData.top = new FormAttachment(0); userData.left = new FormAttachment(0); userData.right = new FormAttachment(100); userData.bottom = new FormAttachment(100); userFilterComposite.setLayoutData(userData); return wrapper; }