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:carisma.ui.eclipse.editors.AdfEditorCheckSelectionDialog.java

License:Open Source License

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

    this.recommendedChecksButton = new Button(buttonComposite, SWT.CHECK);
    this.recommendedChecksButton.setLayoutData(new GridData(SWT.LEFT));
    this.recommendedChecksButton.setText("Select recommended checks");
    //setRecommendedChecks(recommendedChecks, true);   // remove comment to initially add the checked Checks to the recommendChecks-List
    this.recommendedChecksButton.setSelection(false); // set this on true to initially check the recommendedChecks

    this.recommendedChecksButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            if (AdfEditorCheckSelectionDialog.this.recommendedChecks != null) {
                if (AdfEditorCheckSelectionDialog.this.recommendedChecksButton.getSelection()) {
                    setRecommendedChecks(AdfEditorCheckSelectionDialog.this.recommendedChecks, true);
                } else {
                    setRecommendedChecks(AdfEditorCheckSelectionDialog.this.recommendedChecks, false);
                }
            }
        }
    });

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

    SelectionListener listener = new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            AdfEditorCheckSelectionDialog.this.listViewer.setAllChecked(true);
        }
    };
    selectButton.setLayoutData(
            new GridData(GridData.HORIZONTAL_ALIGN_FILL, GridData.VERTICAL_ALIGN_FILL, false, false));
    selectButton.addSelectionListener(listener);

    Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, DESELECT_ALL,
            false);
    deselectButton.setLayoutData(
            new GridData(GridData.HORIZONTAL_ALIGN_FILL, GridData.VERTICAL_ALIGN_FILL, false, false));

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

From source file:com.buildml.eclipse.utils.PackageFilterDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    /* add the standard buttons */
    super.createButtonsForButtonBar(parent);

    createButton(parent, IDialogConstants.SELECT_ALL_ID, "Select All", false);
    createButton(parent, IDialogConstants.DESELECT_ALL_ID, "Deselect All", false);
}

From source file:com.buildml.eclipse.utils.PackageFilterDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    /* handle standard buttons */
    super.buttonPressed(buttonId);

    /*// ww w .j  a  v a2s. c  o  m
     * Handle the "Select all" or "Deselect All" buttons.
     */
    if ((buttonId == IDialogConstants.SELECT_ALL_ID) || (buttonId == IDialogConstants.DESELECT_ALL_ID)) {

        /* 
         * Create a new (replacement) PackageSet with no content, but
         * a default of false (deselect all) or true (select all).
         */
        IBuildStore bs = pkgSet.getBuildStore();
        pkgSet = new PackageSet(bs);
        if (buttonId == IDialogConstants.SELECT_ALL_ID) {
            pkgSet.setDefault(true);
        }

        /*
         * Refresh all the widgets, using this new PackageSet.
         */
        for (int i = 0; i < lineWidgets.length; i++) {
            lineWidgets[i].refresh();
        }
    }
}

From source file:com.centurylink.mdw.plugin.designer.dialogs.ToolboxFilterDialog.java

License:Apache License

private void createSelectButtons(Composite parent) {
    Composite buttonComposite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 0;/*from  w  ww  .j  a va  2s.c om*/
    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", false);
    selectButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            suppressedImplementors = new ArrayList<String>();
            treeViewer.refresh();
        }
    });

    Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, "Deselect All",
            false);
    deselectButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            suppressedImplementors = new ArrayList<String>();
            for (WorkflowPackage pkg : workflowProject.getTopLevelUserVisiblePackages()) {
                for (ActivityImpl impl : pkg.getActivityImpls()) {
                    if (!suppressedImplementors.contains(impl.getImplClassName()))
                        suppressedImplementors.add(impl.getImplClassName());
                }
            }
            treeViewer.refresh();
        }
    });
}

From source file:com.ge.research.sadl.ui.imports.OwlFileResourceImportPage1.java

License:Open Source License

/**
 * Creates the buttons for selecting specific types or selecting all or none of the
 * elements./*from  www .  j ava 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(SWT.FILL, SWT.FILL, true, false);
    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);

}

From source file:com.google.dart.tools.search.internal.ui.SearchDialog.java

License:Open Source License

private void handleCustomizePressed() {
    List<SearchPageDescriptor> input = SearchPlugin.getDefault().getSearchPageDescriptors();
    input = filterByActivities(input);//from w  w  w.j  a  va2 s  .c  o m

    final ArrayList<Image> createdImages = new ArrayList<Image>(input.size());
    ILabelProvider labelProvider = new LabelProvider() {
        @Override
        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;
        }

        @Override
        public String getText(Object element) {
            if (element instanceof SearchPageDescriptor) {
                return LegacyActionTools.removeMnemonics(((SearchPageDescriptor) element).getLabel());
            }
            return null;
        }
    };

    String message = SearchMessages.SearchPageSelectionDialog_message;

    ListSelectionDialog dialog = new ListSelectionDialog(getShell(), input, new ArrayContentProvider(),
            labelProvider, message) {
        @Override
        public void create() {
            super.create();
            final CheckboxTableViewer viewer = getViewer();
            final Button okButton = this.getOkButton();
            viewer.addCheckStateListener(new ICheckStateListener() {
                @Override
                public void checkStateChanged(CheckStateChangedEvent event) {
                    okButton.setEnabled(viewer.getCheckedElements().length > 0);
                }
            });
            SelectionListener listener = new SelectionAdapter() {
                @Override
                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() {
                @Override
                public void run() {
                    new OpenSearchDialogAction().run();
                }
            });
        }
    }
    destroyImages(createdImages);
}

From source file:com.google.eclipse.mechanic.plugin.ui.EpfOutputDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.SELECT_ALL_ID, "Select All", false);
    createButton(parent, IDialogConstants.DESELECT_ALL_ID, "Deselect All", false);

    super.createButtonsForButtonBar(parent);
}

From source file:com.google.eclipse.mechanic.plugin.ui.EpfOutputDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    super.buttonPressed(buttonId);
    if (buttonId == IDialogConstants.SELECT_ALL_ID) {
        acceptedPreferences.setAllChecked(true);
        selectedKeys.clear();/*  ww w.j ava  2  s  . c  o m*/
        selectedKeys.addAll(preferences.keySet());
        validate();
    }
    if (buttonId == IDialogConstants.DESELECT_ALL_ID) {
        acceptedPreferences.setAllChecked(false);
        selectedKeys.clear();
        validate();
    }
}

From source file:com.liferay.ide.project.ui.dialog.ProjectSelectionDialog.java

License:Open Source License

private void addSelectionButtons(Composite composite) {
    Composite buttonComposite = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 0;//from   w  w w.j  ava 2  s  . c o m
    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", false);

    SelectionListener listener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            fTableViewer.setAllChecked(true);
            getOkButton().setEnabled(true);

        }
    };

    selectButton.addSelectionListener(listener);
    Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, "Deselect All",
            false);

    listener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            fTableViewer.setAllChecked(false);
            getOkButton().setEnabled(false);
        }
    };

    deselectButton.addSelectionListener(listener);
}

From source file:com.mountainminds.eclemma.internal.ui.dialogs.MergeSessionsDialog.java

License:Open Source License

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