Example usage for org.eclipse.jface.dialogs MessageDialog QUESTION

List of usage examples for org.eclipse.jface.dialogs MessageDialog QUESTION

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs MessageDialog QUESTION.

Prototype

int QUESTION

To view the source code for org.eclipse.jface.dialogs MessageDialog QUESTION.

Click Source Link

Document

Constant for the question image, or a simple dialog with the question image and Yes/No buttons (value 3).

Usage

From source file:org.eclipse.emf.diffmerge.ui.viewers.IgnoreChoicesDialog.java

License:Open Source License

/**
 * Constructor/*from w w w . java  2  s .  co  m*/
 * @param parentShell_p the non-null shell for this dialog
 * @param title_p a non-null string
 * @param data_p the non-null data that this dialog allows editing
 * @param askAboutChildren_p whether the choice for children is enabled
 */
public IgnoreChoicesDialog(Shell parentShell_p, String title_p, IgnoreChoiceData data_p) {
    super(parentShell_p, title_p, null, Messages.IgnoreChoicesDialog_Question, MessageDialog.QUESTION,
            new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
    _data = data_p;
}

From source file:org.eclipse.emf.diffmerge.ui.viewers.MergeChoicesDialog.java

License:Open Source License

/**
 * Constructor//from   ww w . j  ava 2  s. c o m
 * @param parentShell_p the non-null shell for this dialog
 * @param title_p a non-null string
 * @param data_p the non-null data that this dialog allows editing
 * @param askAboutChildren_p whether the choice for children is enabled
 */
public MergeChoicesDialog(Shell parentShell_p, String title_p, MergeChoiceDialogData data_p,
        boolean askAboutChildren_p) {
    super(parentShell_p, title_p, null, Messages.MergeChoicesDialog_Question, MessageDialog.QUESTION,
            new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
    _data = data_p;
    _askAboutChildren = askAboutChildren_p;
}

From source file:org.eclipse.emf.ecp.common.commands.DeleteModelElementCommand.java

License:Open Source License

private boolean askConfirmation() {
    String question = null;/*from   ww  w. j a  va 2  s  .co  m*/
    ComposedAdapterFactory adapterFactory = null;
    if (toBeDeleted.size() == 1) {
        adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
        AdapterFactoryLabelProvider adapterFactoryLabelProvider = new AdapterFactoryLabelProvider(
                adapterFactory);
        String modelElementName = adapterFactoryLabelProvider.getText(toBeDeleted.iterator().next());
        question = "Do you really want to delete the model element " + modelElementName + "?";
    } else {
        question = "Do you really want to delete these " + toBeDeleted.size() + " model elements?";
    }
    MessageDialog dialog = new MessageDialog(null, "Confirmation", null, question, MessageDialog.QUESTION,
            new String[] { "Yes", "No" }, 0);

    boolean confirm = false;
    if (dialog.open() == MessageDialog.OK) {
        confirm = true;
    }

    if (adapterFactory != null) {
        adapterFactory.dispose();
    }

    return confirm;
}

From source file:org.eclipse.emf.ecp.edit.internal.swt.reference.DeleteReferenceAction.java

License:Open Source License

private static boolean askConfirmation(EObject toBeDeleted) {
    String question = null;//from  w  w  w  .j  a v  a2  s  . c o m
    ComposedAdapterFactory adapterFactory = null;
    // if (toBeDeleted.size() == 1) {
    adapterFactory = new ComposedAdapterFactory(
            new AdapterFactory[] { new ReflectiveItemProviderAdapterFactory(),
                    new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE) });
    final AdapterFactoryItemDelegator adapterFactoryItemDelegator = new AdapterFactoryItemDelegator(
            adapterFactory);
    // AdapterFactoryLabelProvider adapterFactoryLabelProvider = new AdapterFactoryLabelProvider(adapterFactory);
    final String modelElementName = adapterFactoryItemDelegator.getText(toBeDeleted);
    question = ActionMessages.DeleteReferenceAction_DeleteModelQuestion + modelElementName
            + ActionMessages.DeleteReferenceAction_Questionmark;
    // } else {
    // question = "Do you really want to delete these " + toBeDeleted.size() + " model elements?";
    // }
    final MessageDialog dialog = new MessageDialog(null, ActionMessages.DeleteReferenceAction_Confirmation,
            null, question, MessageDialog.QUESTION,
            new String[] { ActionMessages.DeleteReferenceAction_Yes, ActionMessages.DeleteReferenceAction_No },
            0);

    boolean confirm = false;
    if (dialog.open() == Window.OK) {
        confirm = true;
    }

    // if (adapterFactory != null)
    // {
    // adapterFactory.dispose();
    // }
    adapterFactory.dispose();
    return confirm;
}

From source file:org.eclipse.emf.ecp.edit.spi.swt.reference.DeleteReferenceAction.java

License:Open Source License

private static boolean askConfirmation(EObject toBeDeleted) {
    String question = null;/*w  w  w .j  a  v a  2s  .c o  m*/
    ComposedAdapterFactory adapterFactory = null;
    // if (toBeDeleted.size() == 1) {
    adapterFactory = new ComposedAdapterFactory(
            new AdapterFactory[] { new ReflectiveItemProviderAdapterFactory(),
                    new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE) });
    final AdapterFactoryItemDelegator adapterFactoryItemDelegator = new AdapterFactoryItemDelegator(
            adapterFactory);
    // AdapterFactoryLabelProvider adapterFactoryLabelProvider = new AdapterFactoryLabelProvider(adapterFactory);
    final String modelElementName = adapterFactoryItemDelegator.getText(toBeDeleted);
    question = LocalizationServiceHelper.getString(DeleteReferenceAction.class,
            ReferenceMessageKeys.DeleteReferenceAction_DeleteModelQuestion) + modelElementName
            + LocalizationServiceHelper.getString(DeleteReferenceAction.class,
                    ReferenceMessageKeys.DeleteReferenceAction_Questionmark);
    // } else {
    // question = "Do you really want to delete these " + toBeDeleted.size() + " model elements?";
    // }
    final MessageDialog dialog = new MessageDialog(null,
            LocalizationServiceHelper.getString(DeleteReferenceAction.class,
                    ReferenceMessageKeys.DeleteReferenceAction_Confirmation),
            null, question, MessageDialog.QUESTION,
            new String[] {
                    LocalizationServiceHelper.getString(DeleteReferenceAction.class,
                            ReferenceMessageKeys.DeleteReferenceAction_Yes),
                    LocalizationServiceHelper.getString(DeleteReferenceAction.class,
                            ReferenceMessageKeys.DeleteReferenceAction_No) },
            0);

    boolean confirm = false;
    if (dialog.open() == Window.OK) {
        confirm = true;
    }

    // if (adapterFactory != null)
    // {
    // adapterFactory.dispose();
    // }
    adapterFactory.dispose();
    return confirm;
}

