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

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

Introduction

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

Prototype

String BACK_LABEL

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

Click Source Link

Document

The label for back buttons.

Usage

From source file:org.eclipse.epp.internal.mpc.ui.wizards.MarketplaceWizardDialog.java

License:Open Source License

public String getBackButtonLabel(IWizardPage page) {
    if (page == getWizard().getFeatureSelectionWizardPage()) {
        return Messages.MarketplaceWizardDialog_Install_More;
    }/*from  w  ww.j  a va 2s .  co  m*/
    return IDialogConstants.BACK_LABEL;
}

From source file:org.eclipse.ltk.internal.ui.refactoring.RefactoringStatusDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    if (!fStatus.hasFatalError()) {
        if (fBackButton)
            createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
        createButton(parent, IDialogConstants.OK_ID, fLightWeight ? IDialogConstants.OK_LABEL
                : RefactoringUIMessages.RefactoringStatusDialog_Continue, true);
        createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    } else {// w  w  w .j  a v  a2s  . com
        if (fBackButton)
            createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, true);
        createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL,
                fBackButton ? false : true);
    }
}

From source file:org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.java

License:Open Source License

public void updateButtons() {
    boolean previewPage = isPreviewPageActive();
    boolean ok = fWizard.canFinish();
    boolean canFlip = fCurrentPage.canFlipToNextPage();

    Button defaultButton = null;//from  ww  w  .  ja v a2 s . co  m

    Button previewButton = getButton(PREVIEW_ID);
    if (previewButton != null && !previewButton.isDisposed()) {
        String previewLabel = previewPage ? IDialogConstants.BACK_LABEL
                : RefactoringUIMessages.RefactoringWizardDialog2_buttons_preview_label;
        previewButton.setText(previewLabel);
        setButtonLayoutData(previewButton);
        getShell().layout(new Control[] { previewButton });

        boolean enable = true;
        if (!previewPage)
            enable = canFlip;
        previewButton.setEnabled(enable);
        if (enable)
            defaultButton = previewButton;
    }

    Button nextButton = getButton(IDialogConstants.NEXT_ID);
    if (nextButton != null && !nextButton.isDisposed()) {
        nextButton.setEnabled(!previewPage);
        if (!previewPage)
            nextButton.setEnabled(canFlip);
        if (nextButton.isEnabled())
            defaultButton = nextButton;
    }

    Button backButton = getButton(IDialogConstants.BACK_ID);
    if (backButton != null && !backButton.isDisposed())
        backButton.setEnabled(!isFirstPage());

    Button okButton = getButton(IDialogConstants.OK_ID);
    if (okButton != null && !okButton.isDisposed()) {
        okButton.setEnabled(ok);
        if (ok)
            defaultButton = okButton;
    }

    if (defaultButton != null) {
        defaultButton.getShell().setDefaultButton(defaultButton);
    }
}

From source file:org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.java

License:Open Source License

private Composite createPreviousAndNextButtons(Composite parent) {
    // Copied from Wizard Dialog.

    // increment the number of columns in the button bar
    GridLayout barLayout = (GridLayout) parent.getLayout();
    barLayout.numColumns += 2; // parent is assumed to have a GridLayout (see javadoc of Dialog#createButton(..))
    Composite composite = new Composite(parent, SWT.NONE);
    // create a layout with spacing and margins appropriate for the font
    // size.//from w w  w.ja  v  a2  s .  co  m
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // will be incremented by createButton
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    composite.setLayout(layout);
    composite.setFont(parent.getFont());
    Button backButton = createButton(composite, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
    backButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            backPressed();
        }
    });
    Button nextButton = createButton(composite, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, false);
    nextButton.addSelectionListener(new SelectionAdapter() {

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

    GridData data = new GridData();
    int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    Point minSize1 = backButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    Point minSize2 = nextButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    int minSize = Math.max(minSize1.x, minSize2.x);
    ((GridData) backButton.getLayoutData()).widthHint = minSize;
    ((GridData) nextButton.getLayoutData()).widthHint = minSize;
    data.widthHint = 2 * Math.max(widthHint, minSize) + barLayout.horizontalSpacing;
    data.horizontalAlignment = SWT.FILL;
    data.grabExcessHorizontalSpace = true;
    data.horizontalSpan = 2;
    composite.setLayoutData(data);

    return composite;
}

From source file:org.eclipse.osee.framework.ui.swt.NonmodalWizardDialog.java

License:Open Source License

private Composite createPreviousAndNextButtons(Composite parent) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    Composite composite = new Composite(parent, SWT.NONE);
    // create a layout with spacing and margins appropriate for the font size.
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // will be incremented by createButton
    layout.marginWidth = 0;//from w ww.  j  a  v  a2s .  com
    layout.marginHeight = 0;
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    composite.setLayout(layout);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_CENTER);
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());
    backButton = createButton(composite, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
    nextButton = createButton(composite, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, false);
    nextButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            //            System.out.println("the next button was pressed");
        }
    });
    return composite;
}

