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.jst.server.tomcat.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// www .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(parent, ContextIds.SERVER_CLEAN_WORK_DIR_TERMINATE); Label label = new Label(composite, SWT.WRAP); label.setText(message); GridData data = new GridData(); data.widthHint = 400; label.setLayoutData(data); Dialog.applyDialogFont(composite); return composite; }
From source file:org.eclipse.jst.servlet.ui.internal.wizard.AddEditFilterMappingDialog.java
License:Open Source License
/** * Creates and returns the contents of this dialog's * button bar.//from w ww . j a v a 2 s . com * <p> * The <code>Dialog</code> implementation of this framework method * lays out a button bar and calls the <code>createButtonsForButtonBar</code> * framework method to populate it. Subclasses may override. * </p> * * @param parent the parent composite to contain the button bar * @return the button bar control */ @Override protected Control createButtonBar(Composite parent) { Composite composite = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = 0; layout.marginWidth = 0; composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite composite2 = new Composite(composite, SWT.NONE); // create a layout with spacing and margins appropriate for the font size. layout = new GridLayout(); layout.numColumns = 0; // this is incremented by createButton layout.makeColumnsEqualWidth = true; layout.marginWidth = convertHorizontalDLUsToPixels( org.eclipse.jface.dialogs.IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = convertVerticalDLUsToPixels( org.eclipse.jface.dialogs.IDialogConstants.VERTICAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels( org.eclipse.jface.dialogs.IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels( org.eclipse.jface.dialogs.IDialogConstants.VERTICAL_SPACING); composite2.setLayout(layout); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER); composite2.setLayoutData(data); composite2.setFont(parent.getFont()); // Add the buttons to the button bar. super.createButtonsForButtonBar(composite2); return composite; }
From source file:org.eclipse.jst.servlet.ui.internal.wizard.AddEditFilterMappingDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { GridData gd = new GridData(); fChild = new Composite(parent, SWT.NONE); PlatformUI.getWorkbench().getHelpSystem().setHelp(fChild, "com.ibm.etools.webapplicationedit.webx2010"); //$NON-NLS-1$ GridLayout gl = new GridLayout(); gl.numColumns = 2;//www. j a va 2s . c o m gl.marginHeight = 0; fChild.setLayout(gl); gd.verticalAlignment = GridData.FILL; gd.grabExcessVerticalSpace = true; fChild.setLayoutData(gd); // Create the Web Type radio buttons and text fields. fServletButton = new Button(fChild, SWT.RADIO); fServletButton.setText(WebAppEditResourceHandler.getString("Servlet_UI_")); //$NON-NLS-1$ = Servlet gd = new GridData(); fServletButton.setLayoutData(gd); fServletButton.addSelectionListener(this); fURLPatternButton = new Button(fChild, SWT.RADIO); fURLPatternButton.setText(WebAppEditResourceHandler.getString("URL_pattern_UI_")); //$NON-NLS-1$ gd = new GridData(); fURLPatternButton.setLayoutData(gd); fURLPatternButton.addSelectionListener(this); //Create URL Pattern page fPageBook = new PageBook(fChild, SWT.NONE); gd = new GridData(); gd.horizontalAlignment = GridData.FILL; gd.verticalAlignment = GridData.FILL; gd.grabExcessHorizontalSpace = true; gd.grabExcessVerticalSpace = true; gd.horizontalSpan = 2; fPageBook.setLayoutData(gd); Composite composite = new Composite(fPageBook, 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()); Label messageLabel = new Label(composite, SWT.NONE); gd = new GridData(); messageLabel.setLayoutData(gd); messageLabel.setText(URL_PATTERN_LABEL); fURLText = new Text(composite, SWT.BORDER); GridData spec = new GridData(); spec.grabExcessVerticalSpace = false; spec.grabExcessHorizontalSpace = true; spec.horizontalAlignment = GridData.FILL; spec.verticalAlignment = GridData.BEGINNING; fURLText.setLayoutData(spec); Listener l = new Listener() { public void handleEvent(Event evt) { updateOkState(); } }; fURLText.addListener(SWT.Modify, l); fURLPatternControl = composite; //Create Servlet page composite = new Composite(fPageBook, SWT.NONE); 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()); messageLabel = new Label(composite, SWT.NONE); gd = new GridData(); messageLabel.setLayoutData(gd); messageLabel.setText(WebAppEditResourceHandler.getString("Choose_a_servlet__1")); //$NON-NLS-1$ fUpperList = createUpperList(composite); fServletControl = composite; //Create Dispatchers control Group dispatchers = new Group(fChild, SWT.SHADOW_IN); dispatchers.setText(WebAppEditResourceHandler.getString("Select_Dispatchers_UI_")); //$NON-NLS-1$ dispatchers.setLayout(new CellLayout(2).setMargins(10, 10).setSpacing(5, 5)); GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); gridData.horizontalSpan = 2; dispatchers.setLayoutData(gridData); fRequest = new Button(dispatchers, SWT.CHECK); fRequest.setText(REQUEST); fForward = new Button(dispatchers, SWT.CHECK); fForward.setText(FORWARD); fInclude = new Button(dispatchers, SWT.CHECK); fInclude.setText(INCLUDE); fErorr = new Button(dispatchers, SWT.CHECK); fErorr.setText(ERROR); if (selectedItem != null) { if (selectedItem.isUrlPatternType()) { fSelection = URL_PATTERN; } else { fSelection = SERVLET; } } else { if (fServletNames == null || fServletNames.length == 0) { fSelection = URL_PATTERN; } } updateUpperListWidget(); fServletButton.setEnabled(true); if (fSelection == URL_PATTERN) { fURLPatternButton.setSelection(true); fPageBook.showPage(fURLPatternControl); fServletButton.setSelection(false); if (fServletNames == null || fServletNames.length == 0) { fServletButton.setEnabled(false); } if (selectedItem != null) { fURLText.setText(selectedItem.getName()); setDispatchers(selectedItem.getDispatchers()); } } else { fServletButton.setSelection(true); fPageBook.showPage(fServletControl); if (selectedItem != null) { fUpperList.setSelection(getServletIndex(fUpperList, selectedItem.getName())); setDispatchers(selectedItem.getDispatchers()); } } updateOkState(); return parent; }
From source file:org.eclipse.jst.servlet.ui.internal.wizard.MultiSelectFilteredFileSelectionDialog.java
License:Open Source License
/** * Creates and returns the contents of this dialog's * button bar.//from w w w . j a v a2s.c o m * <p> * The <code>Dialog</code> implementation of this framework method * lays out a button bar and calls the <code>createButtonsForButtonBar</code> * framework method to populate it. Subclasses may override. * </p> * * @param parent the parent composite to contain the button bar * @return the button bar control */ @Override protected Control createButtonBar(Composite parent) { Composite composite = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = 0; layout.marginWidth = 0; composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite composite2 = new Composite(composite, SWT.NONE); // create a layout with spacing and margins appropriate for the font size. layout = new GridLayout(); layout.numColumns = 0; // this is incremented by createButton layout.makeColumnsEqualWidth = true; layout.marginWidth = convertHorizontalDLUsToPixels( org.eclipse.jface.dialogs.IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = convertVerticalDLUsToPixels( org.eclipse.jface.dialogs.IDialogConstants.VERTICAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels( org.eclipse.jface.dialogs.IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels( org.eclipse.jface.dialogs.IDialogConstants.VERTICAL_SPACING); composite2.setLayout(layout); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER); composite2.setLayoutData(data); composite2.setFont(parent.getFont()); // Add the buttons to the button bar. super.createButtonsForButtonBar(composite2); return composite; }
From source file:org.eclipse.jst.servlet.ui.internal.wizard.MultiSelectFilteredFileSelectionDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { GridData gd = new GridData(); fChild = new Composite(parent, SWT.NONE); PlatformUI.getWorkbench().getHelpSystem().setHelp(fChild, "com.ibm.etools.webapplicationedit.webx2010"); //$NON-NLS-1$ GridLayout gl = new GridLayout(); gl.numColumns = 2;// w w w . j a v a2 s . com gl.marginHeight = 0; fChild.setLayout(gl); gd.verticalAlignment = GridData.FILL; gd.grabExcessVerticalSpace = true; fChild.setLayoutData(gd); // Create the Web Type radio buttons and text fields. fServletButton = new Button(fChild, SWT.RADIO); fServletButton.setText(WebAppEditResourceHandler.getString("Servlet_UI_")); //$NON-NLS-1$ = Servlet gd = new GridData(); fServletButton.setLayoutData(gd); fServletButton.addSelectionListener(this); fJSPButton = new Button(fChild, SWT.RADIO); fJSPButton.setText(WebAppEditResourceHandler.getString("JSP_UI_")); //$NON-NLS-1$ = JSP gd = new GridData(); fJSPButton.setLayoutData(gd); fJSPButton.addSelectionListener(this); if (fSelection == JSP) fJSPButton.setSelection(true); else { fServletButton.setSelection(true); fSelection = SERVLET; } fPageBook = new PageBook(fChild, SWT.NONE); gd = new GridData(); gd.horizontalAlignment = GridData.FILL; gd.verticalAlignment = GridData.FILL; gd.grabExcessHorizontalSpace = true; gd.grabExcessVerticalSpace = true; gd.horizontalSpan = 2; fPageBook.setLayoutData(gd); fJspControl = super.createDialogArea(fPageBook); Composite composite = new Composite(fPageBook, 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()); Label messageLabel = new Label(composite, SWT.NONE); gd = new GridData(); messageLabel.setLayoutData(gd); messageLabel.setText(WebAppEditResourceHandler.getString("Choose_a_servlet__1")); //$NON-NLS-1$ fText = createText(composite); messageLabel = new Label(composite, SWT.NONE); gd = new GridData(); messageLabel.setLayoutData(gd); messageLabel.setText(WebAppEditResourceHandler.getString("Matching_servlets__2")); //$NON-NLS-1$ fUpperList = createUpperList(composite); messageLabel = new Label(composite, SWT.NONE); gd = new GridData(); messageLabel.setLayoutData(gd); messageLabel.setText(WebAppEditResourceHandler.getString("Qualifier__3")); //$NON-NLS-1$ fLowerList = createLowerList(composite); fServletControl = composite; if (fSelection == JSP) fPageBook.showPage(fJspControl); else fPageBook.showPage(fServletControl); return parent; }
From source file:org.eclipse.jst.servlet.ui.internal.wizard.MultiSelectFilteredFilterFileSelectionDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { GridData gd = new GridData(); fChild = new Composite(parent, SWT.NONE); PlatformUI.getWorkbench().getHelpSystem().setHelp(fChild, "com.ibm.etools.webapplicationedit.webx2010"); //$NON-NLS-1$ GridLayout gl = new GridLayout(); gl.numColumns = 2;/*from w w w . j a v a2s .co m*/ gl.marginHeight = 5; fChild.setLayout(gl); gd.verticalAlignment = GridData.FILL; gd.horizontalAlignment = GridData.FILL; gd.grabExcessVerticalSpace = true; fChild.setLayoutData(gd); fPageBook = new PageBook(fChild, SWT.NONE); gd = new GridData(); gd.horizontalAlignment = GridData.FILL; gd.verticalAlignment = GridData.FILL; gd.grabExcessHorizontalSpace = true; gd.grabExcessVerticalSpace = true; gd.horizontalSpan = 2; fPageBook.setLayoutData(gd); super.createDialogArea(fPageBook); Composite composite = new Composite(fPageBook, 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()); Label messageLabel = new Label(composite, SWT.NONE); gd = new GridData(); messageLabel.setLayoutData(gd); messageLabel.setText(WebAppEditResourceHandler.getString("Choose_a_filter__1")); //$NON-NLS-1$ fText = createText(composite); messageLabel = new Label(composite, SWT.NONE); gd = new GridData(); messageLabel.setLayoutData(gd); messageLabel.setText(WebAppEditResourceHandler.getString("Matching_filters__2")); //$NON-NLS-1$ fUpperList = createUpperList(composite); messageLabel = new Label(composite, SWT.NONE); gd = new GridData(); messageLabel.setLayoutData(gd); messageLabel.setText(WebAppEditResourceHandler.getString("Qualifier__3")); //$NON-NLS-1$ fLowerList = createLowerList(composite); fServletControl = composite; fPageBook.showPage(fServletControl); return parent; }
From source file:org.eclipse.jst.servlet.ui.internal.wizard.MultiSelectFilteredListenerFileSelectionDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { GridData gd = new GridData(); fChild = new Composite(parent, SWT.NONE); PlatformUI.getWorkbench().getHelpSystem().setHelp(fChild, "com.ibm.etools.webapplicationedit.webx2010"); //$NON-NLS-1$ GridLayout gl = new GridLayout(); gl.numColumns = 2;/*from w ww .j a v a 2 s.c o m*/ gl.marginHeight = 5; fChild.setLayout(gl); gd.verticalAlignment = GridData.FILL; gd.horizontalAlignment = GridData.FILL; gd.grabExcessVerticalSpace = true; fChild.setLayoutData(gd); fPageBook = new PageBook(fChild, SWT.NONE); gd = new GridData(); gd.horizontalAlignment = GridData.FILL; gd.verticalAlignment = GridData.FILL; gd.grabExcessHorizontalSpace = true; gd.grabExcessVerticalSpace = true; gd.horizontalSpan = 2; fPageBook.setLayoutData(gd); super.createDialogArea(fPageBook); Composite composite = new Composite(fPageBook, 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()); Label messageLabel = new Label(composite, SWT.NONE); gd = new GridData(); messageLabel.setLayoutData(gd); messageLabel.setText(WebAppEditResourceHandler.getString("Choose_a_listener__1")); //$NON-NLS-1$ fText = createText(composite); messageLabel = new Label(composite, SWT.NONE); gd = new GridData(); messageLabel.setLayoutData(gd); messageLabel.setText(WebAppEditResourceHandler.getString("Matching_listener__2")); //$NON-NLS-1$ fUpperList = createUpperList(composite); messageLabel = new Label(composite, SWT.NONE); gd = new GridData(); messageLabel.setLayoutData(gd); messageLabel.setText(WebAppEditResourceHandler.getString("Qualifier__3")); //$NON-NLS-1$ fLowerList = createLowerList(composite); fServletControl = composite; fPageBook.showPage(fServletControl); return parent; }
From source file:org.eclipse.launchbar.ui.internal.dialogs.LaunchConfigurationEditDialog.java
License:Open Source License
@Override protected Control createButtonBar(Composite parent) { // Clone super's implementation, removes the monitor since we don't run from here // And adds in the left button bar. Font font = parent.getFont(); Composite composite = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 2;//from w ww. j a v a 2 s . co m 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); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); composite.setFont(font); // create help control if needed if (isHelpAvailable()) { createHelpControl(composite); } Composite leftButtonComp = new Composite(composite, SWT.NULL); layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.numColumns = 0; leftButtonComp.setLayout(layout); leftButtonComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); leftButtonComp.setFont(parent.getFont()); createButton(leftButtonComp, DELETE_ID, Messages.LaunchConfigurationEditDialog_0, false); createButton(leftButtonComp, DUPLICATE_ID, Messages.LaunchConfigurationEditDialog_1, false); // launch button text same as in eclipse LaunchConfigurationDialog - mode name createButton(leftButtonComp, LAUNCH_ID, getLaunchButtonText(), false); Composite mainButtonComp = new Composite(composite, SWT.NONE); layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.numColumns = 0; mainButtonComp.setLayout(layout); mainButtonComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); mainButtonComp.setFont(parent.getFont()); createButton(mainButtonComp, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(mainButtonComp, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); return composite; }
From source file:org.eclipse.libra.framework.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 w w. j av 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); composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setFont(parent.getFont()); PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, ContextIds.FRAMEWORK_INSTANCE_CLEAN_WORK_DIR_TERMINATE); Label label = new Label(composite, SWT.WRAP); label.setText(message); GridData data = new GridData(); data.widthHint = 400; label.setLayoutData(data); Dialog.applyDialogFont(composite); return composite; }
From source file:org.eclipse.linuxtools.tmf.ui.widgets.timegraph.dialogs.TimeGraphFilterDialog.java
License:Open Source License
/** * Adds the selection and deselection buttons to the dialog. * * @param composite/*from www .j av a 2 s.c o m*/ * the parent composite * @return Composite the composite the buttons were created in. */ protected Composite createSelectionButtons(Composite composite) { Composite buttonComposite = new Composite(composite, SWT.RIGHT); GridLayout layout = new GridLayout(); layout.marginWidth = 0; layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); buttonComposite.setLayout(layout); buttonComposite.setFont(composite.getFont()); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL); data.grabExcessHorizontalSpace = true; buttonComposite.setLayoutData(data); /* Create the buttons in the good order to place them as we want */ Button checkSelectedButton = createButton(buttonComposite, BUTTON_CHECK_SELECTED_ID, Messages.TmfTimeFilterDialog_CHECK_SELECTED, false); Button checkSubtreeButton = createButton(buttonComposite, BUTTON_CHECK_SUBTREE_ID, Messages.TmfTimeFilterDialog_CHECK_SUBTREE, false); Button checkAllButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, Messages.TmfTimeFilterDialog_CHECK_ALL, false); Button uncheckSelectedButton = createButton(buttonComposite, BUTTON_UNCHECK_SELECTED_ID, Messages.TmfTimeFilterDialog_UNCHECK_SELECTED, false); Button uncheckSubtreeButton = createButton(buttonComposite, BUTTON_UNCHECK_SUBTREE_ID, Messages.TmfTimeFilterDialog_UNCHECK_SUBTREE, false); Button uncheckAllButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, Messages.TmfTimeFilterDialog_UNCHECK_ALL, false); /* * Apply the layout again after creating the buttons to override * createButton messing with the columns */ layout.numColumns = 3; buttonComposite.setLayout(layout); /* Add a listener to each button */ checkSelectedButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { TreeSelection selection = (TreeSelection) fViewer.getSelection(); for (Object element : selection.toArray()) { checkElement(element); } updateOKStatus(); } }); checkSubtreeButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { TreeSelection selection = (TreeSelection) fViewer.getSelection(); for (Object element : selection.toArray()) { checkElementAndSubtree(element); } } }); checkAllButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Object[] viewerElements = fContentProvider.getElements(fInput); for (int i = 0; i < viewerElements.length; i++) { fViewer.setSubtreeChecked(viewerElements[i], true); } updateOKStatus(); } }); uncheckSelectedButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { TreeSelection selection = (TreeSelection) fViewer.getSelection(); for (Object element : selection.toArray()) { uncheckElement(element); } updateOKStatus(); } }); uncheckSubtreeButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { TreeSelection selection = (TreeSelection) fViewer.getSelection(); for (Object element : selection.toArray()) { uncheckElement(element); } updateOKStatus(); } }); uncheckAllButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { fViewer.setCheckedElements(new Object[0]); updateOKStatus(); } }); return buttonComposite; }