Package org.sylfra.idea.plugins.revu.model

Examples of org.sylfra.idea.plugins.revu.model.Review


    metaReviews.put(review, new MetaReview(review, -1, false));
  }

  public void removeReview(@NotNull Review review)
  {
    Review oldReview = reviewsByFiles.remove(review.getFile());
    reviewsByNames.remove(review.getName());
    metaReviews.remove(oldReview);

    fireReviewDeleted(review);
  }
View Full Code Here


    reviewsByFiles.clear();
    metaReviews.clear();

    for (Map.Entry<File, String> entry : EMBEDDED_REVIEWS.entrySet())
    {
      Review review = new Review();
      review.setFile(entry.getKey());
      review.setEmbedded(true);
      load(review, false);
      addReview(review);
    }
  }
View Full Code Here

    {
      // Delete obsolete reviews
      Collection<Review> reviews = new HashSet<Review>(getReviews());
      for (Iterator<Review> it = reviews.iterator(); it.hasNext();)
      {
        Review review = it.next();
        if ((review.isEmbedded()) || (review.isShared() != sharedFilter))
        {
          continue;
        }
        if (review.isExternalizable()) {
          String filePath = RevuVfsUtils.buildRelativePath(project, review.getFile());
          if (filePaths.contains(filePath)) {
            changedReviews.put(filePath, review);
          } else {
            fireReviewDeleted(review);
          }
        }
        Review oldReview = reviewsByFiles.remove(review.getFile());
        reviewsByNames.remove(review.getName());
        metaReviews.remove(oldReview);
        it.remove();
      }
    }
View Full Code Here

  {
    Map<String, ReviewExtendedDepth> reviewByNames = new HashMap<String, ReviewExtendedDepth>(relativePaths.size());
    for (String relativePath : relativePaths)
    {
      File file = RevuVfsUtils.findFileFromRelativePath(project, relativePath);
      Review review = reviewsByFiles.get(file);
      if (review == null)
      {
        review = new Review();
        review.setFile(file);
      }

      if (load(review, true))
      {
        ReviewExtendedDepth reviewExtendedDepth = new ReviewExtendedDepth(review, 0);
        reviewByNames.put(review.getName(), reviewExtendedDepth);
      }
    }

    List<ReviewExtendedDepth> reviewExtendedDepths = new ArrayList<ReviewExtendedDepth>(reviewByNames.values());
    for (ReviewExtendedDepth reviewExtendedDepth : reviewExtendedDepths)
    {
      Review review = reviewExtendedDepth.review;
      if (review.getExtendedReview() != null)
      {
        try
        {
          checkCyclicLink(review, review.getExtendedReview());
        }
        catch (RevuException e)
        {
          LOGGER.warn("Cyclic link: " + review.getFile(), e);
          fireReviewLoadFailed(e, review.getFile());
        }

        while ((review != null) && (review.getExtendedReview() != null))
        {
          reviewExtendedDepth.depth++;
          review = reviewsByNames.get(review.getExtendedReview().getName());
        }
      }
    }

    Collections.sort(reviewExtendedDepths, new Comparator<ReviewExtendedDepth>()
View Full Code Here

        RevuBundle.message("friendlyError.externalizing.cyclicReview.details.text",
          main.getFile(), main.getName(),
          extendedRoot.getFile(), extendedRoot.getName()));
    }

    Review extendedChild2;
    while ((extendedChild2 = extendedChild.getExtendedReview()) != null)
    {
      checkCyclicLink(main, extendedRoot, extendedChild2);
    }
  }
View Full Code Here

        @Override
        public void contentsChanged(VirtualFileEvent event)
        {
          VirtualFile vFile = event.getFile();

          Review review = reviewManager.getReviewByFile(new File(vFile.getPath()));
          if ((review != null)
            && (vFile.getTimeStamp() > reviewManager.getLastSavedTStamp(review))
            && (!reviewManager.isSaving(review)))
          {
            if (Messages.showOkCancelDialog(project,
              RevuBundle.message("general.reviewFileChanged.text", review.getName()),
              RevuBundle.message("general.reviewFileChanged.title"),
              Messages.getWarningIcon()) == DialogWrapper.OK_EXIT_CODE)
            {
              reviewManager.load(review, false);
              reviewManager.fireReviewChanged(review);
            }
          }
        }

        @Override
        public void fileDeleted(VirtualFileEvent event)
        {
          VirtualFile vFile = event.getFile();
          Review review = reviewManager.getReviewByFile(new File(vFile.getPath()));
          if (review != null)
          {
            reviewManager.removeReview(review);
          }
        }
View Full Code Here

      messageBusConnection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, fileDocumentManagerListener);
    }

    private void pathChanged(VirtualFile vFile, String oldPath)
    {
      Review review = reviewManager.getReviewByFile(new File(oldPath));
      if (review != null)
      {
        reviewManager.reviewFileChanged(review, vFile);
      }
    }
View Full Code Here

    return true;
  }

  protected boolean isHabilitedToEditReview(@Nullable T data, User user)
  {
    Review enclosingReview = getEnclosingReview(data);

    return (enclosingReview != null) && (!enclosingReview.isEmbedded())
      && (user != null) && (user.hasRole(User.Role.ADMIN));
  }
View Full Code Here

    if ((filePath == null) || (!vcs.fileIsUnderVcs(filePath)))
    {
      return;
    }

    Review review = RevuUtils.getReviewingReview(project);

    VcsRevisionNumber revision;
    if (review.getFileScope().getVcsAfterRev() != null)
    {
      try
      {
        revision = vcs.parseRevisionNumber(review.getFileScope().getVcsAfterRev());
      }
      catch (VcsException ex)
      {
        LOGGER.error("Failed to parse VCS revision: " + review.getFileScope().getVcsAfterRev());
        return;
      }
    }
    else
    {
View Full Code Here

    if (project == null)
    {
      return;
    }

    Review review = RevuUtils.getReviewingReview(project);
    if (review == null)
    {
      e.getPresentation().setText(RevuBundle.message("reviewing.comparewith.template.text"));
      e.getPresentation().setEnabled(false);
    }
    else
    {
      e.getPresentation().setText(RevuBundle.message("reviewing.comparewith.review.text", review.getName()));
      VirtualFile vFile = e.getData(PlatformDataKeys.VIRTUAL_FILE);
      e.getPresentation().setEnabled((vFile != null)
        && RevuVcsUtils.isUnderVcs(project, vFile)
        && fileScopeManager.belongsToScope(project, review, vFile));
    }
View Full Code Here

TOP

Related Classes of org.sylfra.idea.plugins.revu.model.Review

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.