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

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


public class ShowFileScopeAction extends AnAction
{
  public void actionPerformed(AnActionEvent e)
  {
    Project project = e.getData(DataKeys.PROJECT);
    Review review = e.getData(RevuDataKeys.REVIEW);

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

    ProjectViewSelectInTarget.select(project, this, RevuProjectViewPane.ID, review.getName(), null, true);
  }
View Full Code Here


  {
    final VcsRevisionNumber number = myAnnotation.getLineRevisionNumber(line);
    if (number != null)
    {
      Project project = editor.getProject();
      Review review = RevuUtils.getReviewingReview(project);
      if (review != null)
      {
        VirtualFile vFile = FileDocumentManager.getInstance().getFile(editor.getDocument());
        if (!fileScopeManager.matchFrom(project, review.getFileScope(), vFile, number))
        {
          return false;
        }
      }
    }
View Full Code Here

    if (project == null)
    {
      return;
    }

    Review reviewingReview = RevuUtils.getReviewingReview(project);
    if (reviewingReview != null)
    {
      e.getPresentation().setText(RevuBundle.message("reviewing.stopReviewing.review.text", reviewingReview.getName()));
      e.getPresentation().setVisible(true);
    }
    else
    {
      e.getPresentation().setVisible(false);
View Full Code Here

  @Override
  public void actionPerformed(AnActionEvent e)
  {
    Project project = e.getData(DataKeys.PROJECT);

    Review review = RevuUtils.getReviewingReview(project);
    if (review == null)
    {
      return;
    }

    review.setStatus(ReviewStatus.FIXING);
    project.getComponent(ReviewManager.class).saveChanges(review);

    RevuWorkspaceSettingsComponent workspaceSettingsComponent =
      project.getComponent(RevuWorkspaceSettingsComponent.class);
    RevuWorkspaceSettings workspaceSettings = workspaceSettingsComponent.getState();
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;
      }

      final RevuProjectSettingsForm form = project.getComponent(RevuProjectSettingsForm.class);
View Full Code Here

    if (project == null)
    {
      return;
    }

    Review review = RevuUtils.getReviewingReview(project);
    if (review == null)
    {
      e.getPresentation().setText(RevuBundle.message("reviewing.annotate.template.text"));
      e.getPresentation().setEnabled(false);
    }
    else
    {
      e.getPresentation().setText(RevuBundle.message("reviewing.annotate.review.text", review.getName()));

      VirtualFile vFile = e.getData(DataKeys.VIRTUAL_FILE);
      e.getPresentation().setEnabled((vFile != null)
        && RevuVcsUtils.isUnderVcs(project, vFile)
        && fileScopeManager.belongsToScope(project, review, vFile));
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();
    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

    if (project == null)
    {
      return;
    }

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

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

    Review review = (Review) liReviews.getSelectedValue();

    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

  }

  @NotNull
  protected User retrieveUser(@NotNull UnmarshallingContext context, @Nullable String login)
  {
    Review review = getReview(context);

    return RevuUtils.getNonNullUser(review.getDataReferential(), login);
  }
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.