List of usage examples for org.eclipse.jface.dialogs IDialogConstants VERTICAL_SPACING
int VERTICAL_SPACING
To view the source code for org.eclipse.jface.dialogs IDialogConstants VERTICAL_SPACING.
Click Source Link
From source file:org.eclipse.wst.jsdt.internal.ui.actions.GenerateConstructorUsingFieldsSelectionDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { initializeDialogUnits(parent);//from w w w .j a va 2 s . c o m Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); GridData gd = null; 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 classConstructorComposite = addSuperClassConstructorChoices(composite); gd = new GridData(GridData.FILL_BOTH); classConstructorComposite.setLayoutData(gd); Composite inner = new Composite(composite, SWT.NONE); GridLayout innerLayout = new GridLayout(); innerLayout.numColumns = 2; innerLayout.marginHeight = 0; innerLayout.marginWidth = 0; inner.setLayout(innerLayout); Label messageLabel = createMessageArea(inner); if (messageLabel != null) { gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 2; messageLabel.setLayoutData(gd); } CheckboxTreeViewer treeViewer = createTreeViewer(inner); gd = new GridData(GridData.FILL_BOTH); gd.widthHint = convertWidthInCharsToPixels(fWidth); gd.heightHint = convertHeightInCharsToPixels(fHeight); treeViewer.getControl().setLayoutData(gd); treeViewer.addSelectionChangedListener(fTreeViewerAdapter); Composite buttonComposite = createSelectionButtons(inner); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL); buttonComposite.setLayoutData(gd); gd = new GridData(GridData.FILL_BOTH); inner.setLayoutData(gd); Composite entryComposite = createInsertPositionCombo(composite); entryComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite commentComposite = createCommentSelection(composite); commentComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite overrideSuperComposite = createOmitSuper(composite); overrideSuperComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Control linkControl = createLinkControl(composite); if (linkControl != null) linkControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); gd = new GridData(GridData.FILL_BOTH); composite.setLayoutData(gd); applyDialogFont(composite); return composite; }
From source file:org.eclipse.wst.jsdt.internal.ui.dialogs.SortMembersMessageDialog.java
License:Open Source License
protected Control createMessageArea(Composite parent) { initializeDialogUnits(parent);/*from w w w .j a v a 2 s. 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)); createLinkControl(messageComposite); int indent = convertWidthInCharsToPixels(3); fNotSortAllRadio.doFillIntoGrid(messageComposite, 1); LayoutUtil.setHorizontalIndent(fNotSortAllRadio.getSelectionButton(null), indent); fSortAllRadio.doFillIntoGrid(messageComposite, 1); LayoutUtil.setHorizontalIndent(fSortAllRadio.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); final Label imageLabel1 = new Label(warningComposite, SWT.LEFT | SWT.WRAP); imageLabel1.setImage(image); imageLabel1.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 1, 1)); final Label label = new Label(warningComposite, SWT.WRAP); label.setText(DialogsMessages.SortMembersMessageDialog_sort_warning_label); GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1); gridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); label.setLayoutData(gridData); label.setFont(warningComposite.getFont()); fNotSortAllRadio.setDialogFieldListener(new IDialogFieldListener() { public void dialogFieldChanged(DialogField field) { imageLabel1.setEnabled(!fNotSortAllRadio.isSelected()); label.setEnabled(!fNotSortAllRadio.isSelected()); } }); imageLabel1.setEnabled(!fNotSortAllRadio.isSelected()); label.setEnabled(!fNotSortAllRadio.isSelected()); return messageComposite; }
From source file:org.eclipse.wst.jsdt.internal.ui.dialogs.SourceActionDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { initializeDialogUnits(parent);//from ww w. j av a 2 s.c om Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); GridData gd = null; 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); Label messageLabel = createMessageArea(composite); if (messageLabel != null) { gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 2; messageLabel.setLayoutData(gd); } Composite inner = new Composite(composite, SWT.NONE); GridLayout innerLayout = new GridLayout(); innerLayout.numColumns = 2; innerLayout.marginHeight = 0; innerLayout.marginWidth = 0; inner.setLayout(innerLayout); inner.setFont(parent.getFont()); CheckboxTreeViewer treeViewer = createTreeViewer(inner); gd = new GridData(GridData.FILL_BOTH); gd.widthHint = convertWidthInCharsToPixels(fWidth); gd.heightHint = convertHeightInCharsToPixels(fHeight); treeViewer.getControl().setLayoutData(gd); Composite buttonComposite = createSelectionButtons(inner); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL); buttonComposite.setLayoutData(gd); gd = new GridData(GridData.FILL_BOTH); inner.setLayoutData(gd); fInsertPositionComposite = createInsertPositionCombo(composite); fInsertPositionComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite commentComposite = createCommentSelection(composite); commentComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Control linkControl = createLinkControl(composite); if (linkControl != null) linkControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); gd = new GridData(GridData.FILL_BOTH); composite.setLayoutData(gd); applyDialogFont(composite); return composite; }
From source file:org.eclipse.wst.jsdt.internal.ui.preferences.formatter.CreateProfileDialog.java
License:Open Source License
public Control createDialogArea(Composite parent) { final int numColumns = 2; GridData gd;//from w ww. j a v a2 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(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 = JavaScriptPlugin.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:org.eclipse.wst.jsdt.internal.ui.refactoring.reorg.RenameTypeWizardSimilarElementsOptionsDialog.java
License:Open Source License
protected Control createMessageArea(Composite parent) { initializeDialogUnits(parent);/*from ww w . j a v a 2s.c om*/ 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.server.ui.internal.DeleteServerDialog.java
License:Open Source License
/** * /*from w w w . ja v a 2 s . c o 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 w ww . j a v 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
/** * /* w ww . j a va 2s .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); 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.internal.filter.OutlineCustomFiltersDialog.java
License:Open Source License
/** * Overrides method in Dialog/*from w ww .j a v a 2 s . co 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;//from w w w .j ava 2 s. c o 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); }