Example #1
0
  /**
   * Fetches all specified roots. Once a root has failed, stops and displays the notification. If
   * needed, displays the successful notification at the end.
   *
   * @param roots roots to fetch.
   * @param errorNotificationTitle if specified, this notification title will be used instead of the
   *     standard "Fetch failed". Use this when fetch is a part of a compound process.
   * @param notifySuccess if set to {@code true} successful notification will be displayed.
   * @return true if all fetches were successful, false if at least one fetch failed.
   */
  public boolean fetchRootsAndNotify(
      @NotNull Collection<GitRepository> roots,
      @Nullable String errorNotificationTitle,
      boolean notifySuccess) {
    Map<VirtualFile, String> additionalInfo = new HashMap<VirtualFile, String>();
    for (GitRepository repository : roots) {
      LOG.info("fetching " + repository);
      GitFetchResult result = fetch(repository);
      String ai = result.getAdditionalInfo();
      if (!StringUtil.isEmptyOrSpaces(ai)) {
        additionalInfo.put(repository.getRoot(), ai);
      }
      if (!result.isSuccess()) {
        Collection<Exception> errors = new ArrayList<Exception>(getErrors());
        errors.addAll(result.getErrors());
        displayFetchResult(myProject, result, errorNotificationTitle, errors);
        return false;
      }
    }
    if (notifySuccess) {
      GitUIUtil.notifySuccess(myProject, "", "Fetched successfully");
    }

    String addInfo = makeAdditionalInfoByRoot(additionalInfo);
    if (!StringUtil.isEmptyOrSpaces(addInfo)) {
      Notificator.getInstance(myProject)
          .notify(
              GitVcs.MINOR_NOTIFICATION, "Fetch details", addInfo, NotificationType.INFORMATION);
    }

    return true;
  }
Example #2
0
  public void runItems() throws IOException {
    screenMessage.printMessage(
        "Please enter the title of the book you would like to reserve : \n>>");

    InputReader inputReader = new InputReader();
    String reservingTitle = inputReader.readUserInputString();

    reserveBook(reservingTitle);
  }
 @Override
 public void onStart(Intent intent, int startId) {
   alarm.SetNotifications(this);
 }
 @Override
 public int onStartCommand(Intent intent, int flags, int startId) {
   alarm.SetNotifications(this);
   return START_STICKY;
 }