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.edt.ide.ui.preferences.CompilerPropertyAndPreferencePage.java
License:Open Source License
/** * Create a composite to hold generator tabs for a property * page or a preference page for a compiler. * //from w w w .j ava2s . c o m * @param composite */ protected void createGeneratorTabsComposite(Composite composite) { this.tabComposite = new Composite(composite, SWT.NONE); GridLayout tabLayout = new GridLayout(); tabLayout.marginWidth = 0; tabLayout.numColumns = 1; PixelConverter pixelConverter = new PixelConverter(composite); tabLayout.verticalSpacing = (int) (1.5 * pixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING)); tabLayout.horizontalSpacing = pixelConverter .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); tabLayout.marginTop = 3; tabLayout.marginWidth = pixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); this.tabComposite.setLayout(tabLayout); this.tabComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); this.tabFolder = new TabFolder(this.tabComposite, SWT.NONE); this.tabFolder.setLayout(new TabFolderLayout()); this.tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH)); }
From source file:org.eclipse.egit.gitflow.ui.internal.dialogs.FinishFeatureDialog.java
License:Open Source License
@Override protected Control createButtonBar(Composite parent) { final Composite customButtonBar = new Composite(parent, SWT.NONE); int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(false).spacing(horizontalSpacing, 0) .applyTo(customButtonBar);//w w w . j av a 2 s . c om GridDataFactory.swtDefaults().grab(true, false).align(SWT.FILL, SWT.BOTTOM).applyTo(customButtonBar); customButtonBar.setFont(parent.getFont()); rememberOptionsButton = new Button(customButtonBar, SWT.CHECK); rememberOptionsButton.setText(UIText.FinishFeatureDialog_saveAsDefault); // TODO: Checkbox "Don't ask again" int horizontlIndent = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); GridDataFactory.swtDefaults().grab(true, true).align(SWT.FILL, SWT.CENTER).indent(horizontlIndent, 0) .applyTo(rememberOptionsButton); // add the dialog's button bar to the right final Control buttonControl = super.createButtonBar(customButtonBar); GridDataFactory.swtDefaults().grab(true, false).align(SWT.RIGHT, SWT.CENTER).applyTo(buttonControl); return customButtonBar; }
From source file:org.eclipse.egit.ui.internal.SWTUtils.java
License:Open Source License
/** * Creates a grid layout with the specified number of columns and the * standard spacings./*w w w. ja v a2 s . c om*/ * * @param numColumns * the number of columns * @param converter * the pixel converter * @param margins * one of <code>MARGINS_DEFAULT</code>, <code>MARGINS_NONE</code> * or <code>MARGINS_DIALOG</code>. * * @return the created grid layout */ public static GridLayout createGridLayout(int numColumns, PixelConverter converter, int margins) { Assert.isTrue(margins == MARGINS_DEFAULT || margins == MARGINS_NONE || margins == MARGINS_DIALOG); final GridLayout layout = new GridLayout(numColumns, false); layout.horizontalSpacing = converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); switch (margins) { case MARGINS_NONE: layout.marginLeft = layout.marginRight = 0; layout.marginTop = layout.marginBottom = 0; break; case MARGINS_DIALOG: layout.marginLeft = layout.marginRight = converter .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginTop = layout.marginBottom = converter .convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); break; case MARGINS_DEFAULT: layout.marginLeft = layout.marginRight = layout.marginWidth; layout.marginTop = layout.marginBottom = layout.marginHeight; } layout.marginWidth = layout.marginHeight = 0; return layout; }
From source file:org.eclipse.emf.eef.runtime.ui.widgets.ElementSelectionDialog.java
License:Open Source License
/** * Used to display a page/* www .ja v a2s . c o m*/ * * @param parent * composite which contains the tree * @return the composite of this page */ public Control fillModelpage(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.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout); // use pattern filter PatternFilter patternFilter = new TreeSelectionPatternFilter(); patternFilter.setIncludeLeadingWildcard(true); FilteredTree filteredTree = new FilteredTree(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.RESIZE, patternFilter, true); // use of EMF facilities final TreeViewer treeViewer = filteredTree.getViewer(); treeViewer.setFilters(new ViewerFilter[0]); treeViewer.setUseHashlookup(true); if (input instanceof EEFEditorSettings) treeViewer.setContentProvider( new HideResourcesContentProvider(new AdvancedEEFEditorContentProvider(adapterFactory))); else treeViewer.setContentProvider( new HideResourcesContentProvider(new AdapterFactoryContentProvider(adapterFactory))); ArrayList<ViewerFilter> filters = new ArrayList<ViewerFilter>(); if (viewerFilters != null && !viewerFilters.isEmpty()) { for (ViewerFilter filter : viewerFilters) { filters.add(filter); } } // for now, add the businessRuleFilters to the 'normal' filters if (brFilters != null && !brFilters.isEmpty()) { for (ViewerFilter filter : brFilters) { filters.add(filter); } } filters.add(patternFilter); ViewerFilter[] v = filters.toArray(new ViewerFilter[filters.size()]); treeViewer.setFilters(v); treeViewer.setLabelProvider(new EEFLabelProvider() { @Override public Color getForeground(Object element) { if (input instanceof ReferencesTableSettings && element instanceof EObject && ((ReferencesTableSettings) input).contains((EObject) element)) { return getShell().getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW); } return super.getForeground(element); } }); filteredTree.setLayoutData(new GridData(550, 300)); // handle selection change if (input instanceof EEFEditorSettings) { treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { if (event.getSelection() instanceof IStructuredSelection) { // Check selection IStructuredSelection structuredSelection = (IStructuredSelection) event.getSelection(); if (structuredSelection != null && !structuredSelection.isEmpty()) { Object o = structuredSelection.getFirstElement(); // Check type matching Button okButton = getButton(IDialogConstants.OK_ID); if (((List<?>) ((EEFEditorSettings) input).choiceOfValues(adapterFactory)) .contains(o)) { if (input instanceof ReferencesTableSettings) { if (o instanceof EObject && !((ReferencesTableSettings) input).contains((EObject) o)) { selection = structuredSelection; if (okButton != null) { okButton.setEnabled(true); } } else { // Reject selection if (okButton != null) { okButton.setEnabled(false); } } } else { selection = structuredSelection; if (okButton != null) { okButton.setEnabled(true); } } } else { // Reject selection if (okButton != null) { okButton.setEnabled(false); } } } } } }); // handle double click to validate treeViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { if (selection != null && !selection.isEmpty()) { Object o = selection.getFirstElement(); if (((List<?>) ((EEFEditorSettings) input).choiceOfValues(adapterFactory)).contains(o) && input instanceof ReferencesTableSettings && o instanceof EObject && !((ReferencesTableSettings) input).contains((EObject) o)) { okPressed(); } } } }); } treeViewer.setInput(input); // Init selected element if (selection != null) { treeViewer.setSelection(selection); } return composite; }
From source file:org.eclipse.emf.eef.runtime.ui.widgets.TabElementTreeSelectionDialog.java
License:Open Source License
/** * Used to display a page in a tab/*from w w w .jav a 2s. c om*/ * * @param tabFolder * that contains all tabs * @param specificTabFilter * a specific filter to this page * @return the composite of this page */ public Control fillModelpage(CTabFolder tabFolder, final boolean showResourceItem, final ViewerFilter specificTabFilter) { Composite composite = new Composite(tabFolder, 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); // use pattern filter PatternFilter patternFilter = new TreeSelectionPatternFilter(); patternFilter.setIncludeLeadingWildcard(true); FilteredTree filteredTree = new FilteredTree(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.RESIZE, patternFilter); // use of EMF facilities final TreeViewer treeViewer = filteredTree.getViewer(); treeViewer.setFilters(new ViewerFilter[0]); treeViewer.setUseHashlookup(true); if (input instanceof EEFEditorSettings) treeViewer.setContentProvider(new AdvancedEEFEditorContentProvider(adapterFactory)); else treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); ArrayList<ViewerFilter> filters = new ArrayList<ViewerFilter>(); if (specificTabFilter != null) { filters.add(specificTabFilter); } if (viewerFilters != null && !viewerFilters.isEmpty()) { for (ViewerFilter filter : viewerFilters) { filters.add(filter); } } // for now, add the businessRuleFilters to the 'normal' filters if (brFilters != null && !brFilters.isEmpty()) { for (ViewerFilter filter : brFilters) { filters.add(filter); } } filters.add(patternFilter); ViewerFilter[] v = filters.toArray(new ViewerFilter[filters.size()]); treeViewer.setFilters(v); treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); filteredTree.setLayoutData(new GridData(550, 300)); // handle selection change if (input instanceof EEFEditorSettings) { treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { if (event.getSelection() instanceof IStructuredSelection) { // Check selection IStructuredSelection structuredSelection = (IStructuredSelection) event.getSelection(); if (structuredSelection != null && !structuredSelection.isEmpty()) { Object o = structuredSelection.getFirstElement(); // Check type matching Button okButton = getButton(IDialogConstants.OK_ID); if (((List<?>) ((EEFEditorSettings) input).choiceOfValues(adapterFactory)) .contains(o)) { selection = structuredSelection; if (okButton != null) { okButton.setEnabled(true); } } else { // Reject selection if (okButton != null) { okButton.setEnabled(false); } } } } } }); // handle double click to validate treeViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { if (selection != null && !selection.isEmpty()) { Object o = selection.getFirstElement(); if (((List<?>) ((EEFEditorSettings) input).choiceOfValues(adapterFactory)).contains(o)) { okPressed(); } } } }); } treeViewer.setInput(input); // Init selected element if (selection != null) { treeViewer.setSelection(selection); } return composite; }
From source file:org.eclipse.emf.emfstore.client.ui.views.emfstorebrowser.views.CertificateSelectionDialog.java
License:Open Source License
/** * Overridden method to allow adding further elements onto the dialog * composite./* www .j a v a 2 s.c o m*/ * * @see org.eclipse.ui.dialogs.ElementListSelectionDialog#createDialogArea(org.eclipse.swt.widgets.Composite) * @return Control * @param parent * Parent */ @Override protected Control createDialogArea(Composite parent) { // standard layout used by dialogue area 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); // two column layout composite Composite grid = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(grid); // left column composite Composite left = new Composite(grid, SWT.NONE); GridLayoutFactory.fillDefaults().applyTo(left); // right column composite Composite right = new Composite(grid, SWT.NONE); GridLayoutFactory.createFrom(layout).margins(layout.marginWidth, 35).applyTo(right); GridDataFactory.fillDefaults().grab(true, true).hint(300, 200).applyTo(right); applyDialogFont(right); // right column: certificate details new Label(right, SWT.NONE).setText("Certificate Alias: "); final Text certAlias = new Text(right, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(certAlias); certAlias.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); certAlias.setEditable(false); new Label(right, SWT.NONE).setText("Certificate Details: "); final Text certDetails = new Text(right, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); GridDataFactory.fillDefaults().grab(true, false).hint(300, 230).applyTo(certDetails); certDetails.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); certDetails.setEditable(false); // left column: dialogue area composite (displays certificates and // filter) Composite dialogArea = new Composite(left, SWT.NONE); GridLayoutFactory.fillDefaults().applyTo(dialogArea); Control control = super.createDialogArea(dialogArea); GridDataFactory.fillDefaults().grab(true, true).applyTo(control); // left column: import button, composite used to ensure correct // alignment Composite certButtonsComposite = new Composite(grid, SWT.NONE); GridLayoutFactory.createFrom(layout).numColumns(3).equalWidth(true).margins(layout.marginWidth, 0) .applyTo(certButtonsComposite); applyDialogFont(certButtonsComposite); Button browse = new Button(certButtonsComposite, SWT.NONE); browse.setText("Import..."); browse.addSelectionListener(new CertificateSelectionListener()); // Delete certificate Button delete = new Button(certButtonsComposite, SWT.NONE); delete.setText("Delete"); delete.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { // nothing to do } public void widgetSelected(SelectionEvent e) { if (selectedTableItem != null && !selectedTableItem.getText().equals("")) { String alias = selectedTableItem.getText(); try { KeyStoreManager.getInstance().deleteCertificate(alias); setListElements(KeyStoreManager.getInstance().getCertificates().toArray()); } catch (CertificateStoreException e1) { setErrorMessage(e1.getMessage()); } } } }); fFilteredList.addSelectionListener(new SelectionListenerImplementation(certDetails, certAlias)); return control; }
From source file:org.eclipse.emf.emfstore.internal.client.ui.views.emfstorebrowser.views.CertificateSelectionDialog.java
License:Open Source License
/** * Overridden method to allow adding further elements onto the dialog * composite.//from w w w. java 2 s. c o m * * @see org.eclipse.ui.dialogs.ElementListSelectionDialog#createDialogArea(org.eclipse.swt.widgets.Composite) * @return Control * @param parent * Parent */ @Override protected Control createDialogArea(Composite parent) { // standard layout used by dialogue area final 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); // two column layout composite final Composite grid = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(grid); // left column composite final Composite left = new Composite(grid, SWT.NONE); GridLayoutFactory.fillDefaults().applyTo(left); // right column composite final Composite right = new Composite(grid, SWT.NONE); GridLayoutFactory.createFrom(layout).margins(layout.marginWidth, 35).applyTo(right); GridDataFactory.fillDefaults().grab(true, true).hint(300, 200).applyTo(right); applyDialogFont(right); // right column: certificate details new Label(right, SWT.NONE).setText(Messages.CertificateSelectionDialog_Alias); final Text certAlias = new Text(right, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(certAlias); certAlias.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); certAlias.setEditable(false); new Label(right, SWT.NONE).setText(Messages.CertificateSelectionDialog_Details); final Text certDetails = new Text(right, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); GridDataFactory.fillDefaults().grab(true, false).hint(300, 230).applyTo(certDetails); certDetails.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); certDetails.setEditable(false); // left column: dialogue area composite (displays certificates and // filter) final Composite dialogArea = new Composite(left, SWT.NONE); GridLayoutFactory.fillDefaults().applyTo(dialogArea); final Control control = super.createDialogArea(dialogArea); GridDataFactory.fillDefaults().grab(true, true).applyTo(control); // left column: import button, composite used to ensure correct // alignment final Composite certButtonsComposite = new Composite(grid, SWT.NONE); GridLayoutFactory.createFrom(layout).numColumns(3).equalWidth(true).margins(layout.marginWidth, 0) .applyTo(certButtonsComposite); applyDialogFont(certButtonsComposite); final Button browse = new Button(certButtonsComposite, SWT.NONE); browse.setText(Messages.CertificateSelectionDialog_Import); browse.addSelectionListener(new CertificateSelectionListener()); // Delete certificate final Button delete = new Button(certButtonsComposite, SWT.NONE); delete.setText(Messages.CertificateSelectionDialog_Delete); delete.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { // nothing to do } public void widgetSelected(SelectionEvent e) { if (selectedTableItem != null && StringUtils.isNotBlank(selectedTableItem.getText())) { final String alias = selectedTableItem.getText(); try { KeyStoreManager.getInstance().deleteCertificate(alias); setListElements(KeyStoreManager.getInstance().getCertificates().toArray()); } catch (final ESCertificateException e1) { setErrorMessage(e1.getMessage()); } } } }); fFilteredList.addSelectionListener(new SelectionListenerImplementation(certDetails, certAlias)); return control; }
From source file:org.eclipse.emf.eson.ui.editor.tree.XtextMultiEObjectSearchDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite container) { Composite parent = new Composite(container, SWT.NONE); parent.setLayout(new GridLayout(3, false)); parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); Composite leftComp = (Composite) super.createDialogArea(parent); createPickerButtons(parent);// w w w. j av a2 s . com Composite rightComp = new Composite(parent, SWT.NONE); selectedElementsLabel = new Label(rightComp, SWT.NONE); selectedElementsLabel.setText(SELECTED_ELEMENTS_LABEL); selectedElementsLabel.setFont(rightComp.getFont()); GridLayout rightCompLayout = new GridLayout(); rightCompLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); rightCompLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); rightCompLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); rightCompLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); rightComp.setLayout(rightCompLayout); rightComp.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(rightComp); GridLayout leftCompLayout = (GridLayout) leftComp.getLayout(); leftCompLayout.marginLeft = rightCompLayout.marginRight = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_MARGIN) / 2; leftCompLayout.marginWidth = rightCompLayout.marginWidth = 0; selectedTableViewer = new TableViewer(rightComp, getTableStyle()); selectedTableViewer.setContentProvider(getTableViewer().getContentProvider()); selectedTableViewer.setLabelProvider(getTableViewer().getLabelProvider()); GridData gd = new GridData(GridData.FILL_BOTH); gd.heightHint = convertHeightInCharsToPixels(getHeightInChars()); gd.widthHint = convertWidthInCharsToPixels(getWidthInChars()); Table table = selectedTableViewer.getTable(); table.setLayoutData(gd); table.setFont(container.getFont()); Label selectionMessageLabel = new Label(rightComp, SWT.NONE); setDefaultGridData(selectionMessageLabel); getTableViewer().addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { moveToSection(); } }); getSelectedTableViewer().addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { removeFromSelection(); } }); return leftComp; }
From source file:org.eclipse.equinox.internal.p2.ui.dialogs.AvailableIUsPage.java
License:Open Source License
private void createViewControlsArea(Composite parent) { showLatestVersionsCheckbox = new Button(parent, SWT.CHECK); showLatestVersionsCheckbox.setText(ProvUIMessages.AvailableIUsPage_ShowLatestVersions); showLatestVersionsCheckbox.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { updateQueryContext();// w w w . jav a 2 s . com availableIUGroup.updateAvailableViewState(); } public void widgetSelected(SelectionEvent e) { updateQueryContext(); availableIUGroup.updateAvailableViewState(); } }); hideInstalledCheckbox = new Button(parent, SWT.CHECK); hideInstalledCheckbox.setText(ProvUIMessages.AvailableIUsPage_HideInstalledItems); hideInstalledCheckbox.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { updateQueryContext(); availableIUGroup.updateAvailableViewState(); } public void widgetSelected(SelectionEvent e) { updateQueryContext(); availableIUGroup.updateAvailableViewState(); } }); useCategoriesCheckbox = new Button(parent, SWT.CHECK); useCategoriesCheckbox.setText(ProvUIMessages.AvailableIUsPage_GroupByCategory); useCategoriesCheckbox.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { updateQueryContext(); availableIUGroup.updateAvailableViewState(); } public void widgetSelected(SelectionEvent e) { updateQueryContext(); availableIUGroup.updateAvailableViewState(); } }); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false); gd.horizontalIndent = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); installLink = createLink(parent, new Action() { public void runWithEvent(Event event) { ProvUI.openInstallationDialog(event); } }, ProvUIMessages.AvailableIUsPage_GotoInstallInfo); installLink.setLayoutData(gd); filterOnEnvCheckBox = new Button(parent, SWT.CHECK); filterOnEnvCheckBox.setText(ProvUIMessages.AvailableIUsPage_FilterOnEnvCheckBox); filterOnEnvCheckBox.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { updateQueryContext(); availableIUGroup.updateAvailableViewState(); } public void widgetSelected(SelectionEvent e) { updateQueryContext(); availableIUGroup.updateAvailableViewState(); } }); if (getPolicy().getRepositoriesVisible()) { // Checkbox resolveAllCheckbox = new Button(parent, SWT.CHECK); resolveAllCheckbox.setText(ProvUIMessages.AvailableIUsPage_ResolveAllCheckbox); gd = new GridData(SWT.FILL, SWT.FILL, true, false); gd.horizontalSpan = 2; resolveAllCheckbox.setLayoutData(gd); } }
From source file:org.eclipse.equinox.internal.p2.ui.dialogs.IUDetailsGroup.java
License:Open Source License
/** * Creates the group composite that holds the details area * @param parent The parent composite// w ww. j ava 2 s .c o m */ void createGroupComposite(Composite parent) { Group detailsComposite = new Group(parent, SWT.NONE); GC gc = new GC(parent); gc.setFont(JFaceResources.getDialogFont()); FontMetrics fontMetrics = gc.getFontMetrics(); gc.dispose(); detailsComposite.setText(ProvUIMessages.ProfileModificationWizardPage_DetailsLabel); layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; detailsComposite.setLayout(layout); gd = new GridData(SWT.FILL, SWT.FILL, true, false); detailsComposite.setLayoutData(gd); gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.verticalIndent = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING); gd.heightHint = Dialog.convertHeightInCharsToPixels(fontMetrics, ILayoutConstants.DEFAULT_DESCRIPTION_HEIGHT); gd.minimumHeight = Dialog.convertHeightInCharsToPixels(fontMetrics, ILayoutConstants.MINIMUM_DESCRIPTION_HEIGHT); gd.widthHint = widthHint; if (scrollable) detailsArea = new Text(detailsComposite, SWT.WRAP | SWT.READ_ONLY | SWT.V_SCROLL); else detailsArea = new Text(detailsComposite, SWT.WRAP | SWT.READ_ONLY); detailsArea.setLayoutData(gd); gd = new GridData(SWT.END, SWT.BOTTOM, true, false); gd.horizontalIndent = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN); propLink = createLink(detailsComposite, new PropertyDialogAction(new SameShellProvider(parent.getShell()), selectionProvider), ProvUIMessages.AvailableIUsPage_GotoProperties); propLink.setLayoutData(gd); // set the initial state based on selection propLink.setVisible(!selectionProvider.getSelection().isEmpty()); }