Esempio n. 1
0
  private static int promptUserMutlipleChoices(ConflictManagerExternal conflictManager)
      throws OseeCoreException {
    boolean isAllConflictsResolved = !conflictManager.remainingConflictsExist();
    Messages = constructMessage(conflictManager, isAllConflictsResolved);
    Choices = constructChoices(conflictManager, isAllConflictsResolved);
    final MutableInteger result = new MutableInteger(CANCEL);

    Displays.pendInDisplayThread(
        new Runnable() {
          @Override
          public void run() {
            MessageDialog dialog =
                new MessageDialog(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                    TITLE,
                    null,
                    Messages,
                    MessageDialog.QUESTION,
                    Choices,
                    CANCEL);
            result.setValue(dialog.open());
          }
        });

    if (!isAllConflictsResolved) { // Since all conflicts were not resolved, options start with
                                   // Launch Merge Manager(1) instead of Commit(0)
      result.getValueAndInc();
    }

    return result.getValue();
  }
 public static IStatus runIt(
     IProgressMonitor monitor,
     String jobName,
     Collection<TeamWorkFlowArtifact> teamArts,
     IAttributeType attributeType) {
   XResultData rd = new XResultData();
   try {
     if (teamArts.isEmpty()) {
       throw new OseeStateException("No Actions/Workflows Specified");
     }
     retrieveData(monitor, teamArts, attributeType, rd);
     if (rd.toString().equals("")) {
       rd.log("No Problems Found");
     }
     final String html =
         XResultDataUI.getReport(rd, jobName)
             .getManipulatedHtml(Arrays.asList(Manipulations.NONE));
     final String title = jobName;
     Displays.pendInDisplayThread(
         new Runnable() {
           @Override
           public void run() {
             Result result = new HtmlExportTable(title, html, true, false).exportCsv();
             if (result.isFalse()) {
               AWorkbench.popup(result);
               return;
             }
             AWorkbench.popup(
                 title,
                 "Completed "
                     + title
                     + "\n\nFile saved to "
                     + System.getProperty("user.home")
                     + File.separator
                     + "table.csv");
           }
         });
     monitor.done();
     return Status.OK_STATUS;
   } catch (Exception ex) {
     OseeLog.log(Activator.class, Level.SEVERE, ex);
     return new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Failed", ex);
   }
 }
Esempio n. 3
0
  private static boolean promptUser(Branch sourceBranch, List<Branch> destinationBranches)
      throws OseeCoreException {
    final MutableBoolean isUserSure = new MutableBoolean(false);
    final String message = constructConfirmMessage(sourceBranch, destinationBranches);

    Displays.pendInDisplayThread(
        new Runnable() {
          @Override
          public void run() {
            isUserSure.setValue(
                MessageDialog.openConfirm(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                    "Delete Merge Branch",
                    message));
          }
        });

    return isUserSure.booleanValue();
  }