Example usage for org.eclipse.jface.dialogs IDialogConstants SELECT_ALL_ID

List of usage examples for org.eclipse.jface.dialogs IDialogConstants SELECT_ALL_ID

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants SELECT_ALL_ID.

Prototype

int SELECT_ALL_ID

To view the source code for org.eclipse.jface.dialogs IDialogConstants SELECT_ALL_ID.

Click Source Link

Document

Button id for a "Select All" button (value 18).

Usage

From source file:com.nokia.carbide.search.system.internal.ui.SearchDialog.java

License:Open Source License

private void handleCustomizePressed() {
    List input = SearchPlugin.getDefault().getSearchPageDescriptors();
    input = filterByActivities(input);/*from w  w  w .j av a2  s  .  c  om*/

    final ArrayList createdImages = new ArrayList(input.size());
    ILabelProvider labelProvider = new LabelProvider() {
        public String getText(Object element) {
            if (element instanceof SearchPageDescriptor)
                return LegacyActionTools.removeMnemonics(((SearchPageDescriptor) element).getLabel());
            return null;
        }

        public Image getImage(Object element) {
            if (element instanceof SearchPageDescriptor) {
                ImageDescriptor imageDesc = ((SearchPageDescriptor) element).getImage();
                if (imageDesc == null)
                    return null;
                Image image = imageDesc.createImage();
                if (image != null)
                    createdImages.add(image);
                return image;
            }
            return null;
        }
    };

    String message = SearchMessages.SearchPageSelectionDialog_message;

    ListSelectionDialog dialog = new ListSelectionDialog(getShell(), input, new ArrayContentProvider(),
            labelProvider, message) {
        public void create() {
            super.create();
            final CheckboxTableViewer viewer = getViewer();
            final Button okButton = this.getOkButton();
            viewer.addCheckStateListener(new ICheckStateListener() {
                public void checkStateChanged(CheckStateChangedEvent event) {
                    okButton.setEnabled(viewer.getCheckedElements().length > 0);
                }
            });
            SelectionListener listener = new SelectionAdapter() {
                public void widgetSelected(SelectionEvent e) {
                    okButton.setEnabled(viewer.getCheckedElements().length > 0);
                }
            };
            this.getButton(IDialogConstants.SELECT_ALL_ID).addSelectionListener(listener);
            this.getButton(IDialogConstants.DESELECT_ALL_ID).addSelectionListener(listener);
        }
    };
    dialog.setTitle(SearchMessages.SearchPageSelectionDialog_title);
    dialog.setInitialSelections(
            SearchPlugin.getDefault().getEnabledSearchPageDescriptors(fInitialPageId).toArray());
    if (dialog.open() == Window.OK) {
        SearchPageDescriptor.setEnabled(dialog.getResult());
        Display display = getShell().getDisplay();
        close();
        if (display != null && !display.isDisposed()) {
            display.asyncExec(new Runnable() {
                public void run() {
                    new OpenSearchDialogAction().run();
                }
            });
        }
    }
    destroyImages(createdImages);
}

From source file:eu.geclipse.jsdl.ui.widgets.SweepDeleteDialog.java

License:Open Source License

@Override
protected void buttonPressed(final int buttonId) {
    if (buttonId == IDialogConstants.SELECT_ALL_ID) {
        this.outputReturn = this.input;
        okPressed();/*from  ww w .j a  va 2s .  co m*/
    } else if (buttonId == IDialogConstants.PROCEED_ID) {
        this.outputReturn = getSelection();
        okPressed();
    } else if (buttonId == IDialogConstants.CANCEL_ID) {
        cancelPressed();
    }
}

From source file:eu.geclipse.jsdl.ui.widgets.SweepDeleteDialog.java

License:Open Source License

