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.wst.jsdt.internal.ui.refactoring.reorg.RenameTypeWizardSimilarElementsOptionsDialog.java
License:Open Source License
protected Control createMessageArea(Composite parent) { initializeDialogUnits(parent);//from w w w .java 2s . c o m Composite messageComposite = new Composite(parent, SWT.NONE); messageComposite.setFont(parent.getFont()); GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); messageComposite.setLayout(layout); messageComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); Label infoLabel = new Label(messageComposite, SWT.WRAP); infoLabel.setText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_select_strategy); GridData gd = new GridData(GridData.FILL, GridData.CENTER, true, false); gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); infoLabel.setLayoutData(gd); infoLabel.setFont(parent.getFont()); int indent = convertWidthInCharsToPixels(3); fExactStrategyRadio = new SelectionButtonDialogField(SWT.RADIO); fExactStrategyRadio .setLabelText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_strategy_1); fExactStrategyRadio.doFillIntoGrid(messageComposite, 1); fExactStrategyRadio.setSelection(fSelectedStrategy == RenamingNameSuggestor.STRATEGY_EXACT); LayoutUtil.setHorizontalIndent(fExactStrategyRadio.getSelectionButton(null), indent); fEmbeddedStrategyRadio = new SelectionButtonDialogField(SWT.RADIO); fEmbeddedStrategyRadio .setLabelText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_strategy_2); fEmbeddedStrategyRadio.doFillIntoGrid(messageComposite, 1); fEmbeddedStrategyRadio.setSelection(fSelectedStrategy == RenamingNameSuggestor.STRATEGY_EMBEDDED); LayoutUtil.setHorizontalIndent(fEmbeddedStrategyRadio.getSelectionButton(null), indent); fSuffixStrategyRadio = new SelectionButtonDialogField(SWT.RADIO); fSuffixStrategyRadio .setLabelText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_strategy_3); fSuffixStrategyRadio.doFillIntoGrid(messageComposite, 1); fSuffixStrategyRadio.setSelection(fSelectedStrategy == RenamingNameSuggestor.STRATEGY_SUFFIX); LayoutUtil.setHorizontalIndent(fSuffixStrategyRadio.getSelectionButton(null), indent); final Composite warningComposite = new Composite(messageComposite, SWT.NONE); layout = new GridLayout(); layout.numColumns = 2; layout.marginWidth = 0; layout.marginHeight = 0; warningComposite.setLayout(layout); warningComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); warningComposite.setFont(messageComposite.getFont()); Image image = Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); fWarningImageLabel = new Label(warningComposite, SWT.LEFT | SWT.WRAP); fWarningImageLabel.setImage(image); fWarningImageLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 1, 1)); fWarningLabel = new Label(warningComposite, SWT.WRAP); fWarningLabel.setText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_warning_short_names); GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1); gridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); fWarningLabel.setLayoutData(gridData); fWarningLabel.setFont(warningComposite.getFont()); fExactStrategyRadio.setDialogFieldListener(new IDialogFieldListener() { public void dialogFieldChanged(DialogField field) { updateLabel(); fSelectedStrategy = RenamingNameSuggestor.STRATEGY_EXACT; } }); fEmbeddedStrategyRadio.setDialogFieldListener(new IDialogFieldListener() { public void dialogFieldChanged(DialogField field) { updateLabel(); fSelectedStrategy = RenamingNameSuggestor.STRATEGY_EMBEDDED; } }); fSuffixStrategyRadio.setDialogFieldListener(new IDialogFieldListener() { public void dialogFieldChanged(DialogField field) { updateLabel(); fSelectedStrategy = RenamingNameSuggestor.STRATEGY_SUFFIX; } }); updateLabel(); return messageComposite; }
From source file:org.eclipse.wst.jsdt.internal.ui.text.java.ContentAssistProcessor.java
License:Open Source License
/** * Informs the user about the fact that there are no enabled categories in the default content * assist set and shows a link to the preferences. * /*from w w w.ja va 2s .c om*/ * */ private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = JavaScriptPlugin.getActiveWorkbenchShell(); String title = JavaTextMessages.ContentAssistProcessor_all_disabled_title; String message = JavaTextMessages.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( JavaTextMessages.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) { /* * @see org.eclipse.wst.jsdt.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); // create checkbox and "don't show this message" prompt super.createCustomArea(parent); return parent; } /* * @see org.eclipse.jface.dialogs.MessageDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) */ 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 = JavaScriptPlugin.getDefault().getPreferenceStore(); store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER); store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES); } if (settingsId == returnValue) PreferencesUtil .createPreferenceDialogOn(shell, "org.eclipse.wst.jsdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$ .open(); CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry.getDefault(); registry.reload(); return true; } } return false; }
From source file:org.eclipse.wst.server.ui.internal.DeleteServerDialog.java
License:Open Source License
/** * /* ww w .j av a2 s .co m*/ */ protected Control createCustomArea(Composite 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); composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setFont(parent.getFont()); PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.DELETE_SERVER_DIALOG); if (configs.length > 0) { checkDeleteConfigs = new Button(composite, SWT.CHECK); checkDeleteConfigs .setText(NLS.bind(Messages.deleteServerDialogLooseConfigurations, configs[0].getName())); checkDeleteConfigs.setSelection(true); } // prompt for stopping running servers int size = runningServersList.size(); if (size > 0) { if (servers.length > 1) { checkDeleteRunning = new Button(composite, SWT.CHECK); checkDeleteRunning.setText(Messages.deleteServerDialogRunningServer); checkDeleteRunning.setSelection(true); } if (runningServerCanStop) { checkDeleteRunningStop = new Button(composite, SWT.CHECK); checkDeleteRunningStop.setText(Messages.deleteServerDialogRunningServerStop); checkDeleteRunningStop.setSelection(true); GridData data = new GridData(); if (checkDeleteRunning != null) { // Only indent the checkbox if the delete running servers checkbox is available. data.horizontalIndent = 15; checkDeleteRunning.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { checkDeleteRunningStop.setEnabled(checkDeleteRunning.getSelection()); } }); } checkDeleteRunningStop.setLayoutData(data); } } List<DeleteServerDialogExtension> fullDialogExtensionLst = ServerUIPlugin.getDeleteServerDialogExtensions(); // Add the dialog extension UI. for (DeleteServerDialogExtension curDialogExtension : fullDialogExtensionLst) { curDialogExtension.setServers(servers); if (curDialogExtension.isEnabled()) { dialogExtensionLst.add(curDialogExtension); curDialogExtension.createControl(composite); } } Dialog.applyDialogFont(composite); return composite; }
From source file:org.eclipse.wst.server.ui.internal.TerminationDialog.java
License:Open Source License
/** * Creates and returns the contents of the upper part * of this dialog (above the button bar). * * @param parent the parent composite to contain the dialog area * @return the dialog area control/*from ww w . j av a 2 s .c o m*/ */ protected Control createDialogArea(Composite 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); composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setFont(parent.getFont()); PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.TERMINATE_SERVER_DIALOG); Label label = new Label(composite, SWT.WRAP); label.setText(NLS.bind(Messages.terminateServerDialogMessage, new String[] { serverName })); GridData data = new GridData(); data.widthHint = 400; label.setLayoutData(data); Dialog.applyDialogFont(composite); return composite; }
From source file:org.eclipse.wst.server.ui.internal.viewers.MonitorDialog.java
License:Open Source License
/** * //from w w w . ja v a2 s. c om */ protected Control createDialogArea(Composite 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); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setFont(parent.getFont()); //WorkbenchHelp.setHelp(composite, ContextIds.TERMINATE_SERVER_DIALOG); Label label = new Label(composite, SWT.WRAP); label.setText(NLS.bind(Messages.dialogMonitorAddDescription, new String[] { server.getName() })); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); data.horizontalSpan = 2; data.widthHint = 275; label.setLayoutData(data); table = new Table(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION); data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); data.heightHint = 100; data.horizontalSpan = 2; table.setLayoutData(data); table.setLinesVisible(true); tableViewer = new TableViewer(table); TableLayout tableLayout = new TableLayout(); table.setLayout(tableLayout); table.setHeaderVisible(true); tableLayout.addColumnData(new ColumnWeightData(12, 120, true)); TableColumn col = new TableColumn(table, SWT.NONE); col.setText(Messages.dialogMonitorColumnType); tableLayout.addColumnData(new ColumnWeightData(4, 40, true)); col = new TableColumn(table, SWT.NONE); col.setText(Messages.dialogMonitorColumnPort); tableViewer.setContentProvider(new PortContentProvider(server)); tableViewer.setLabelProvider(new PortLabelProvider(server)); tableViewer.setInput(AbstractTreeContentProvider.ROOT); tableViewer.setSorter(new ViewerSorter() { public int compare(Viewer viewer, Object e1, Object e2) { ServerPort port1 = (ServerPort) e1; ServerPort port2 = (ServerPort) e2; if (port1.getPort() == port2.getPort()) return 0; else if (port1.getPort() > port2.getPort()) return 1; else return -1; } }); label = new Label(composite, SWT.NONE); label.setText(Messages.dialogMonitorMonitorPort); final Text portText = new Text(composite, SWT.BORDER); data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = 150; portText.setLayoutData(data); if (monitorPort >= 0) portText.setText(monitorPort + ""); portText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { try { monitorPort = Integer.parseInt(portText.getText()); if (ok != null) ok.setEnabled(true); } catch (Exception ex) { monitorPort = -1; if (ok != null) ok.setEnabled(false); } portChanged = true; } }); label = new Label(composite, SWT.NONE); label.setText(Messages.dialogMonitorContentType); final Combo combo = new Combo(composite, SWT.READ_ONLY); data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = 150; combo.setLayoutData(data); combo.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { int size = combo.getItemCount(); int sel = combo.getSelectionIndex(); if (sel == size - 1) contentTypes = portContentTypes; else contentTypes = new String[] { portContentTypes[sel] }; } }); tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { port = (ServerPort) getSelection(tableViewer.getSelection()); if (port == null) return; if (!portChanged) { portText.setText((port.getPort() + 1) + ""); portChanged = false; } portContentTypes = port.getContentTypes(); String[] s = null; String all = Messages.dialogMonitorContentTypeAll; if (portContentTypes == null || portContentTypes.length == 1) { s = new String[] { all }; } else { int size = portContentTypes.length; s = new String[size + 1]; for (int i = 0; i < size; i++) { s[i] = MonitorLabelProvider.getContentTypeString(portContentTypes[i]); } s[size] = all; } combo.setItems(s); combo.setText(all); } }); Dialog.applyDialogFont(composite); if (port != null) { portChanged = true; String[] ct = contentTypes; tableViewer.setSelection(new StructuredSelection(port)); if (ct != null && ct.length > 0) combo.setText(MonitorLabelProvider.getContentTypeString(ct[0])); } else if (tableViewer != null) { try { Object obj = tableViewer.getElementAt(0); if (obj != null) tableViewer.setSelection(new StructuredSelection(obj)); } catch (Exception e) { // ignore } } portChanged = false; return composite; }
From source file:org.eclipse.wst.sse.ui.contentassist.StructuredContentAssistProcessor.java
License:Open Source License
/** * <p>Informs the user about the fact that there are no enabled categories in the default content * assist set and shows a link to the preferences.</p> * * @return <code>true</code> if the default should be restored *//* ww w.j ava 2s . c om*/ private boolean informUserAboutEmptyDefaultCategory() { /*If warn about empty default category and there are associated properties for this * processors content type and those properties have an associated properties page then * display warning message to user. */ ICompletionProposalCategoriesConfigurationReader properties = CompletionProposoalCatigoriesConfigurationRegistry .getDefault().getReadableConfiguration(this.fContentTypeID); if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY) && properties instanceof ICompletionProposalCategoriesConfigurationWriter && ((ICompletionProposalCategoriesConfigurationWriter) properties).hasAssociatedPropertiesPage()) { ICompletionProposalCategoriesConfigurationWriter propertiesExtension = (ICompletionProposalCategoriesConfigurationWriter) properties; final Shell shell = SSEUIPlugin.getActiveWorkbenchShell(); String title = SSEUIMessages.ContentAssist_all_disabled_title; String message = SSEUIMessages.ContentAssist_all_disabled_message; // see PreferencePage#createControl for the 'defaults' label final String restoreButtonLabel = JFaceResources.getString("defaults"); //$NON-NLS-1$ final String linkMessage = NLS.bind(SSEUIMessages.ContentAssist_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) { /* * @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); // create checkbox and "don't show this message" prompt super.createCustomArea(parent); return parent; } /* * @see org.eclipse.jface.dialogs.MessageDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) */ 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(); //based on user actions either reset defaults or open preference dialog if (restoreId == returnValue || settingsId == returnValue) { if (restoreId == returnValue) { propertiesExtension.loadDefaults(); propertiesExtension.saveConfiguration(); } if (settingsId == returnValue) { PreferencesUtil .createPreferenceDialogOn(shell, propertiesExtension.getPropertiesPageID(), null, null) .open(); } return true; } } return false; }
From source file:org.eclipse.wst.sse.ui.internal.contentassist.OptionalMessageDialog.java
License:Open Source License
protected Control createCustomArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout);/* w w w .j a v a 2 s. com*/ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); fHideDialogCheckBox = new Button(composite, SWT.CHECK | SWT.LEFT); fHideDialogCheckBox.setText(fCheckBoxText); fHideDialogCheckBox.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { setDialogEnabled(fId, !((Button) e.widget).getSelection()); } }); applyDialogFont(fHideDialogCheckBox); return fHideDialogCheckBox; }
From source file:org.eclipse.wst.sse.ui.internal.filter.OutlineCustomFiltersDialog.java
License:Open Source License
/** * Overrides method in Dialog// w w w . j a va2 s. c o m * * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite) */ protected Control createDialogArea(Composite parent) { initializeDialogUnits(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); composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setFont(parent.getFont()); Composite group = composite; // Checkbox fEnableUserDefinedPatterns = new Button(group, SWT.CHECK); fEnableUserDefinedPatterns.setFocus(); fEnableUserDefinedPatterns.setText(OutlineFilterMessages.CustomFiltersDialog_enableUserDefinedPattern); // Pattern field fUserDefinedPatterns = new Text(group, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.widthHint = convertWidthInCharsToPixels(59); fUserDefinedPatterns.setLayoutData(data); String patterns = convertToString(fPatterns, SEPARATOR); fUserDefinedPatterns.setText(patterns); SWTUtil.setAccessibilityText(fUserDefinedPatterns, OutlineFilterMessages.CustomFiltersDialog_name_filter_pattern_description); // Info text final Label info = new Label(group, SWT.LEFT); info.setText(OutlineFilterMessages.CustomFiltersDialog_patternInfo); // Enabling / disabling of pattern group fEnableUserDefinedPatterns.setSelection(fEnablePatterns); fUserDefinedPatterns.setEnabled(fEnablePatterns); info.setEnabled(fEnablePatterns); fEnableUserDefinedPatterns.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { boolean state = fEnableUserDefinedPatterns.getSelection(); fUserDefinedPatterns.setEnabled(state); info.setEnabled(fEnableUserDefinedPatterns.getSelection()); if (state) fUserDefinedPatterns.setFocus(); } }); // Filters provided by extension point if (fBuiltInFilters.length > 0) createCheckBoxList(group); applyDialogFont(parent); return parent; }
From source file:org.eclipse.wst.xquery.debug.ui.interpreters.AbstractAddInterpreterDialogBlock.java
License:Open Source License
public final void createControls(Composite comp) { fContainer = new Composite(comp, SWT.NONE); GridLayout layout = new GridLayout(3, false); layout.marginWidth = 0;/* w ww. j a va 2s . co m*/ layout.marginHeight = 0; layout.verticalSpacing = fAddInterpreterDialog .convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = fAddInterpreterDialog .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); fContainer.setLayout(layout); GridData gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 3; fContainer.setLayoutData(gd); addControlsTo(fContainer); }
From source file:org.eclipse.wst.xquery.debug.ui.interpreters.GenericAddInterpreterDialog.java
License:Open Source License
protected Control createDialogArea(Composite ancestor) { Composite parent = (Composite) super.createDialogArea(ancestor); int numColumns = 3; fDialogBlockContainer = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(numColumns, false); layout.marginWidth = 0;// ww w.j a v a 2 s .co m layout.marginHeight = 0; layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); fDialogBlockContainer.setLayout(layout); fDialogBlockContainer.setLayoutData(new GridData(GridData.FILL_BOTH)); fInterpreterTypeCombo = new ComboDialogField(SWT.READ_ONLY); fInterpreterTypeCombo.setLabelText(getInterpreterTypeLabel()); fInterpreterTypeCombo.doFillIntoGrid(fDialogBlockContainer, 2); GridData gd = (GridData) fInterpreterTypeCombo.getComboControl(null).getLayoutData(); gd.horizontalSpan = 2; gd.horizontalAlignment = SWT.END; createAddInterpreterDialogBlock(); fDialogBlock.createControls(fDialogBlockContainer); initializeFields(fEditedInterpreter); createFieldListeners(); applyDialogFont(fDialogBlockContainer); return parent; }