Package org.eclipse.jface.dialogs

Examples of org.eclipse.jface.dialogs.MessageDialog


        Repository repository = ServerUtil.getDefaultRepository(node.getProject());
        NodeTypeRegistry ntManager = (repository==null) ? null : repository.getNodeTypeRegistry();
        if (ntManager == null) {
           
            if (!doNotAskAgain) {
                MessageDialog dialog = new MessageDialog(null,  "Unable to validate node type", null,
                        "Unable to validate node types since project " + node.getProject().getName() + " is not associated with a server or the server is not started.",
                        MessageDialog.QUESTION_WITH_CANCEL,
                        new String[] {"Cancel", "Continue (do not ask again)", "Continue"}, 1) {
                    @Override
                    protected void configureShell(Shell shell) {
                        super.configureShell(shell);
                        setShellStyle(getShellStyle() | SWT.SHEET);
                    }
                };
                int choice = dialog.open();
                if (choice <= 0) {
                    return;
                }
                if (choice==1) {
                    doNotAskAgain = true;
View Full Code Here


            // Check whether file exists and if so, confirm overwrite
            final File externalFile = new File( path );
            if ( externalFile.exists() )
            {
                MessageDialog overwriteDialog = new MessageDialog( shell,
                    Messages.getString( "LdifEditor.Overwrite" ), null, Messages.getString( "OverwriteQuestion" ), //$NON-NLS-1$ //$NON-NLS-2$
                    MessageDialog.WARNING, new String[]
                        { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1 ); // 'No' is the default
                if ( overwriteDialog.open() != Window.OK )
                {
                    if ( progressMonitor != null )
                    {
                        progressMonitor.setCanceled( true );
                        return;
View Full Code Here

    // a syncExec because operation approval notifications may come from
    // a background thread.
    final int[] answer = new int[1];
    Workbench.getInstance().getDisplay().syncExec(new Runnable() {
      public void run() {
        MessageDialog dialog = new MessageDialog(part.getSite().getShell(), part.getEditorInput().getName(),
            null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.OK_LABEL,
                            discardButton, IDialogConstants.CANCEL_LABEL }, 0); // yes is the default
            answer[0] = dialog.open();
    }});
    switch (answer[0]) {
    case 0:
      return Status.OK_STATUS;
    case 1:
View Full Code Here

     * Save a singleton over itself.
     */
    private void saveSingleton(IWorkbenchPage page) {
        String[] buttons = new String[] { IDialogConstants.OK_LABEL,
                IDialogConstants.CANCEL_LABEL };
        MessageDialog d = new MessageDialog(page.getWorkbenchWindow().getShell(),
                WorkbenchMessages.SavePerspective_overwriteTitle,
                null, WorkbenchMessages.SavePerspective_singletonQuestion,
                MessageDialog.QUESTION, buttons, 0);
        if (d.open() == 0) {
            page.savePerspective();
        }
    }
View Full Code Here

   * @param message
   *            the question to ask
   * @return <code>true</code> for Yes, and <code>false</code> for No
   */
  protected boolean queryYesNoQuestion(String message) {
    MessageDialog dialog = new MessageDialog(getContainer().getShell(),
        PreferencesMessages.Question, (Image) null, message,
        MessageDialog.NONE, new String[] { IDialogConstants.YES_LABEL,
            IDialogConstants.NO_LABEL }, 0);
    // ensure yes is the default

    return dialog.open() == 0;
  }
View Full Code Here

              PreferencesMessages.WizardDataTransfer_overwriteNameAndPathQuestion,
              path.lastSegment(), path.removeLastSegments(1)
                  .toOSString());
    }

    final MessageDialog dialog = new MessageDialog(getContainer()
        .getShell(), PreferencesMessages.Question, null, messageString,
        MessageDialog.QUESTION, new String[] {
            IDialogConstants.YES_LABEL,
            IDialogConstants.YES_TO_ALL_LABEL,
            IDialogConstants.NO_LABEL,
            IDialogConstants.NO_TO_ALL_LABEL,
            IDialogConstants.CANCEL_LABEL }, 0);
    String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL };
    // run in syncExec because callback is from an operation,
    // which is probably not running in the UI thread.
    getControl().getDisplay().syncExec(new Runnable() {
      public void run() {
        dialog.open();
      }
    });
    return dialog.getReturnCode() < 0 ? CANCEL : response[dialog
        .getReturnCode()];
  }
View Full Code Here

      }

      String message = NLS.bind(warning, new Object[] { status.getMessage(), operation.getLabel() });
      String[] buttons = new String[] { IDialogConstants.YES_LABEL,
          IDialogConstants.NO_LABEL };
      MessageDialog dialog = new MessageDialog(shell, title, null,
          message, MessageDialog.WARNING, buttons, 0);
      int dialogAnswer = dialog.open();
      // The user has been given the specific status and has chosen
      // to proceed or to cancel. The user choice determines what
      // the status should be at this point, OK or CANCEL.
      if (dialogAnswer == Window.OK) {
        reportedStatus = Status.OK_STATUS;
      } else {
        reportedStatus = Status.CANCEL_STATUS;
      }
    } else {
      String title, stopped;
      switch (doing) {
      case UNDOING:
        title = WorkbenchMessages.Operations_undoProblem;
        stopped = WorkbenchMessages.Operations_stoppedOnUndoErrorStatus;
        break;
      case REDOING:
        title = WorkbenchMessages.Operations_redoProblem;
        stopped = WorkbenchMessages.Operations_stoppedOnRedoErrorStatus;
        break;
      default: // EXECUTING
        title = WorkbenchMessages.Operations_executeProblem;
        stopped = WorkbenchMessages.Operations_stoppedOnExecuteErrorStatus;

        break;
      }

      // It is an error condition. The user has no choice to proceed, so
      // we only report what has gone on. We use a warning icon instead of
      // an error icon since there has not yet been a failure.

      String message = NLS.bind(stopped, status.getMessage(), operation
          .getLabel());

      MessageDialog dialog = new MessageDialog(shell, title, null,
          message, MessageDialog.WARNING,
          new String[] { IDialogConstants.OK_LABEL }, 0); // ok
      dialog.open();
    }

    if (createdShell) {
      shell.dispose();
    }
View Full Code Here

        }
        if (choice == USER_RESPONSE || choice == ISaveablePart2.DEFAULT) {
          String message = NLS.bind(WorkbenchMessages.EditorManager_saveChangesQuestion, part.getTitle());
          // Show a dialog.
          String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL };
            MessageDialog d = new MessageDialog(
              window.getShell(), WorkbenchMessages.Save_Resource,
              null, message, MessageDialog.QUESTION, buttons, 0);
          choice = d.open();
        }
      }

      // Branch on the user choice.
      // The choice id is based on the order of button labels above.