From source file:org.eclipse.papyrus.modelexplorer.dialog.NavigatorSearchDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {

    backButton = createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
    nextButton = createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, false);
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);

    backButton.setEnabled(false);/*from  ww w . ja  v a  2s  .  c o m*/
    nextButton.setEnabled(false);

    nextButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            ISelection sel = viewer.getSelection();
            if (!(sel instanceof StructuredSelection)) {
                return;
            }
            StructuredSelection ssel = (StructuredSelection) sel;

            int index = matchedObjects.lastIndexOf(ssel.getFirstElement());
            if (index == matchedObjects.size() - 1) {
                index = -1;
            }
            index++;
            fireSetSelection(new StructuredSelection(matchedObjects.get(index)), true);
        }

    });

    backButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            ISelection sel = viewer.getSelection();
            if (!(sel instanceof StructuredSelection)) {
                return;
            }
            StructuredSelection ssel = (StructuredSelection) sel;

            int index = matchedObjects.lastIndexOf(ssel.getFirstElement());
            if (index == 0) {
                index = matchedObjects.size() - 1;
            }
            index--;
            fireSetSelection(new StructuredSelection(matchedObjects.get(index)), true);
        }

    });
}

From source file:org.eclipse.papyrus.views.modelexplorer.dialog.ApexNavigatorSearchDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {

    backButton = createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
    nextButton = createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, false);
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);

    /* apex replaced /*from  w  ww.j a  v  a 2s.  com*/
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,
    true);
    */

    backButton.setEnabled(false);
    nextButton.setEnabled(false);

    nextButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            if (currentIndex >= matchedObjects.size() - 1) {
                currentIndex = 0;
            } else {
                currentIndex++;
            }
            fireSetSelection(new StructuredSelection(matchedObjects.get(currentIndex)), true);
        }

    });

    backButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            if (currentIndex <= 0) {
                currentIndex = matchedObjects.size() - 1;
            } else {
                currentIndex--;
            }
            fireSetSelection(new StructuredSelection(matchedObjects.get(currentIndex)), true);
        }

    });

    /* apex added start */
    final Shell shell = parent.getShell();
    okButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            System.out.println(
                    "ApexNavigatorSearchDialog.createButtonsForButtonBar(...).new SelectionListener() {...}.widgetSelected(), line : "
                            + Thread.currentThread().getStackTrace()[1].getLineNumber());
            HierarchyInformationControl resultControl = new HierarchyInformationControl(shell,
                    SWT.RESIZE | SWT.BORDER, SWT.NONE);

            resultControl.open();
            /*
            if(currentIndex <= 0) {
               currentIndex = matchedObjects.size() - 1;
            } else {
               currentIndex--;
            }
            fireSetSelection(new StructuredSelection(matchedObjects.get(currentIndex)), true);
            */
        }

    });
    /* apex added end */
}

From source file:org.eclipse.sirius.common.ui.tools.api.dialog.SiriusMessageDialogWithToggle.java

License:Open Source License

/**
 * Attempt to find a standard JFace button id that matches the specified
 * button label. If no match can be found, use the default id provided.
 * /*w ww  .  j  av a  2s  .  c o m*/
 * Overridden to investigate the provided buttons.
 * 
 * @param buttonLabel
 *            the button label whose id is sought
 * @param defaultId
 *            the id to use for the button if there is no standard id
 * @return the id for the specified button label
 */