From source file:org.eclipse.emf.emfstore.internal.client.ui.controller.AbstractEMFStoreUIController.java

License:Open Source License

/**
 * Shows a confirmation dialog.//from   ww w .  j a va2  s  .co  m
 * 
 * @param title
 *            the title of the confirmation dialog
 * @param message
 *            the message to be shown in the dialog
 * 
 * @return true, if the user confirms the dialog by clicking "Yes", otherwise false
 */
public boolean confirm(final String title, final String message) {
    if (isForked()) {
        return RunInUI.runWithResult(new Callable<Boolean>() {
            public Boolean call() throws Exception {
                final MessageDialog dialog = new MessageDialog(shell, title, null, message,
                        MessageDialog.QUESTION, new String[] { Messages.AbstractEMFStoreUIController_Yes,
                                Messages.AbstractEMFStoreUIController_No },
                        0);
                final int result = dialog.open();
                return result == Window.OK;
            }
        });
    }
    final MessageDialog dialog = new MessageDialog(shell, title, null, message, MessageDialog.QUESTION,
            new String[] { Messages.AbstractEMFStoreUIController_Yes,
                    Messages.AbstractEMFStoreUIController_No },
            0);
    return dialog.open() == Window.OK;
}

From source file:org.eclipse.epf.authoring.ui.actions.UserInteractionHandler.java

