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.ow2.joram.design.model.export.wizard.SelectElementsWizardPage.java

License:Open Source License

protected void createSelectionButtons(Composite composite) {
    Composite buttonComposite = new Composite(composite, SWT.RIGHT);
    GridLayout layout = new GridLayout();
    layout.numColumns = 0;/*from  ww w.  j  a  v a 2 s  . co m*/
    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);
    Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, "Select &All");
    SelectionListener listener = new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            Object[] viewerElements = fContentProvider.getElements(fInput);
            treeViewer.setCheckedElements(viewerElements);
            validCheckedElements();
        }
    };
    selectButton.addSelectionListener(listener);
    Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, "&Deselect All");
    listener = new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            treeViewer.setCheckedElements(new Object[0]);
            validCheckedElements();
        }
    };
    deselectButton.addSelectionListener(listener);
}

From source file:org.python.pydev.debug.ui.PyConfigureExceptionDialog.java

License:Open Source License

/**
 * Creates a Select All button and its respective listener.
 * //from   w w  w . j a v  a 2 s .  c  om
 * @param buttonComposite
 */
private void createSelectAll(Composite buttonComposite) {
    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);
}

From source file:org.python.pydev.ui.pythonpathconf.PyListSelectionDialog.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  ava  2  s  .  co 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));

    if (addSelectAllNotInWorkspace) {
        Button selectNotInWorkspaceButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID,
                "Select All not in Workspace", false);

        SelectionListener listenerNotInWorkspace = new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                HashSet<IPath> rootPaths = InterpreterConfigHelpers.getRootPaths();
                TableItem[] children = listViewer.getTable().getItems();
                for (int i = 0; i < children.length; i++) {
                    TableItem item = children[i];
                    item.setChecked(
                            !InterpreterConfigHelpers.isChildOfRootPath((String) item.getData(), rootPaths));
                }
            }
        };
        selectNotInWorkspaceButton.addSelectionListener(listenerNotInWorkspace);
    }

    Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, "Select All", 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",
            false);

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

From source file:org.search.niem.uml.search.ui.dialog.NiemCheckedTreeSelectionDialog.java

License:Open Source License

private Composite createSelectionButtons(final Composite composite) {
    final Composite buttonComposite = new Composite(composite, SWT.RIGHT);
    final GridLayout layout = new GridLayout();
    layout.numColumns = 0;//from w w  w . j  ava2s .  c  om
    layout.marginWidth = 0;
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    buttonComposite.setLayout(layout);
    buttonComposite.setFont(composite.getFont());
    final GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL);
    data.grabExcessHorizontalSpace = true;
    buttonComposite.setLayoutData(data);
    final Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID,
            Activator.INSTANCE.getString("_UI_NIEM_CheckedTreeSelectionDialog_select_all"), false);
    SelectionListener listener = new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            final TreeItem[] visibleExpandedElements = getExpandedTreeItems(theViewer.getTree());
            for (final TreeItem treeItem : visibleExpandedElements) {
                treeItem.setChecked(true);
                treeItem.setGrayed(true);
            }
            updateOKStatus();
        }
    };
    selectButton.addSelectionListener(listener);
    final Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID,
            Activator.INSTANCE.getString("_UI_NIEM_CheckedTreeSelectionDialog_deselect_all"), false);
    listener = new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            theViewer.setCheckedElements(new Object[0]);
            updateOKStatus();
        }
    };
    deselectButton.addSelectionListener(listener);
    return buttonComposite;
}