// CHECKSTYLE:OFF
private int mapButtonLabelToButtonID(String buttonLabel, int defaultId) {
    // CHECKSTYLE:OON
    // Not pretty but does the job...
    if (IDialogConstants.OK_LABEL.equals(buttonLabel)) {
        return IDialogConstants.OK_ID;
    }

    if (IDialogConstants.YES_LABEL.equals(buttonLabel)) {
        return IDialogConstants.YES_ID;
    }

    if (IDialogConstants.NO_LABEL.equals(buttonLabel)) {
        return IDialogConstants.NO_ID;
    }

    if (IDialogConstants.CANCEL_LABEL.equals(buttonLabel)) {
        return IDialogConstants.CANCEL_ID;
    }

    if (IDialogConstants.YES_TO_ALL_LABEL.equals(buttonLabel)) {
        return IDialogConstants.YES_TO_ALL_ID;
    }

    if (IDialogConstants.SKIP_LABEL.equals(buttonLabel)) {
        return IDialogConstants.SKIP_ID;
    }

    if (IDialogConstants.STOP_LABEL.equals(buttonLabel)) {
        return IDialogConstants.STOP_ID;
    }

    if (IDialogConstants.ABORT_LABEL.equals(buttonLabel)) {
        return IDialogConstants.ABORT_ID;
    }

    if (IDialogConstants.RETRY_LABEL.equals(buttonLabel)) {
        return IDialogConstants.RETRY_ID;
    }

    if (IDialogConstants.IGNORE_LABEL.equals(buttonLabel)) {
        return IDialogConstants.IGNORE_ID;
    }

    if (IDialogConstants.PROCEED_LABEL.equals(buttonLabel)) {
        return IDialogConstants.PROCEED_ID;
    }

    if (IDialogConstants.OPEN_LABEL.equals(buttonLabel)) {
        return IDialogConstants.OPEN_ID;
    }

    if (IDialogConstants.CLOSE_LABEL.equals(buttonLabel)) {
        return IDialogConstants.CLOSE_ID;
    }

    if (IDialogConstants.BACK_LABEL.equals(buttonLabel)) {
        return IDialogConstants.BACK_ID;
    }

    if (IDialogConstants.NEXT_LABEL.equals(buttonLabel)) {
        return IDialogConstants.NEXT_ID;
    }

    if (IDialogConstants.FINISH_LABEL.equals(buttonLabel)) {
        return IDialogConstants.FINISH_ID;
    }

    if (IDialogConstants.HELP_LABEL.equals(buttonLabel)) {
        return IDialogConstants.HELP_ID;
    }

    if (IDialogConstants.NO_TO_ALL_LABEL.equals(buttonLabel)) {
        return IDialogConstants.NO_TO_ALL_ID;
    }

    if (IDialogConstants.SHOW_DETAILS_LABEL.equals(buttonLabel)) {
        return IDialogConstants.DETAILS_ID;
    }

    if (IDialogConstants.HIDE_DETAILS_LABEL.equals(buttonLabel)) {
        return IDialogConstants.DETAILS_ID;
    }

    for (String providedButton : buttonsMap.keySet()) {
        if (providedButton.equals(buttonLabel)) {
            return buttonsMap.get(providedButton);
        }
    }

    // No XXX_LABEL in IDialogConstants for these. Unlikely
    // they would be used in a message dialog though.
    // public int SELECT_ALL_ID = 18;
    // public int DESELECT_ALL_ID = 19;
    // public int SELECT_TYPES_ID = 20;

    return defaultId;
}

From source file:org.kalypso.contribs.eclipse.jface.wizard.view.WizardView.java

License:Open Source License

/**
 * Creates the Previous and Next buttons for this wizard dialog. Creates standard (<code>SWT.PUSH</code>) buttons and
 * registers for their selection events. Note that the number of columns in the button bar composite is incremented.
 * These buttons are created specially to prevent any space between them.
 *
 * @param parent//from www .  j  a va 2 s .  c  o  m
 *          the parent button bar
 * @return a composite containing the new buttons
 */
private Composite createPreviousAndNextButtons(final Composite parent) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    final Composite composite = new Composite(parent, SWT.NONE);
    // create a layout with spacing and margins appropriate for the font size.
    GridLayoutFactory.fillDefaults().numColumns(0).spacing(0, 0).applyTo(composite);

    composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_CENTER));

    composite.setFont(parent.getFont());
    createButton(composite, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, "doPrev", false); //$NON-NLS-1$
    createButton(composite, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, "doNext", true); //$NON-NLS-1$
    return composite;
}

From source file:org.modelio.api.ui.ModelioWizardDialog.java

License:Apache License

/**
 * Creates the Previous and Next buttons for this wizard dialog. Creates
 * standard (<code>SWT.PUSH</code>) buttons and registers for their
 * selection events. Note that the number of columns in the button bar
 * composite is incremented. These buttons are created specially to prevent
 * any space between them./*from  w  w  w.  ja  v a 2  s.c  o m*/
 * @param parent the parent button bar
 * @return a composite containing the new buttons
 */
@objid("bc1ce886-120f-11e2-b5c6-002564c97630")
private Composite createPreviousAndNextButtons(final Composite parent) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    Composite composite = new Composite(parent, SWT.NONE);
    // create a layout with spacing and margins appropriate for the font
    // size.
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // will be incremented by createButton
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    composite.setLayout(layout);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_CENTER);
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());
    this.backButton = createButton(composite, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
    this.nextButton = createButton(composite, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, false);
    return composite;
}