@Override
protected Control createButtonBar(final Composite parent) {
    Composite buttonsComp = new Composite(parent, SWT.NONE);
    buttonsComp.setLayout(new GridLayout(0, true));
    GridData gData = new GridData(GridData.FILL_BOTH);
    gData.verticalIndent = 10;/*from ww w.j a  va 2  s . co m*/
    gData.horizontalAlignment = SWT.END;
    buttonsComp.setLayoutData(gData);
    createButton(buttonsComp, IDialogConstants.SELECT_ALL_ID,
            Messages.getString("SweepDeleteDialog.delete_all_button"), //$NON-NLS-1$
            true);
    createButton(buttonsComp, IDialogConstants.PROCEED_ID,
            Messages.getString("SweepDeleteDialog.delete_all_selected"), //$NON-NLS-1$
            false);
    createButton(buttonsComp, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    return buttonsComp;
}

From source file:ext.org.eclipse.jdt.internal.ui.filters.CustomFiltersDialog.java

License:Open Source License

private void addSelectionButtons(Composite composite) {
    Composite buttonComposite = new Composite(composite, SWT.RIGHT);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;/*  w w w.  j a  v a  2 s  .  c o  m*/
    buttonComposite.setLayout(layout);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL);
    data.grabExcessHorizontalSpace = true;
    composite.setData(data);

    // Select All button
    String label = FilterMessages.CustomFiltersDialog_SelectAllButton_label;
    Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, label, false);
    SWTUtil.setButtonDimensionHint(selectButton);
    SelectionListener listener = new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            fCheckBoxList.setAllChecked(true);
            fFilterDescriptorChangeHistory.clear();
            for (int i = 0; i < fBuiltInFilters.length; i++)
                fFilterDescriptorChangeHistory.push(fBuiltInFilters[i]);
        }
    };
    selectButton.addSelectionListener(listener);

    // De-select All button
    label = FilterMessages.CustomFiltersDialog_DeselectAllButton_label;
    Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, label, false);
    SWTUtil.setButtonDimensionHint(deselectButton);
    listener = new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            fCheckBoxList.setAllChecked(false);
            fFilterDescriptorChangeHistory.clear();
            for (int i = 0; i < fBuiltInFilters.length; i++)
                fFilterDescriptorChangeHistory.push(fBuiltInFilters[i]);
        }
    };
    deselectButton.addSelectionListener(listener);
}

From source file:fr.inria.linuxtools.tmf.ui.widgets.timegraph.dialogs.TimeGraphFilterDialog.java

License:Open Source License

/**
 * Adds the selection and deselection buttons to the dialog.
 *
 * @param composite/*w  w w. ja v  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) fTree.getViewer().getSelection();

            for (Object element : selection.toArray()) {
                checkElement(element);
            }

            updateOKStatus();
        }
    });

    checkSubtreeButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            TreeSelection selection = (TreeSelection) fTree.getViewer().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++) {
                fTree.setSubtreeChecked(viewerElements[i], true);
            }

            updateOKStatus();
        }
    });

    uncheckSelectedButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            TreeSelection selection = (TreeSelection) fTree.getViewer().getSelection();

            for (Object element : selection.toArray()) {
                uncheckElement(element);
            }

            updateOKStatus();
        }
    });

    uncheckSubtreeButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            TreeSelection selection = (TreeSelection) fTree.getViewer().getSelection();

            for (Object element : selection.toArray()) {
                uncheckElement(element);
            }

            updateOKStatus();
        }
    });

    uncheckAllButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            Object[] viewerElements = fContentProvider.getElements(fInput);
            for (Object element : viewerElements) {
                if (fTree.getViewer().testFindItem(element) != null) {
                    // uncheck only visible roots and their children
                    uncheckElement(element);
                }
            }
            updateOKStatus();
        }
    });

    return buttonComposite;
}

From source file:net.rim.ejde.internal.ui.dialogs.CleanSimulatorDialog.java

License:Open Source License

protected void createSelectionButtons(Composite parent) {
    Composite composite = new Composite(parent, SWT.RIGHT);

    GridLayout layout = new GridLayout();
    layout.numColumns = 0;/*from w  w w. j a  va  2 s .  co m*/
    layout.marginWidth = 0;
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);

    GridData gridData = new GridData(SWT.RIGHT, SWT.FILL, true, false);
    composite.setLayoutData(gridData);

    Button selectAllButton = createButton(composite, IDialogConstants.SELECT_ALL_ID,
            Messages.CLEAN_SIMULATOR_DIALOG_SELECT_ALL_BUTTON, false);
    selectAllButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            Object[] items = _contentProvider.getElements(_input);
            selectAll(items, true);
        }
    });

    Button deselectAllButton = createButton(composite, IDialogConstants.DESELECT_ALL_ID,
            Messages.CLEAN_SIMULATOR_DIALOG_DESELECT_ALL_BUTTON, false);
    deselectAllButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            Object[] items = _contentProvider.getElements(_input);
            selectAll(items, false);
        }
    });
}

From source file:org.eclipse.bpmn2.modeler.core.di.MissingDIElementsDialog.java

License:Open Source License

@Override
protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
    Button button = super.createButton(parent, id, label, defaultButton);
    if (id == IDialogConstants.DESELECT_ALL_ID || id == IDialogConstants.SELECT_ALL_ID) {
        final boolean checked = (id == IDialogConstants.SELECT_ALL_ID);
        SelectionListener listener = new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                missing.setChecked(checked);
            }/* www.j a va 2 s .c om*/
        };
        button.addSelectionListener(listener);
    }
    return button;
}