From source file:org.spearce.egit.ui.internal.dialogs.CommitDialog.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);

    createButton(parent, IDialogConstants.OK_ID, "Commit", true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:org.talend.dataprofiler.common.ui.dialog.AbstractJarSelectDialog.java

License:Open Source License

/**
 * Adds the selection and deselection buttons to the dialog.
 * //w  w  w .j  ava 2s  . c o  m
 * @param composite the parent composite
 * @return Composite the composite the buttons were created in.
 */
protected Composite createButtons(final Composite composite, final boolean isSelect) {
    Composite buttonComposite = new Composite(composite, SWT.RIGHT);
    buttonComposite.setBackground(composite.getBackground());
    GridLayout layout = new GridLayout();
    layout.numColumns = 0;
    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);
    Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID,
            WorkbenchMessages.CheckedTreeSelectionDialog_select_all, false);
    SelectionListener listener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Object[] viewerElements = fContentProvider.getElements(fInput);
            if (fContainerMode) {
                if (isSelect) {
                    fViewer.setCheckedElements(viewerElements);
                    // ADD msjian 2011-8-9 TDQ-3199 fixed: Make it convenient to delete the jar which is used
                    // already.
                    handleChecked();
                    handleClassNameFromJarFile();
                    // ADD end
                } else {
                    fManageViewer.setCheckedElements(viewerElements);
                }
            } else {
                for (Object viewerElement : viewerElements) {
                    if (isSelect) {
                        fViewer.setSubtreeChecked(viewerElement, true);
                    } else {
                        fManageViewer.setSubtreeChecked(viewerElement, true);
                    }
                }
            }
            updateOKStatus();
        }
    };
    selectButton.addSelectionListener(listener);

    Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID,
            WorkbenchMessages.CheckedTreeSelectionDialog_deselect_all, false);
    listener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (isSelect) {
                fViewer.setCheckedElements(new Object[0]);
                // ADD msjian 2011-8-9 TDQ-3199 fixed: Make it convenient to delete the jar which is used
                // already.
                handleChecked();
                handleClassNameFromJarFile();
                // ADD end
            } else {
                fManageViewer.setCheckedElements(new Object[0]);
            }
            updateOKStatus();
        }
    };
    deselectButton.addSelectionListener(listener);

    if (!isSelect) {
        final Composite dialogComposite = composite;

        Button addButton = createButton(buttonComposite, 22, Messages.getString("AbstractJarSelectDialog.add"), //$NON-NLS-1$
                false);
        SelectionListener listenerAdd = new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                FileDialog dialog = new FileDialog(dialogComposite.getShell(), SWT.NONE | SWT.MULTI);
                dialog.setFilterExtensions(new String[] { "*.jar" }); //$NON-NLS-1$
                String path = dialog.open();

                if (path != null) {
                    String[] fileNames = dialog.getFileNames();
                    for (String name : fileNames) {
                        IPath filePath = new Path(path);
                        filePath = filePath.removeLastSegments(1).append(name);

                        // TDQ-7451 Replace File copy with eclipse IFile create.make svn could syn and control.
                        IFile targetFile = ResourceManager.getUDIJarFolder().getFile(filePath.lastSegment());
                        createIFileFromFile(filePath.toFile(), targetFile, getDescriptionMessage(name));
                    }
                }
                // MOD msjian 2011-7-14 22092 feature: Java UDI: not convinient to delete udi jar files
                fViewer.refresh();
                fManageViewer.refresh();
                fViewer.setInput(ResourceManager.getUDIJarFolder());
                fManageViewer.setInput(ResourceManager.getUDIJarFolder());

                fIsEmpty = evaluateIfTreeEmpty(fInput);
                // getTreeViewer().setCheckedElements(new Object[0]);
                updateOKStatus();
            }

        };
        addButton.addSelectionListener(listenerAdd);

        Button delButton = createButton(buttonComposite, 23,
                Messages.getString("AbstractJarSelectDialog.delete"), //$NON-NLS-1$
                false);
        SelectionListener listenerDel = new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                for (Object delFile : fManageViewer.getCheckedElements()) {
                    // Object delFile = manageSelectList.get(i);
                    if (delFile instanceof File) {
                        // MOD msjian 2011-8-9 TDQ-3199 fixed: Make it convenient to delete the jar which is used
                        // already.

                        ReturnCode rc = checkJarDependency((File) delFile);

                        if (selectedJars.containsKey(delFile)) {
                            rc.setOk(false);
                            rc.setMessage(getFileHasBeenSelectedMessages(delFile));
                        }
                        // MOD end
                        if (rc.isOk()) {
                            boolean delete = ((File) delFile).delete();
                            if (!delete) {
                                MessageDialog.openWarning(getParentShell(),
                                        Messages.getString("AbstractJarSelectDialog.delete"), //$NON-NLS-1$
                                        Messages.getString("AbstractJarSelectDialog.deleteFail")); //$NON-NLS-1$
                            }
                        } else {
                            MessageDialog.openWarning(getParentShell(),
                                    Messages.getString("AbstractJarSelectDialog.warning"), rc.getMessage()); //$NON-NLS-1$
                        }
                    }
                    refreshWorkspace();
                }
                // MOD msjian 2011-7-14 22092 feature: Java UDI: not convinient to delete udi jar files
                fViewer.refresh();
                fManageViewer.refresh();
                fIsEmpty = evaluateIfTreeEmpty(fInput);
                updateOKStatus();
            }

        };
        delButton.addSelectionListener(listenerDel);
    } else {

        createOKButton(buttonComposite);

        Button cancelButton = createButton(buttonComposite, IDialogConstants.CANCEL_ID,
                IDialogConstants.CANCEL_LABEL, false);
        SelectionListener listenerCancel = new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                cancelPressed();
            }
        };
        cancelButton.addSelectionListener(listenerCancel);
        // TDQ-3556 ~
    }

    return buttonComposite;
}

