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

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

Introduction

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

Prototype

String NO_LABEL

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

Click Source Link

Document

The label for no buttons.

Usage

From source file:org.eclipse.egit.ui.view.repositories.GitRepositoriesViewRepoHandlingTest.java

License:Open Source License

@Test
public void testRemoveRepositoryWithProjectsNo() throws Exception {
    deleteAllProjects();//from   w ww .j a va2 s .  com
    assertProjectExistence(PROJ1, false);
    clearView();
    Activator.getDefault().getRepositoryUtil().addConfiguredRepository(repositoryFile);
    shareProjects(repositoryFile);
    assertProjectExistence(PROJ1, true);
    refreshAndWait();
    assertHasRepo(repositoryFile);
    SWTBotTree tree = getOrOpenView().bot().tree();
    tree.getAllItems()[0].select();
    ContextMenuHelper.clickContextMenu(tree, myUtil.getPluginLocalizedValue("RemoveRepositoryCommand"));
    SWTBotShell shell = bot.shell(UIText.RepositoriesView_ConfirmProjectDeletion_WindowTitle);
    shell.activate();
    shell.bot().button(IDialogConstants.NO_LABEL).click();
    refreshAndWait();
    assertEmpty();
    assertProjectExistence(PROJ1, true);
}

From source file:org.eclipse.emf.cdo.internal.ui.actions.CloseSessionAction.java

License:Open Source License

@Override
protected void preRun() throws Exception {
    if (CDOUtil.isSessionDirty(getSession())) {
        MessageDialog dialog = new MessageDialog(getShell(), TITLE, null,
                Messages.getString("CloseSessionAction.2"), //$NON-NLS-1$
                MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                        IDialogConstants.CANCEL_LABEL },
                0);/*from   w w w.java 2  s . c o m*/
        if (dialog.open() != MessageDialog.OK) {
            cancel();
        }
    }
}

From source file:org.eclipse.emf.cdo.internal.ui.actions.CloseViewAction.java

License:Open Source License

@Override
protected void preRun() throws Exception {
    if (getView().isDirty()) {
        MessageDialog dialog = new MessageDialog(getShell(), TITLE, null,
                Messages.getString("CloseViewAction.2"), //$NON-NLS-1$
                MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                        IDialogConstants.CANCEL_LABEL },
                0);// w  ww  . ja v a  2  s  .  c  om
        if (dialog.open() != MessageDialog.OK) {
            cancel();
        }
    }
}

From source file:org.eclipse.emf.cdo.ui.internal.admin.actions.DeleteRepositoryAction.java

License:Open Source License

@Override
protected void preRun() throws Exception {
    final int NO_BUTTON = 1;
    String message = MessageFormat.format(Messages.DeleteRepositoryAction_4, target.getName());
    MessageDialog dlg = new MessageDialog(getShell(), getText(), null, message, MessageDialog.WARNING,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, NO_BUTTON);
    if (dlg.open() == NO_BUTTON) {
        cancel();/*from w  ww  .j  a  v  a  2 s.c om*/
    }
}

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

License:Open Source License

/**
 * Return action text//from   w  ww.  j a  v a2 s.  c o  m
 * 
 * @param action
 * @return Action text - either ABORT, CANCEL, OK, RETRY
 */
public static String getActionText(int action) {
    switch (action) {
    case IUserInteractionHandler.ACTION_ABORT:
        return IDialogConstants.ABORT_LABEL;
    case IUserInteractionHandler.ACTION_CANCEL:
        return IDialogConstants.CANCEL_LABEL;
    case IUserInteractionHandler.ACTION_OK:
        return IDialogConstants.OK_LABEL;
    case IUserInteractionHandler.ACTION_RETRY:
        return IDialogConstants.RETRY_LABEL;
    case IUserInteractionHandler.ACTION_YES:
        return IDialogConstants.YES_LABEL;
    case IUserInteractionHandler.ACTION_NO:
        return IDialogConstants.NO_LABEL;
    default:
        break;
    }
    return null;
}

From source file:org.eclipse.epf.common.serviceability.WrappedMessageDialog.java

License:Open Source License

public static boolean openQuestion(Shell parent, String title, String message) {
    WrappedMessageDialog dialog = new WrappedMessageDialog(parent, title, null, // accept
            // the
            // default
            // window
            // icon
            message, QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); // yes is the
    // default//from ww w  .j  a v  a2s  .co  m
    return dialog.open() == 0;
}

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.render.actions.CopyToImageAction.java

License:Open Source License

/**
 * Displays the dialog and performs <code>OutOfMemoryError</code> checking
 * /* w w w .  j  a v a  2 s  .  co  m*/
 * @param dialog the copy to image dialog
 */
