Package org.sylfra.idea.plugins.revu.business

Examples of org.sylfra.idea.plugins.revu.business.ReviewManager


    project.getComponent(RevuWorkspaceSettingsComponent.class).addListener(workspaceSettingsListener);
  }

  public void disposeComponent()
  {
    ReviewManager reviewManager = project.getComponent(ReviewManager.class);
    for (Review review : reviewManager.getReviews())
    {
      review.removeIssueListener(issueListener);
    }

    reviewManager.removeReviewListener(reviewListener);

    EditorFactory.getInstance().removeEditorFactoryListener(editorFactoryListener);

    project.getComponent(RevuWorkspaceSettingsComponent.class).removeListener(workspaceSettingsListener);
  }
View Full Code Here


    VirtualFile vFile = fileChooser.selectFileToOpen(
      RevuVfsUtils.findFile(RevuUtils.getWorkspaceSettings(project).getLastSelectedReviewDir()));
    if (vFile != null)
    {
      ReviewManager reviewManager = project.getComponent(ReviewManager.class);
      Review review = reviewManager.getReviewByFile(new File(vFile.getPath()));
      if (review != null)
      {
        Messages.showWarningDialog(project,
          RevuBundle.message("projectSettings.review.import.fileAlreadyExists.text", review.getName()),
          RevuBundle.message("projectSettings.review.import.error.title"));
        return;
      }

      //@TODO check path outside from project
      review = new Review();
      review.setFile(new File(vFile.getPath()));

      if (!reviewManager.load(review, false))
      {
        return;
      }

      if (reviewManager.getReviewByName(review.getName()) != null)
      {
        Messages.showWarningDialog(project,
          RevuBundle.message("projectSettings.review.import.nameAlreadyExists.text", review.getName()),
          RevuBundle.message("projectSettings.review.import.error.title"));
        return;
View Full Code Here

    {
      e.getPresentation().setEnabled(false);
      return;
    }

    ReviewManager reviewManager = project.getComponent(ReviewManager.class);
    Collection<Review> reviews = reviewManager.getReviews(RevuUtils.getCurrentUserLogin(), REVIEWABLE_STATUSES);

    SortedSet<StartReviewAction> actions = new TreeSet<StartReviewAction>();
    for (Review review : reviews)
    {
      if (RevuUtils.hasRole(review, User.Role.REVIEWER))
View Full Code Here

      {
        review.setExtendedReview(null);
      }
      else
      {
        ReviewManager reviewManager = getProject(context).getComponent(ReviewManager.class);
        review.setExtendedReview(reviewManager.getReviewByName(extendedReviewName));
      }
    }

    String status = reader.getAttribute("status");
    String shared = reader.getAttribute("shared");
View Full Code Here

        }
      }

      review.addIssue(issue);

      ReviewManager reviewManager = project.getComponent(ReviewManager.class);
      reviewManager.saveSilently(review);
    }
  }
View Full Code Here

      review.removeIssue(issue);

      reviewsToSave.add(review);
    }

    ReviewManager reviewManager = project.getComponent(ReviewManager.class);
    for (Review review : reviewsToSave)
    {
      reviewManager.saveSilently(review);
    }
  }
View Full Code Here

  public void show(@NotNull Collection<Review> currentReviews, @Nullable Review review)
  {
    currentReview = review;

    ReviewManager reviewManager = project.getComponent(ReviewManager.class);
    java.util.List<Review> reviews = new ArrayList<Review>(
      reviewManager.getReviews(currentReviews, null, ReviewStatus.DRAFT, ReviewStatus.FIXING, ReviewStatus.REVIEWING,
        ReviewStatus._TEMPLATE));

    reviews.remove(review);
    CollectionComboBoxModel cbModel = new CollectionComboBoxModel(reviews, reviews.get(0));
View Full Code Here

  }

  @Override
  protected void doOKAction()
  {
    ReviewManager reviewManager = project.getComponent(ReviewManager.class);

    // Update
    if (currentReview != null)
    {
      // Cyclic link
      Review importedReview = getImportedReview();
      if (importedReview != null)
      {
        try
        {
          reviewManager.checkCyclicLink(currentReview, importedReview);
        }
        catch (RevuException exception)
        {
          String errorTitle = RevuBundle.message("friendlyError.externalizing.cyclicReview.title.text");
          setErrorText(errorTitle);

          StatusBarComponent.showMessageInPopup(project, (new StatusBarMessage(StatusBarMessage.Type.ERROR, errorTitle,
            exception.getMessage())), false);
          return;
        }
      }
    }
    // Creation
    else
    {
      // Name already exists
      if (reviewManager.getReviewByName(tfName.getText()) != null)
      {
        setErrorText(RevuBundle.message("projectSettings.review.importDialog.nameAlreadyExists.text"));
        return;
      }
    }
View Full Code Here

    {
      this.project = project;
      reviews = new ArrayList<Review>(1);
      reviews.add(null);

      ReviewManager reviewManager = project.getComponent(ReviewManager.class);
      reviewManager.addReviewListener(this);
    }
View Full Code Here

   * {@inheritDoc}
   */
  @Override
  protected void apply(Map<Review, Review> items) throws ConfigurationException
  {
    ReviewManager reviewManager = project.getComponent(ReviewManager.class);
    List<Review> originalReviews = getOriginalItems();

    // Manage existing reviews
    List<String> projectReviewFiles = new ArrayList<String>();
    List<String> workspaceReviewFiles = new ArrayList<String>();
    for (Map.Entry<Review, Review> entry : items.entrySet())
    {
      Review editedReview = entry.getKey();
      Review originalReview = entry.getValue();
      if (editedReview.isEmbedded())
      {
        continue;
      }

      String reviewFilePath = RevuVfsUtils.buildRelativePath(project, editedReview.getFile());

      if (editedReview.isShared())
      {
        projectReviewFiles.add(reviewFilePath);
      }
      else
      {
        workspaceReviewFiles.add(reviewFilePath);
      }

      // No change
      if ((originalReview != null) && (originalReview.equals(editedReview)))
      {
        continue;
      }

      // Change original review to avoid handling an obsolete instance
      if (originalReview == null)
      {
        originalReview = editedReview;
      }
      else
      {
        originalReview.copyFromTemplate(editedReview);
      }

      try
      {
        reviewManager.save(originalReview);
      }
      catch (Exception e)
      {
        LOGGER.warn(e);
        final String details = ((e.getLocalizedMessage() == null) ? e.toString() : e.getLocalizedMessage());
        throw new ConfigurationException(
          RevuBundle.message("projectSettings.error.save.title.text", originalReview.getName(), details),
          RevuBundle.message("general.plugin.title"));
      }
    }

    // Delete obsolete reviews
    for (Review review : originalReviews)
    {
      if (!items.containsValue(review))
      {
        reviewManager.removeReview(review);
      }
    }

    RevuProjectSettingsComponent projectSettingsComponent =
      project.getComponent(RevuProjectSettingsComponent.class);
View Full Code Here

TOP

Related Classes of org.sylfra.idea.plugins.revu.business.ReviewManager

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.