License:Open Source License

public int selectOne(int[] actions, String title, String msg, IStatus status) {
    final String[] buttonLabels = new String[actions.length];
    for (int i = 0; i < actions.length; i++) {
        buttonLabels[i] = getActionText(actions[i]);
    }/*from ww w.j a  v  a  2s.  com*/
    Image image = null;
    try {
        shell = LibraryUIPlugin.getDefault().getWorkbench().getDisplay().getActiveShell();
        image = shell.getImage();
    } catch (Exception e) {
    }
    if (status == null) {
        MessageDialog msgDlg = new MessageDialog(shell, title, image, msg, MessageDialog.QUESTION, buttonLabels,
                0);
        int id = msgDlg.open();
        return actions[id];
    } else {
        ErrorDialogNoReason dlg = new ErrorDialogNoReason(shell, title, msg, status,
                IStatus.OK | IStatus.INFO | IStatus.WARNING | IStatus.ERROR) {

            protected void createButtonsForButtonBar(Composite parent) {
                // create OK and Details buttons
                for (int i = 0; i < buttonLabels.length; i++) {
                    String label = buttonLabels[i];
                    createButton(parent, i, label, i == 0);
                }
                if (shouldShowDetailsButton()) {
                    detailsButton = createButton(parent, IDialogConstants.DETAILS_ID,
                            IDialogConstants.SHOW_DETAILS_LABEL, false);
                }

            }

            /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.epf.common.serviceability.ErrorDialogNoReason#buttonPressed(int)
             */
            protected void buttonPressed(int id) {
                if (id == IDialogConstants.DETAILS_ID) {
                    super.buttonPressed(id);
                } else {
                    setReturnCode(id);
                    close();
                }
            }
        };
        int id = dlg.open();
        return actions[id];
    }
}

From source file:org.eclipse.equinox.internal.p2.ui.sdk.scheduler.migration.ImportFromInstallationWizard_c.java

License:Open Source License

public boolean performCancel() {
    String[] buttons = new String[] { IDialogConstants.YES_LABEL,
            ProvUIMessages.ImportFromInstallationPag_LATER_BUTTON, IDialogConstants.NO_LABEL };
    MessageDialog dialog = new MessageDialog(getShell(),
            ProvUIMessages.ImportFromInstallationPage_CONFIRMATION_TITLE, null,
            ProvUIMessages.ImportFromInstallationPage_CONFIRMATION_DIALOG, MessageDialog.QUESTION, buttons, 2);

    return rememberCancellationDecision(dialog.open());
}

From source file:org.eclipse.equinox.internal.p2.ui.sdk.scheduler.migration.MigrationWizard.java

License:Open Source License

public boolean performCancel() {
    String[] buttons = new String[] { IDialogConstants.YES_LABEL, ProvUIMessages.MigrationPage_LATER_BUTTON,
            IDialogConstants.NO_LABEL };
    MessageDialog dialog = new MessageDialog(getShell(), ProvUIMessages.MigrationPage_CONFIRMATION_TITLE, null,
            ProvUIMessages.MigrationPage_CONFIRMATION_DIALOG, MessageDialog.QUESTION, buttons, 2);

    return rememberCancellationDecision(dialog.open());
}

From source file:org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor.java

License:Open Source License

public int askUserSaveClose() {
    String title = DiagramUIMessages.DiagramEditor_handleDeleteEvent_dialog_title;
    String message = DiagramUIMessages.DiagramEditor_handleDeleteEvent_dialog_message;
    String[] buttons = { DiagramUIMessages.DiagramEditor_handleDeleteEvent_dialog_button_save,
            DiagramUIMessages.DiagramEditor_handleDeleteEvent_dialog_button_close };
    MessageDialog dialog = new MessageDialog(getSite().getShell(), title, null, message, MessageDialog.QUESTION,
            buttons, 0);//from w ww. ja  v a 2s .  c o  m
    return dialog.open();
}