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

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

Introduction

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

Prototype

int HELP_ID

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

Click Source Link

Document

Button id for a "Help" button (value 17).

Usage

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 w w . j a v a2  s .com
 * 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.eclipse.stem.ui.wizards.STEMWizardDialog.java

License:Open Source License

@Override
protected void buttonPressed(final int buttonId) {
    super.buttonPressed(buttonId);
    if (IDialogConstants.HELP_ID == buttonId) {
        if (this.getWizard() instanceof NewIdentifiableWizard) {
            PlatformUI.getWorkbench().getHelpSystem()
                    .displayHelp(((NewIdentifiableWizard) this.getWizard()).getHelpContextId());
        } else {/*from w w  w.  j av  a 2 s . c  om*/
            PlatformUI.getWorkbench().getHelpSystem()
                    .displayHelp(((NewNonIdentifiableWizard) this.getWizard()).getHelpContextId());
        }
    }
}

From source file:org.eclipse.stem.ui.wizards.STEMWizardDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(final Composite parent) {
    super.createButtonsForButtonBar(parent);
    helpButton = super.getButton(IDialogConstants.HELP_ID);
    final ImageDescriptor helpIcon = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.stem.ui",
            "icons/full/customobj16/HelpIcon.gif");
    final Image image = helpIcon.createImage();
    final ImageDescriptor helpIconMacOS = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.stem.ui",
            "icons/full/customobj16/HelpIconMacOS.gif");
    helpButton.setText("");
    if (System.getProperties().getProperty("os.name").contains("Mac")) {
        final Image imageMacOS = helpIconMacOS.createImage();
        helpButton.setImage(imageMacOS);
    } else {//  w  w w  . j av  a 2  s. c om
        helpButton.setImage(image);
    }
    final GridData helpButtonLayout = new GridData();
    helpButtonLayout.verticalAlignment = GridData.FILL;
    helpButton.setLayoutData(helpButtonLayout);
}

From source file:org.jboss.tools.common.model.ui.views.palette.editor.PaletteDialog.java

License:Open Source License

protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.HELP_ID) {
        HelpUtil.helpEclipse(PreferenceModelUtilities.getPreferenceModel(), "PaletteEditor"); //$NON-NLS-1$
    } else {/*from   w  w w.  j  av  a2s.c  o m*/
        super.buttonPressed(buttonId);
    }
}

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

License:Open Source License

protected void createButtonsForButtonBar(final Composite parent) {
    // Reset button; will be invisible if current page is not resetable (see IResetableWizard).
    createButton(parent, RESET_ID,//  w  w w  .  jav  a 2  s .co  m
            Messages.getString("org.kalypso.contribs.eclipse.jface.wizard.view.WizardView1"), "doReset", false); //$NON-NLS-1$ //$NON-NLS-2$

    if (m_wizard instanceof IWizard2 && ((IWizard2) m_wizard).hasSaveButton())
        createButton(parent, SAVE_ID,
                Messages.getString("org.kalypso.contribs.eclipse.jface.wizard.view.WizardView2"), "doSave", //$NON-NLS-1$//$NON-NLS-2$
                false);

    if (m_wizard.isHelpAvailable())
        createButton(parent, IDialogConstants.HELP_ID, IDialogConstants.HELP_LABEL, "doHelp", false); //$NON-NLS-1$

    if (m_wizard.needsPreviousAndNextButtons())
        createPreviousAndNextButtons(parent);

    createButton(parent, IDialogConstants.FINISH_ID, IDialogConstants.FINISH_LABEL, "doFinish", //$NON-NLS-1$
            !m_wizard.needsPreviousAndNextButtons());

    if (!(m_wizard instanceof IWizard2) || ((IWizard2) m_wizard).hasCancelButton())
        createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, "doCancel", false); //$NON-NLS-1$
}

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

License:Apache License

