Package org.openiaml.model.actions

Examples of org.openiaml.model.actions.QuestionDialogResult


        for (EObject element : handler.getConfirmationElements()) {

          final String title = "Generated element is in use";
          final String message = handler.getConfirmationMessage(element) +
            "\n\nDo you wish to continue deleting the selected elements?";
          final QuestionDialogResult answer = new QuestionDialogResult();
         
          Display.getDefault().syncExec(new Runnable() {
              @Override
              public void run() {
                answer.setResult(MessageDialog.openConfirm(null, title, message));
              }
            });

          // if we cancel, we cancel early
          if (!answer.getResult())
            return false;
        }
      }
     
      monitor.subTask("Deleting related elements");
View Full Code Here


   
    // first, run OAW checks to check that the initial model instance is valid
    monitor.subTask("Checking initial model instance");
    CheckModelInstance check = new CheckModelInstance();
    final IStatus result = check.checkModel(model, o.getProject(), new SubProgressMonitor(monitor, 30));
    final QuestionDialogResult answer = new QuestionDialogResult();
   
    if (monitor.isCanceled())
      return Status.CANCEL_STATUS;

    if (!result.isOK()) {
      // log the result
      getDefaultPlugin().log(result);
     
      if (couldBePhantomEdges(result)) {
          // issue 132: automatically suggest the removal of phantom edges
         
        // get user confirmation
        Display.getDefault().syncExec(new Runnable() {
            @Override
            public void run() {
              answer.setResult(MessageDialog.openConfirm(null,
                "Possible phantom edges",
                "It appears that there may be phantom edges in your model:\n\n" +
                  getErrorMessage(result) +
                  "\n\nWould you like to automatically remove these edges?"));
            }
          });
       
        if (answer.getResult()) {
          // remove phantom edges
          RemovePhantomEdgesAction phantom = new RemovePhantomEdgesAction();
          phantom.doExecute(o, new SubProgressMonitor(monitor, 10));
         
          // refresh project
          if (o.getParent() != null) {
            o.getParent().refreshLocal(IFile.DEPTH_ONE, new SubProgressMonitor(monitor, 10));
          }
         
          // and execute again
          return doExecute(o, new SubProgressMonitor(monitor, 80));
        }
         
        }
     
      // get user confirmation
      Display.getDefault().syncExec(new Runnable() {
          @Override
          public void run() {
            answer.setResult(MessageDialog.openConfirm(null,
              "Initial validation failed",
              "An error occured when validating the initial model:\n\n" +
                getErrorMessage(result) +
                "\n\nWould you still like to continue with code generation?"));
          }
        });

      if (!answer.getResult()) {
        // user canceled
        return Status.CANCEL_STATUS;
      }
    }
View Full Code Here

TOP

Related Classes of org.openiaml.model.actions.QuestionDialogResult

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.