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

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

Introduction

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

Prototype

int DESELECT_ALL_ID

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

Click Source Link

Document

Button id for a "Deselect All" button (value 19).

Usage

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;/*from  ww  w .j  a v  a 2s  .  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  .ja v  a  2s .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();// www .  jav a2  s.co 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  w w.  j  ava 2 s  . co 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// w w w  .j ava 2s .  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 w  w w  .j  a v a2  s  . co 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 w w . java 2s .com*/
    }
    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);
}

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

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // OK button/*from w ww.ja va2 s  .  c  o m*/
    Button okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
    okButton.setEnabled(false);
    createButton(parent, IDialogConstants.SELECT_ALL_ID, Messages.SearchRuntimePathDialog_Select_All);
    createButton(parent, IDialogConstants.DESELECT_ALL_ID, Messages.SearchRuntimePathDialog_Deselect_All);
    // cancel button
    createCancelButton(parent);
}

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

License:Open Source License

@Override
protected void finishedRun() {
    if (getShell() == null || getShell().isDisposed()) {
        return;// w  ww.j  ava 2 s .  c  o m
    }
    decrementNestingDepth();
    getShell().setCursor(null);
    int count = getRuntimeDefinitions(true).size();
    if (count == 0) {
        hideCreatedRuntimes.setSelection(false);
    }
    if (canceled) {
        refresh(Messages.SearchRuntimePathDialog_Searching_runtimes_is_canceled);
    } else {
        refresh(Messages.SearchRuntimePathDialog_Searching_runtimes_is_finished);
        RuntimeModelUtil.updateTimestamps(runtimePaths.toArray(new RuntimePath[runtimePaths.size()]));
    }

    String foundRuntimes;
    if (count == 0) {
        foundRuntimes = Messages.SearchRuntimePathDialog_No_runtime_found;
        getButton(IDialogConstants.OK_ID).setEnabled(false);
    } else {
        if (count == 1) {
            foundRuntimes = NLS.bind(Messages.SearchRuntimePathDialog_New_runtime_found, count);
        } else {
            foundRuntimes = NLS.bind(Messages.SearchRuntimePathDialog_New_runtimes_found, count);
        }
        getButton(IDialogConstants.OK_ID).setEnabled(true);
        getButton(IDialogConstants.SELECT_ALL_ID).setEnabled(true);
        getButton(IDialogConstants.DESELECT_ALL_ID).setEnabled(true);
    }
    foundRuntimesLabel.setText(foundRuntimes);
}