@objid("d657c887-910f-11e0-9de7-002564c97630")
@Override//from  ww  w.  j a va 2  s.  c  om
protected void buttonPressed(final int buttonId) {
    switch (buttonId) {
    case IDialogConstants.HELP_ID: {
        helpPressed();
        break;
    }
    case IDialogConstants.BACK_ID: {
        backPressed();
        break;
    }
    case IDialogConstants.NEXT_ID: {
        nextPressed();
        break;
    }
    case IDialogConstants.FINISH_ID: {
        finishPressed();
        break;
    }
    default: {
        // Nothing to do
        // The Cancel button has a listener which calls cancelPressed directly
    }
    }
}

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

License:Apache License

/**
 * Creates the buttons for this dialog's button bar.
 * <p>/*from w w w.jav a  2s.c o  m*/
 * The <code>WizardDialog</code> implementation of this framework method
 * prevents the parent composite's columns from being made equal width in
 * order to remove the margin between the Back and Next buttons.
 * </p>
 * @param parent the parent composite to contain the buttons
 */
@objid("bc1a8716-120f-11e2-b5c6-002564c97630")
@Override
protected void createButtonsForButtonBar(final Composite parent) {
    ((GridLayout) parent.getLayout()).makeColumnsEqualWidth = false;
    if (this.wizard.isHelpAvailable()) {
        this.helpButton = createButton(parent, IDialogConstants.HELP_ID, IDialogConstants.HELP_LABEL, false);
    }
    if (this.wizard.needsPreviousAndNextButtons()) {
        createPreviousAndNextButtons(parent);
    }
    this.finishButton = createButton(parent, IDialogConstants.FINISH_ID, IDialogConstants.FINISH_LABEL, true);
    this.cancelButton = createCancelButton(parent);

    if (parent.getDisplay().getDismissalAlignment() == SWT.RIGHT) {
        // Make the default button the right-most button.
        // See also special code in org.eclipse.jface.dialogs.Dialog#initializeBounds()
        this.finishButton.moveBelow(null);
    }
}

From source file:org.rssowl.ui.internal.Controller.java

License:Open Source License

/**
 * Start a Workbench emergency shutdown due to an unrecoverable Out of Memory
 * error.//from w  w  w.  ja  va2s  .c o  m
 *
 * @param error the {@link OutOfMemoryError} that causes an emergent shutdown.
 */
public void emergencyOutOfMemoryShutdown(final OutOfMemoryError error) {

    /* Flag shutdown sequence about to start to reduce Job load */
    fShuttingDown = true;

    /* Return early if OOM Exception already handled from a different thread */
    if (OOM_EMERGENCY_SHUTDOWN.getAndSet(true))
        return;

    /* Shutdown needs to run from UI Thread */
    JobRunner.runInUIThread(null, new Runnable() {
        public void run() {
            try {

                /* Initialize Emergent Shutdown */
                ApplicationWorkbenchAdvisor.fgPrimaryApplicationWorkbenchWindowAdvisor.getWindowConfigurer()
                        .getWorkbenchConfigurer().emergencyClose();

                /* Inform the User */
                IStatus errorStatus = new Status(IStatus.ERROR, "org.rssowl.ui", IStatus.ERROR, //$NON-NLS-1$
                        error.getMessage(), error);
                FatalOutOfMemoryErrorDialog dialog = new FatalOutOfMemoryErrorDialog(errorStatus);
                if (dialog.open() == IDialogConstants.HELP_ID)
                    Program.launch("http://www.rssowl.org/help#item_6g"); //$NON-NLS-1$;
            }

            /* Serious problem - Exit (gives Shutdown Hook a chance to run) */
            catch (Error err) {
                System.exit(0);
            }
        }
    });
}

From source file:org.rssowl.ui.internal.dialogs.FatalOutOfMemoryErrorDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.HELP_ID, Messages.StartupErrorDialog_HELP, true);
    getButton(IDialogConstants.HELP_ID).setFocus();
}

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

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);
    if (PluginChecker.isTDQLoaded()) {
        Button help = createButton(parent, IDialogConstants.HELP_ID, IDialogConstants.HELP_LABEL, false);
        help.addSelectionListener(new SelectionAdapter() {

            @Override/*w w w.j a va  2  s .  com*/
            public void widgetSelected(SelectionEvent e) {
                PlatformUI.getWorkbench().getHelpSystem().displayHelp("org.talend.help.match_rule_selector");//$NON-NLS-1$
            }
        });
    }
}