private void runCopyToImageUI(CopyToImageDialog dialog) {
    if (dialog.open() == CopyToImageDialog.CANCEL) {
        return;
    }

    if (!overwriteExisting()) {
        return;
    }

    Trace.trace(DiagramUIRenderPlugin.getInstance(), "Copy Diagram to " + dialog.getDestination().toOSString() //$NON-NLS-1$
            + " as " + dialog.getImageFormat().toString()); //$NON-NLS-1$

    final MultiStatus status = new MultiStatus(DiagramUIRenderPlugin.getPluginId(),
            DiagramUIRenderStatusCodes.OK, DiagramUIRenderMessages.CopyToImageAction_Label, null);

    IRunnableWithProgress runnable = createRunnable(status);

    ProgressMonitorDialog progressMonitorDialog = new ProgressMonitorDialog(
            Display.getCurrent().getActiveShell());
    try {
        progressMonitorDialog.run(false, true, runnable);
    } catch (InvocationTargetException e) {
        Log.warning(DiagramUIRenderPlugin.getInstance(), DiagramUIRenderStatusCodes.IGNORED_EXCEPTION_WARNING,
                e.getTargetException().getMessage(), e.getTargetException());

        if (e.getTargetException() instanceof OutOfMemoryError) {
            if (dialog.exportToHTML()) {
                openErrorDialog(DiagramUIRenderMessages.CopyToImageAction_outOfMemoryMessage);
            } else {
                if (new MessageDialog(dialog.getShell(),
                        DiagramUIRenderMessages.CopyToImageOutOfMemoryDialog_title, null,
                        DiagramUIRenderMessages.CopyToImageOutOfMemoryDialog_message, MessageDialog.ERROR,
                        new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0)
                                .open() == 0) {
                    runCopyToImageUI(dialog);
                }
            }
        } else if (e.getTargetException() instanceof SWTError) {
            /**
             * SWT returns an out of handles error when processing large
             * diagrams
             */
            if (dialog.exportToHTML()) {
                openErrorDialog(DiagramUIRenderMessages.CopyToImageAction_outOfMemoryMessage);
            } else {
                if (new MessageDialog(dialog.getShell(),
                        DiagramUIRenderMessages.CopyToImageOutOfMemoryDialog_title, null,
                        DiagramUIRenderMessages.CopyToImageOutOfMemoryDialog_message, MessageDialog.ERROR,
                        new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0)
                                .open() == 0) {
                    runCopyToImageUI(dialog);
                }
            }
        } else {
            openErrorDialog(e.getTargetException().getMessage());
        }
        return;
    } catch (InterruptedException e) {
        /* the user pressed cancel */
        Log.warning(DiagramUIRenderPlugin.getInstance(), DiagramUIRenderStatusCodes.IGNORED_EXCEPTION_WARNING,
                e.getMessage(), e);
    }

    if (!status.isOK()) {
        openErrorDialog(status.getChildren()[0].getMessage());
    }
}

From source file:org.eclipse.jdt.apt.ui.internal.preferences.BaseConfigurationBlock.java

License:Open Source License

/**
 * If there are changed settings, save them and ask user whether to rebuild.
 * This is called by performOk() and performApply().
 * @param container null when called from performApply().
 * @return false to abort exiting the preference pane.
 *///w w  w . j  a  va2s. c om
protected boolean processChanges(IWorkbenchPreferenceContainer container) {

    boolean projectSpecificnessChanged = false;
    boolean isProjectSpecific = (fProject != null) && fBlockControl.getEnabled();
    if (fOriginallyHadProjectSettings ^ isProjectSpecific) {
        // the project-specificness changed.
        projectSpecificnessChanged = true;
    } else if ((fProject != null) && !isProjectSpecific) {
        // no project specific data, and there never was, and this
        // is a project preferences pane, so nothing could have changed.
        return true;
    }

    if (!projectSpecificnessChanged && !settingsChanged(fLookupOrder[0])) {
        return true;
    }

    int response = 1; // "NO" rebuild unless we put up the dialog.
    String[] strings = getFullBuildDialogStrings(fProject == null);
    if (strings != null) {
        MessageDialog dialog = new MessageDialog(
                getShell(), strings[0], null, strings[1], MessageDialog.QUESTION, new String[] {
                        IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL },
                2);
        response = dialog.open();
    }
    if (response == 0 || response == 1) { // "YES" or "NO" - either way, save.
        saveSettings();
        if (container == null) {
            // we're doing an Apply, so update the reference values.
            cacheOriginalValues();
        }
    }
    if (response == 0) { // "YES", rebuild
        if (container != null) {
            // build after dialog exits
            container.registerUpdateJob(CoreUtility.getBuildJob(fProject));
        } else {
            // build immediately
            CoreUtility.getBuildJob(fProject).schedule();
        }
    } else if (response != 1) { // "CANCEL" - no save, no rebuild.
        return false;
    }
    return true;
}