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:org.eclipse.ui.internal.editors.text.SelectResourcesDialog.java

License:Open Source License

protected final void createSelectionButtonGroup(Composite parent) {

    Font font = parent.getFont();

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

    GridLayout layout = new GridLayout();
    layout.numColumns = 3;// w w w . j a v  a  2s. co m
    layout.makeColumnsEqualWidth = true;
    buttonComposite.setLayout(layout);
    buttonComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));

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

    SelectionListener listener = new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            fResourceGroup.setAllSelections(true);
            updateSelectionCount();
        }
    };
    selectButton.addSelectionListener(listener);
    selectButton.setFont(font);
    setButtonLayoutData(selectButton);

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

    listener = new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            fResourceGroup.setAllSelections(false);
            updateSelectionCount();
        }
    };
    deselectButton.addSelectionListener(listener);
    deselectButton.setFont(font);
    setButtonLayoutData(deselectButton);

    // types edit button
    Button selectTypesButton = createButton(buttonComposite, IDialogConstants.SELECT_TYPES_ID,
            TextEditorMessages.SelectResourcesDialog_filterSelection, false);

    listener = new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            handleSelectFileTypes();
        }
    };
    selectTypesButton.addSelectionListener(listener);
    selectTypesButton.setFont(font);
    setButtonLayoutData(selectTypesButton);
}

From source file:org.eclipse.ui.internal.wizards.preferences.WizardPreferencesPage.java

License:Open Source License

/**
 * Add the selection and deselection buttons to the composite.
 * //from  ww  w  . j  a  va  2 s  .  com
 * @param composite
 *            org.eclipse.swt.widgets.Composite
 */
private void addSelectionButtons(Composite composite) {
    Font parentFont = composite.getFont();
    buttonComposite = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    buttonComposite.setLayout(layout);
    GridData data = new GridData(GridData.GRAB_HORIZONTAL);
    data.grabExcessHorizontalSpace = true;
    buttonComposite.setLayoutData(data);
    buttonComposite.setFont(parentFont);

    selectAllButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID,
            PreferencesMessages.SelectionDialog_selectLabel, false);

    SelectionListener listener = new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            viewer.setAllChecked(true);
            updatePageCompletion();
        }
    };
    selectAllButton.addSelectionListener(listener);
    selectAllButton.setFont(parentFont);

    deselectAllButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID,
            PreferencesMessages.SelectionDialog_deselectLabel, false);

    listener = new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            viewer.setAllChecked(false);
            updatePageCompletion();
        }
    };
    deselectAllButton.addSelectionListener(listener);
    deselectAllButton.setFont(parentFont);
}

From source file:org.eclipse.wst.sse.ui.internal.filter.OutlineCustomFiltersDialog.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 ww  .j a v a2s .  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 = OutlineFilterMessages.CustomFiltersDialog_SelectAllButton_label;
    Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, label, false);
    SWTUtil.setButtonDimensionHint(selectButton);
    SelectionListener listener = new SelectionAdapter() {
        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 = OutlineFilterMessages.CustomFiltersDialog_DeselectAllButton_label;
    Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, label, false);
    SWTUtil.setButtonDimensionHint(deselectButton);
    listener = new SelectionAdapter() {
        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:org.hibernate.eclipse.mapper.editors.reveng.TablePropertiesBlock.java

License:Open Source License

private CheckedTreeSelectionDialog createTreeSelectionDialog() {
    return new CheckedTreeSelectionDialog(getComposite().getShell(), new AnyAdaptableLabelProvider(),
            new DeferredContentProvider()) {

        protected Composite createSelectionButtons(Composite composite) {
            Composite buttonComposite = new Composite(composite, SWT.RIGHT);
            GridLayout layout = new GridLayout();
            layout.numColumns = 2;/* ww  w.  java2 s.c  o  m*/
            buttonComposite.setLayout(layout);
            buttonComposite.setFont(composite.getFont());
            GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL);
            data.grabExcessHorizontalSpace = true;
            composite.setData(data);
            Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID,
                    MapperMessages.TablePropertiesBlock_select_all_children, false);
            SelectionListener listener = new SelectionAdapter() {
                public void widgetSelected(SelectionEvent e) {
                    IStructuredSelection viewerElements = (IStructuredSelection) getTreeViewer().getSelection();
                    Iterator<?> iterator = viewerElements.iterator();
                    while (iterator.hasNext()) {
                        getTreeViewer().setSubtreeChecked(iterator.next(), true);
                    }
                    updateOKStatus();
                }
            };
            selectButton.addSelectionListener(listener);
            Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID,
                    MapperMessages.TablePropertiesBlock_deselect_all, false);
            listener = new SelectionAdapter() {
                public void widgetSelected(SelectionEvent e) {
                    getTreeViewer().setCheckedElements(new Object[0]);
                    updateOKStatus();
                }
            };
            deselectButton.addSelectionListener(listener);
            return buttonComposite;
        }

        protected boolean evaluateIfTreeEmpty(Object input) {
            return false;
        }

    };
}