View Full Code Here


    private void askUpdateSharedWorkingCopy( IWorkbenchPartReference partRef, IEntry originalEntry,
        IEntry oscSharedWorkingCopy, Object source )
    {
        MessageDialog dialog = new MessageDialog( partRef.getPart( false ).getSite().getShell(), Messages
            .getString( "EntryEditorManager.EntryChanged" ), null, Messages //$NON-NLS-1$
            .getString( "EntryEditorManager.EntryChangedDescription" ), MessageDialog.QUESTION, new String[] //$NON-NLS-1$
            { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0 );
        int result = dialog.open();
        if ( result == 0 )
        {
            // update reference copy and working copy
            updateOscSharedReferenceCopy( originalEntry );
            updateOscSharedWorkingCopy( originalEntry );
View Full Code Here

        String testPassword = testPasswordText.getText();
        if ( currentPassword != null )
        {
            if ( currentPassword.verify( testPassword ) )
            {
                MessageDialog dialog = new MessageDialog(
                    getShell(),
                    Messages.getString( "PasswordDialog.PasswordVerification" ), getShell().getImage(), //$NON-NLS-1$
                    Messages.getString( "PasswordDialog.PasswordVerifiedSuccessfully" ), MessageDialog.INFORMATION, new String[] //$NON-NLS-1$
                        { IDialogConstants.OK_LABEL }, 0 );
                dialog.open();
            }
            else
            {
                MessageDialog dialog = new MessageDialog(
                    getShell(),
                    Messages.getString( "PasswordDialog.PasswordVerification" ), getShell().getImage(), //$NON-NLS-1$
                    Messages.getString( "PasswordDialog.PasswordVerificationFailed" ), MessageDialog.ERROR, new String[] //$NON-NLS-1$
                        { IDialogConstants.OK_LABEL }, 0 );
                dialog.open();
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.dialogs.MessageDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.