From source file:org.eclipse.buckminster.jnlp.p2.ui.certificates.ListSelectionDialog.java

License:Open Source License

/**
 * Add the selection and deselection buttons to the dialog.
 * //from w  w w .  j  a v  a 2s .co m
 * @param composite
 *            org.eclipse.swt.widgets.Composite
 */
private void addSelectionButtons(Composite composite) {
    Composite buttonComposite = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    buttonComposite.setLayout(layout);
    buttonComposite.setLayoutData(new GridData(SWT.END, SWT.TOP, true, false));

    Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, SELECT_ALL_TITLE,
            false);

    SelectionListener listener = new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            listViewer.setAllChecked(true);
        }
    };
    selectButton.addSelectionListener(listener);

    Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, DESELECT_ALL_TITLE,
            false);

    listener = new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            listViewer.setAllChecked(false);
        }
    };
    deselectButton.addSelectionListener(listener);
}

From source file:org.eclipse.cdt.internal.ui.filters.CustomFiltersDialog.java

License:Open Source License

private void addSelectionButtons(Composite composite) {
    Composite buttonComposite = new Composite(composite, SWT.RIGHT);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;/*from w ww  . j  a  va 2 s .  co m*/
    buttonComposite.setLayout(layout);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL);
    data.grabExcessHorizontalSpace = true;
    composite.setData(data);

    // Select All button
    String label = FilterMessages.CustomFiltersDialog_SelectAllButton_label;
    Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, label, false);
    SWTUtil.setButtonDimensionHint(selectButton);
    SelectionListener listener = new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            fCheckBoxList.setAllChecked(true);
            fFilterDescriptorChangeHistory.clear();
            for (FilterDescriptor builtInFilter : fBuiltInFilters) {
                fFilterDescriptorChangeHistory.push(builtInFilter);
            }
        }
    };
    selectButton.addSelectionListener(listener);

    // Deselect All button
    label = FilterMessages.CustomFiltersDialog_DeselectAllButton_label;
    Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, label, false);
    SWTUtil.setButtonDimensionHint(deselectButton);
    listener = new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            fCheckBoxList.setAllChecked(false);
            fFilterDescriptorChangeHistory.clear();
            for (FilterDescriptor builtInFilter : fBuiltInFilters)
                fFilterDescriptorChangeHistory.push(builtInFilter);
        }
    };
    deselectButton.addSelectionListener(listener);
}

From source file:org.eclipse.cdt.internal.ui.wizards.indexwizards.TeamProjectIndexExportWizardPage.java

License:Open Source License

/**
  * Creates the checkbox tree and list for selecting resources.
  */*from  w ww .  ja va2 s .  c  o  m*/
  * @param parent the parent control
  */
private final void createResourcesGroup(Composite parent) {
    Composite resourcesGroup = new Composite(parent, SWT.NONE);
    resourcesGroup.setLayout(new GridLayout());
    resourcesGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
    resourcesGroup.setFont(parent.getFont());

    new Label(resourcesGroup, SWT.NONE).setText(Messages.TeamProjectIndexExportWizardPage_labelProjectTable);
    Table table = new Table(resourcesGroup, SWT.CHECK | SWT.BORDER);
    table.setLayoutData(new GridData(GridData.FILL_BOTH));
    fProjectViewer = new CheckboxTableViewer(table);
    fProjectViewer.setContentProvider(new ListContentProvider());
    fProjectViewer.setLabelProvider(new CElementLabelProvider());
    ICheckStateListener checkListener = new ICheckStateListener() {
        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            updateWidgetEnablements();
        }
    };
    fProjectViewer.addCheckStateListener(checkListener);

    // top level group
    Composite buttonComposite = new Composite(resourcesGroup, SWT.NONE);
    buttonComposite.setFont(parent.getFont());

    GridLayout layout = new GridLayout(2, true);
    layout.marginHeight = layout.marginWidth = 0;
    buttonComposite.setLayout(layout);
    buttonComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));

    Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID,
            Messages.TeamProjectIndexExportWizardPage_selectAll, false);

    SelectionAdapter listener = new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            fProjectViewer.setAllChecked(true);
            updateWidgetEnablements();
        }
    };
    selectButton.addSelectionListener(listener);

    Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID,
            Messages.TeamProjectIndexExportWizardPage_deselectAll, false);

    listener = new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            fProjectViewer.setAllChecked(false);
            updateWidgetEnablements();
        }
    };
    deselectButton.addSelectionListener(listener);

    initProjects();
}