From source file:org.jboss.tools.arquillian.ui.internal.dialogs.AddArquillianProfilesDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.SELECT_ALL_ID, "Select All", false);
    createButton(parent, IDialogConstants.DESELECT_ALL_ID, "Deselect All", false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    validate();//from   www. jav a  2s.c  o m
}

From source file:org.jboss.tools.arquillian.ui.internal.dialogs.AddArquillianProfilesDialog.java

License:Open Source License

protected void validate() {
    Object[] checkedElements = viewer.getCheckedElements();
    getButton(IDialogConstants.OK_ID).setEnabled(checkedElements.length != 0);
    getButton(IDialogConstants.SELECT_ALL_ID).setEnabled(checkedElements.length < containers.size());
    getButton(IDialogConstants.DESELECT_ALL_ID).setEnabled(checkedElements.length > 0);
}

From source file:org.jboss.tools.arquillian.ui.internal.dialogs.AddArquillianProfilesDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    super.buttonPressed(buttonId);
    if (IDialogConstants.SELECT_ALL_ID == buttonId) {
        selectAllPressed();//from   w ww  .jav  a 2  s .c o m
    } else if (IDialogConstants.DESELECT_ALL_ID == buttonId) {
        deselectAllPressed();
    }
    if (!viewer.getTable().isDisposed()) {
        validate();
    }
}

From source file:org.jboss.tools.runtime.ui.dialogs.SearchRuntimePathDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // OK button/*from  ww w. j  av  a2s .c o m*/
    Button okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    okButton.setEnabled(false);
    createButton(parent, IDialogConstants.SELECT_ALL_ID, "Select All");
    createButton(parent, IDialogConstants.DESELECT_ALL_ID, "Deselect All");
    // cancel button
    createCancelButton(parent);
}

From source file:org.jboss.tools.runtime.ui.dialogs.SearchRuntimePathDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    super.buttonPressed(buttonId);
    if (IDialogConstants.SELECT_ALL_ID == buttonId) {
        selectAllPressed();/*from ww w . j  a v a  2 s .c  o m*/
    } else if (IDialogConstants.DESELECT_ALL_ID == buttonId) {
        deselectAllPressed();
    }
}

From source file:org.jboss.tools.runtime.ui.dialogs.SearchRuntimePathDialog.java

License:Open Source License

@Override
protected void finishedRun() {
    if (getShell() == null || getShell().isDisposed()) {
        return;/*w  ww.java2s  .co m*/
    }
    decrementNestingDepth();
    getShell().setCursor(null);
    int count = getRuntimeDefinitions(true).size();
    if (count == 0) {
        hideCreatedRuntimes.setSelection(false);
    }
    if (canceled) {
        refresh("Searching runtimes is canceled.");
    } else {
        refresh("Searching runtimes is finished.");
        RuntimeModelUtil.updateTimestamps(runtimePaths.toArray(new RuntimePath[runtimePaths.size()]));
    }

    String foundRuntimes;
    if (count == 0) {
        foundRuntimes = "No runtime found.";
        getButton(IDialogConstants.OK_ID).setEnabled(false);
    } else {
        if (count == 1) {
            foundRuntimes = count + " new runtime found. Press OK to create the runtimes with a checkmark.";
        } else {
            foundRuntimes = count + " new runtimes found. Press OK to create the runtimes with a checkmark.";
        }
        getButton(IDialogConstants.OK_ID).setEnabled(true);
        getButton(IDialogConstants.SELECT_ALL_ID).setEnabled(true);
        getButton(IDialogConstants.DESELECT_ALL_ID).setEnabled(true);
    }
    foundRuntimesLabel.setText(foundRuntimes);
}