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

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


    if (project == null)
    {
      return;
    }

    Review reviewingReview = RevuUtils.getReviewingReview(project);
    if (reviewingReview != null)
    {
      e.getPresentation().setEnabled(false);
      return;
    }
View Full Code Here


    super.reset();

    // Change extended reviews so the point to clones
    for (Review review : originalItemsMap.keySet())
    {
      Review extendedReview = review.getExtendedReview();
      if (extendedReview != null)
      {
        review.setExtendedReview(retrieveCloneItem(extendedReview));
      }
    }
View Full Code Here

    }

    Set<Review> reviewsToSave = new HashSet<Review>();
    for (Issue issue : issues)
    {
      Review review = issue.getReview();
      review.removeIssue(issue);

      reviewsToSave.add(review);
    }

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

    // 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;
      }

      if (editedReview.isExternalizable())
      {
        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
View Full Code Here

    {
      enabled = false;
    }
    else
    {
      Review review = currentIssue.getReview();
      User user = RevuUtils.getCurrentUser(review);
      enabled = (user != null) &&
        (RevuUtils.isActive(review) && user.hasRole(User.Role.REVIEWER) || (user.hasRole(User.Role.ADMIN)));
    }
View Full Code Here

    return project.getComponent(ReviewManager.class).getReviews();
  }

  private void execute(CreateReviewDialog dialog, RevuProjectSettingsForm form)
  {
    Review review = new Review();
    review.setStatus(ReviewStatus.DRAFT);
    review.setFile(dialog.getReviewFile());
    review.setName(dialog.getReviewName());
    review.setShared(shared);
    switch (dialog.getImportType())
    {
      case COPY:
        // Copy only referential
        review.getDataReferential().copyFrom(dialog.getImportedReview().getDataReferential());
        break;
      case LINK:
        review.setExtendedReview(dialog.getImportedReview());
        break;
    }

    User currentUser = RevuUtils.getCurrentUser();
    if (currentUser != null)
    {
      User reviewCurrentUser = review.getDataReferential().getUser(currentUser.getLogin(), false);
      if (reviewCurrentUser == null)
      {
        for (User.Role role : User.Role.values())
        {
          currentUser.addRole(role);
        }
        review.getDataReferential().addUser(currentUser);
      }
      else
      {
        if (!reviewCurrentUser.hasRole(User.Role.ADMIN))
        {
          reviewCurrentUser.addRole(User.Role.ADMIN);
        }
      }
    }

    History history = new History();
    Date now = new Date();
    history.setCreatedBy(currentUser);
    history.setCreatedOn(now);
    history.setLastUpdatedBy(currentUser);
    history.setLastUpdatedOn(now);
    review.setHistory(history);

    if (fromChangeList != null)
    {
      review.getFileScope().setVcsAfterRev(String.valueOf(fromChangeList.getNumber()));
    }
   
    form.addItem(review);
  }
View Full Code Here

            RevuBundle.message("projectSettings.review.shareWithPrivateLink.text", extendedReview.getName()),
            RevuBundle.message("projectSettings.confirmRemoveReview.title"),
            Messages.getWarningIcon());
          if (result == DialogWrapper.OK_EXIT_CODE)
          {
            Review tmpReview = extendedReview;
            while (tmpReview != null)
            {
              tmpReview.setShared(true);
              tmpReview = tmpReview.getExtendedReview();
            }
          }
        }
      }
    });

    bnImport.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        Review currentReview = new Review();
        internalUpdateData(currentReview);

        if (extendedReview == null)
        {
          CreateReviewDialog dialog = new CreateReviewDialog(project, false);
          dialog.show(editedReviews, currentReview);
          if (!dialog.isOK())
          {
            return;
          }

          switch (dialog.getImportType())
          {
            case COPY:
              currentReview.getDataReferential().copyFrom(dialog.getImportedReview().getDataReferential());
              break;
            case LINK:
              extendedReview = dialog.getImportedReview();
              currentReview.setExtendedReview(extendedReview);
              break;
          }

          updateUI(currentReview, currentReview, true);
        }
        else
        {
          extendedReview = null;
          currentReview.setExtendedReview(null);
          updateUI(currentReview, currentReview, true);
        }
      }
    });
View Full Code Here

      nameAlreadyExists = false;
    }
    else
    {
      ReviewManager reviewManager = project.getComponent(ReviewManager.class);
      Review review = reviewManager.getReviewByName(tfName.getText());
      nameAlreadyExists = ((review != null)
        && review.isExternalizable()
        && data.isExternalizable()
        && (!FileUtil.filesEqual(review.getFile(), data.getFile())));
    }
   
    updateError(tfName, nameAlreadyExists,
      RevuBundle.message("projectSettings.review.importDialog.nameAlreadyExists.text"));
View Full Code Here

    if ((project == null) || (liReviews == null))
    {
      return;
    }

    Review review = (Review) liReviews.getSelectedValue();
    if (!review.isExternalizable())
    {
      String errorTitle = RevuBundle.message("friendlyError.notExternalizableReview.title.text", review.getName());
      String errorDetails = RevuBundle.message("friendlyError.notExternalizableReview.details.details.text", review.getName());
      StatusBarComponent.showMessageInPopup(project, new StatusBarMessage(StatusBarMessage.Type.ERROR, errorTitle, errorDetails), true);
      return;
    }

    ExportDialog exportDialog = new ExportDialog(project);
    exportDialog.show(review);
    if (!exportDialog.isOK())
    {
      return;
    }

    File f = exportDialog.getFile();
    if (f != null)
    {
      try
      {
        project.getComponent(IReviewExternalizer.class).save(review, f);
      }
      catch (Exception ex)
      {
        LOGGER.warn("Failed to close exported review file", ex);
        String errorTitle = RevuBundle.message("friendlyError.exportFailed.title.text", review.getName());
        String errorDetails = RevuBundle.message("friendlyError.externalizing.save.error.details.text",
          f.getPath(), ex.getMessage());
        StatusBarComponent.showMessageInPopup(project, (new StatusBarMessage(StatusBarMessage.Type.ERROR, errorTitle,
          errorDetails)), false);
      }
View Full Code Here

        // Check that reviewingReviewName matches an existing review
        String reviewingReviewName = workspaceSettings.getReviewingReviewName();
        if (reviewingReviewName != null)
        {
          Review review = getReviewByName(reviewingReviewName);
          if ((review == null) || (!ReviewStatus.REVIEWING.equals(review.getStatus())))
          {
            workspaceSettings.setReviewingReviewName(null);
            project.getComponent(RevuWorkspaceSettingsComponent.class).loadState(workspaceSettings);
          }
        }
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.