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:com.nokia.carbide.search.system.internal.ui.SearchDialog.java

License:Open Source License

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

    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:com.nokia.s60tools.swmtanalyser.dialogs.AdvancedFilterDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    filter_button = this.createButton(parent, IDialogConstants.OK_ID, "Filter", true);
    filter_button.addSelectionListener(this);
    reset_button = this.createButton(parent, IDialogConstants.DESELECT_ALL_ID, "Reset", false);
    reset_button.addSelectionListener(this);
    cancel_button = this.createButton(parent, IDialogConstants.CANCEL_ID, "Cancel", false);
    cancel_button.addSelectionListener(this);
}

From source file:com.nokia.s60tools.swmtanalyser.dialogs.AdvancedFilterDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {

    if (buttonId == IDialogConstants.DESELECT_ALL_ID) {
        startwith_dropdown.select(0);/*ww  w .  j av  a  2 s.co m*/
        item_name_text.setText("");
        for (int i = 0; i < ram_and_disk_buttons.length; i++) {
            ram_and_disk_buttons[i].setSelection(false);
        }
        for (int i = 0; i < thread_event_buttons.length; i++) {
            thread_event_buttons[i].setSelection(false);
        }
        for (int i = 0; i < system_events_buttons.length; i++) {
            system_events_buttons[i].setSelection(false);
        }
        severity_buttons[0].setSelection(true);
        severity_buttons[0].notifyListeners(SWT.Selection, new Event());
        delta_dropdown.select(0);
        delta_dropdown.notifyListeners(SWT.Selection, new Event());
        delta_dropdown2.select(0);
        delta_dropdown2.notifyListeners(SWT.Selection, new Event());
    }
    super.buttonPressed(buttonId);
}

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;/*from w  ww  .  ja 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 ww .j av  a2  s .  com
 *            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;//w w  w.j av a2 s  .  com
    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);
            }//from w  w  w.  j  a  v  a 2  s . co  m
        };
        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  ww  .ja va 2s  .c o  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;/*  w w  w.ja v  a  2s.  com*/
    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.
  *//w  w w.ja v a2  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();
}