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.datatools.sqltools.internal.sqlscrapbook.connection.FilesConnectionInfoDialog.java

License:Open Source License

/**
 * Add the selection and deselection buttons to the dialog.
 * @param composite org.eclipse.swt.widgets.Composite
 *///from   w w w  . j a v a  2 s  .c o  m
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,
            Messages.SELECT_ALL_TITLE, false);

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

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

    listener = new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            fTableViewer.setAllChecked(false);
            checkOK();
        }
    };
    deselectButton.addSelectionListener(listener);

    _upButton = createButton(buttonComposite, IDialogConstants.CLIENT_ID, Messages.UP_TITLE, false);
    _downButton = createButton(buttonComposite, IDialogConstants.CLIENT_ID, Messages.DOWN_TITLE, false);
    _upButton.setEnabled(false);
    _downButton.setEnabled(false);
    listener = new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            moveButtonAction(true);
            checkOK();
            checkUpDownStatus();
        }
    };
    _upButton.addSelectionListener(listener);
    listener = new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            moveButtonAction(false);
            checkOK();
            checkUpDownStatus();
        }
    };
    _downButton.addSelectionListener(listener);

    fTableViewer.getTable().addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            checkUpDownStatus();
        }
    });
}

From source file:org.eclipse.dltk.internal.testing.util.CheckedTableSelectionDialog.java

License:Open Source License

/**
 * Add the selection and deselection buttons to the dialog.
 * @param composite org.eclipse.swt.widgets.Composite
 *//*from w ww.  j av  a2  s .c  o m*/
private Composite createSelectionButtons(Composite composite) {
    Composite buttonComposite = new Composite(composite, SWT.RIGHT);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    buttonComposite.setLayout(layout);
    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,
            WizardMessages.CheckedTableSelectionDialog_selectAll, false);

    SelectionListener listener = new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            fViewer.setCheckedElements(fContentProvider.getElements(fInput));
            updateOKStatus();
        }
    };
    selectButton.addSelectionListener(listener);

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

    listener = new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            fViewer.setCheckedElements(new Object[0]);
            updateOKStatus();
        }
    };
    deselectButton.addSelectionListener(listener);
    return buttonComposite;
}

From source file:org.eclipse.dltk.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   www . j a  v a2 s .  c om
    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() {
        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() {
        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.eclipse.e4.ui.dialogs.ListSelectionDialog.java

License:Open Source License

/**
 * Add the selection and deselection buttons to the dialog.
 * @param composite org.eclipse.swt.widgets.Composite
 *///from   w w w  . ja va 2s.com
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() {
        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() {
        public void widgetSelected(SelectionEvent e) {
            listViewer.setAllChecked(false);
        }
    };
    deselectButton.addSelectionListener(listener);
}

From source file:org.eclipse.eavp.viz.service.widgets.TreeSelectionDialogProvider.java

License:Open Source License

/**
 * Creates a dialog used to select <i>multiple</i> values from the input
 * tree.// www  .  j  a v a  2s . co m
 * 
 * @param shell
 *            The parent shell for the dialog.
 * @param labelProvider
 *            The label provider for the tree.
 * @param contentProvider
 *            The content provider for the tree.
 * @return The new dialog.
 */
private CheckedTreeSelectionDialog createCheckedTreeSelectionDialog(Shell shell, ILabelProvider labelProvider,
        ITreeContentProvider contentProvider) {

    // Create a custom check-state listener to update the selected elements
    // on the fly.
    final ICheckStateListener checkStateListener = createCheckStateListener();

    CheckedTreeSelectionDialog treeDialog = new CheckedTreeSelectionDialog(shell, labelProvider,
            contentProvider) {
        /*
         * (non-Javadoc)
         * @see org.eclipse.ui.dialogs.CheckedTreeSelectionDialog#createSelectionButtons(org.eclipse.swt.widgets.Composite)
         */
        @Override
        protected Composite createSelectionButtons(Composite composite) {
            Composite buttonComposite = super.createSelectionButtons(composite);

            // Add listeners to the select-all and deselect-all buttons
            // because they do not trigger the check-state listener.
            getButton(IDialogConstants.SELECT_ALL_ID).addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e) {
                    newSelection.clear();
                    checkNode(root, true);
                }
            });
            getButton(IDialogConstants.DESELECT_ALL_ID).addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e) {
                    newSelection.clear();
                }
            });

            return buttonComposite;
        }

        /*
         * (non-Javadoc)
         * @see org.eclipse.ui.dialogs.CheckedTreeSelectionDialog#createTreeViewer(org.eclipse.swt.widgets.Composite)
         */
        @Override
        protected CheckboxTreeViewer createTreeViewer(Composite parent) {
            // Create the default TreeViewer.
            CheckboxTreeViewer viewer = super.createTreeViewer(parent);

            // Add the check state provider and listener.
            viewer.addCheckStateListener(checkStateListener);

            return viewer;
        }
    };

    // Set this flag so the "grayed" state of parent nodes is handled
    // properly.
    treeDialog.setContainerMode(true);

    return treeDialog;
}