From source file:org.talend.dataprofiler.core.ui.dialog.TwoPartCheckSelectionDialog.java

License:Open Source License

/**
 * Adds the selection and deselection buttons to the dialog.
 * //  w w  w  .  jav  a2 s.  com
 * @param composite 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.numColumns = 2;
    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, "Select &All", false); //$NON-NLS-1$

    Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, "&Deselect All", //$NON-NLS-1$
            false);

    addSelectionButtonListener(selectButton, deselectButton);
    return buttonComposite;
}

From source file:org.talend.designer.core.ui.editor.update.UpdateDetectionDialog.java

License:Open Source License

private Composite createBottomButtonArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout();
    gridLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING * 4);
    composite.setLayout(gridLayout);//from  w  w  w . j  a  va  2  s .  c  o  m
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END));

    // expand
    Button expandButton = createButton(composite, 99, Messages.getString("UpdateDetectionDialog.Expand"), //$NON-NLS-1$
            false);
    expandButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (getViewer() != null) {
                getViewer().expandAll();
            }
        }
    });
    // collapse
    Button collapseButton = createButton(composite, 98, Messages.getString("UpdateDetectionDialog.Collapse"), //$NON-NLS-1$
            false);
    collapseButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (getViewer() != null) {
                getViewer().collapseAll();
            }
        }
    });
    if (!isOnlySimpleShow() && canDeselect) {
        // "select all" button
        // selectButton = createButton(composite, IDialogConstants.SELECT_ALL_ID,
        // WorkbenchMessages.SelectionDialog_selectLabel,
        // false);
        selectButton = createButton(composite, IDialogConstants.SELECT_ALL_ID,
                Messages.getString("WorkbenchMessages.SelectionDialog_selectLabel"), false); //$NON-NLS-1$
        // init label;
        if (getViewerHelper() != null) {
            getViewerHelper().refreshSelectButton();
        }

        selectButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                if (getViewerHelper() != null) {
                    boolean state = false;

                    // if (!isJobReadOnly &&
                    // WorkbenchMessages.SelectionDialog_selectLabel.equals(selectButton.getText())) {
                    if (!isJobReadOnly
                            && Messages.getString("WorkbenchMessages.SelectionDialog_selectLabel").equals( //$NON-NLS-1$
                                    selectButton.getText())) {
                        state = true;
                    }
                    getViewerHelper().selectAll(state);
                }
            }
        });
    }
    return composite;
}

From source file:org.talend.repository.ui.wizards.newproject.copyfromeclipse.TalendWizardArchiveFileResourceExportPage1.java

License:Open Source License

protected final void myCreateButtonsGroup(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;/*from  ww w. jav a2 s .  c om*/
    layout.makeColumnsEqualWidth = true;
    buttonComposite.setLayout(layout);
    buttonComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));

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

    SelectionListener listener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            handleTypesEditButtonPressed();
        }
    };
    selectTypesButton.addSelectionListener(listener);
    selectTypesButton.setFont(font);
    setButtonLayoutData(selectTypesButton);

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

    listener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            resourceGroup.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() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            resourceGroup.setAllSelections(false);
            updateWidgetEnablements();
        }
    };
    deselectButton.addSelectionListener(listener);
    deselectButton.setFont(font);
    setButtonLayoutData(deselectButton);

}

From source file:org.tigris.subversion.subclipse.ui.dialogs.AddToVersionControlDialog.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  av a 2s. co m
private void addSelectionButtons(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,
            Policy.bind("ReleaseCommentDialog.selectAll"), false); //$NON-NLS-1$
    SelectionListener listener = new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            listViewer.setAllChecked(true);
            resourcesToAdd = null;
        }
    };
    selectButton.addSelectionListener(listener);

    Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID,
            Policy.bind("ReleaseCommentDialog.deselectAll"), false); //$NON-NLS-1$
    listener = new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            listViewer.setAllChecked(false);
            resourcesToAdd = new Object[0];

        }
    };
    deselectButton.addSelectionListener(listener);
}