From source file:org.eclipse.eclemma.internal.ui.dialogs.MergeSessionsDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Control c = super.createDialogArea(parent);
    getViewer().addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent event) {
            updateButtonsEnableState();// w ww. j a va  2  s .  c  o m
        }
    });
    Button b1 = getButton(IDialogConstants.SELECT_ALL_ID);
    b1.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            updateButtonsEnableState();
        }
    });
    Button b2 = getButton(IDialogConstants.DESELECT_ALL_ID);
    b2.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            updateButtonsEnableState();
        }
    });
    return c;
}

From source file:org.eclipse.edt.ide.ui.internal.eglarpackager.EglarPackageWizardPage.java

License:Open Source License

/**
* Creates the buttons for selecting specific types or selecting all or none of the
* elements.//from  ww w .j a v  a2s .  c  o  m
*
* @param parent the parent control
*/
protected final void createSelectionButtonsGroup(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;
    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, SELECT_ALL_TITLE,
            false);

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

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

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

}

From source file:org.eclipse.egit.ui.internal.dialogs.CommitDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.SELECT_ALL_ID, UIText.CommitDialog_SelectAll, false);
    createButton(parent, IDialogConstants.DESELECT_ALL_ID, UIText.CommitDialog_DeselectAll, false);

    createButton(parent, IDialogConstants.OK_ID, UIText.CommitDialog_Commit, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:org.eclipse.egit.ui.internal.dialogs.CommitDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    if (IDialogConstants.SELECT_ALL_ID == buttonId) {
        filesViewer.setAllChecked(true);
    }//w ww  .  j  a  va 2  s.  com
    if (IDialogConstants.DESELECT_ALL_ID == buttonId) {
        filesViewer.setAllChecked(false);
    }
    super.buttonPressed(buttonId);
}

From source file:org.eclipse.ffs.internal.ui.add.WizardFileSystemResourceImportPage1.java

License:Open Source License

/**
 * Creates the buttons for selecting specific types or selecting all or none of the
 * elements.//from w w  w .  j  av a  2  s.c om
 *
 * @param parent the parent control
 */
protected final void createButtonsGroup(Composite parent) {
    // top level group
    Composite buttonComposite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    layout.makeColumnsEqualWidth = true;
    buttonComposite.setLayout(layout);
    buttonComposite.setFont(parent.getFont());
    GridData buttonData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    buttonData.horizontalSpan = 2;
    buttonComposite.setLayoutData(buttonData);

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

    SelectionListener listener = new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            handleTypesEditButtonPressed();
        }
    };
    selectTypesButton.addSelectionListener(listener);
    setButtonLayoutData(selectTypesButton);

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

    listener = new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            setAllSelections(true);
            updateWidgetEnablements();
        }
    };
    selectAllButton.addSelectionListener(listener);
    setButtonLayoutData(selectAllButton);

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

    listener = new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            setAllSelections(false);
            updateWidgetEnablements();
        }
    };
    deselectAllButton.addSelectionListener(listener);
    setButtonLayoutData(deselectAllButton);

}