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

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


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

    Issue issue = new Issue();
    issue.setFile(vFile);
    if (editor != null)
    {
      Document document = editor.getDocument();
      int lineStart = document.getLineNumber(editor.getSelectionModel().getSelectionStart());
      int lineEnd = document.getLineNumber(editor.getSelectionModel().getSelectionEnd());

      issue.setLineStart(lineStart);
      issue.setLineEnd(lineEnd);
      CharSequence fragment = document.getCharsSequence().subSequence(document.getLineStartOffset(lineStart),
        document.getLineEndOffset(lineEnd));
      issue.setHash(fragment.toString().hashCode());
    }
    issue.setStatus(IssueStatus.TO_RESOLVE);

    IssueDialog dialog = new IssueDialog(project, true);
    dialog.show(issue);
    if ((dialog.isOK()) && dialog.updateData(issue))
    {
      Review review = issue.getReview();

      assert (RevuUtils.getCurrentUserLogin() != null) : "Login should be set";

      issue.setHistory(RevuUtils.buildHistory(review));

      if (RevuVcsUtils.fileIsModifiedFromVcs(project, vFile))
      {
        issue.setLocalRev(String.valueOf(System.currentTimeMillis()));
      }

      if (issue.getFile() != null)
      {
        VcsRevisionNumber vcsRev = RevuVcsUtils.getVcsRevisionNumber(project, issue.getFile());
        if (vcsRev != null)
        {
          issue.setVcsRev(vcsRev.toString());
        }
      }

      review.addIssue(issue);
View Full Code Here


    Project project = e.getData(PlatformDataKeys.PROJECT);
    List<Issue> issues = e.getData(RevuDataKeys.ISSUE_LIST);

    if (issues == null)
    {
      Issue issue = e.getData(RevuDataKeys.ISSUE);
      if (issue == null)
      {
        return;
      }

      issues = new ArrayList<Issue>();
      issues.add(issue);
    }

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

      reviewsToSave.add(review);
    }
View Full Code Here

  @Override
  public void update(AnActionEvent e)
  {
    boolean enabled;

    Issue currentIssue = e.getData(RevuDataKeys.ISSUE);
    if (currentIssue == null)
    {
      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

public class ShowUpdateIssuePopupAction extends AnAction
{
  public void actionPerformed(AnActionEvent e)
  {
    Project project = e.getData(PlatformDataKeys.PROJECT);
    Issue issue = e.getData(RevuDataKeys.ISSUE);

    if ((issue == null) || (project == null))
    {
      return;
    }
View Full Code Here

  }

  @Nullable
  public Review getSelectedReview()
  {
    Issue issue = issueTree.getSelectedIssue();

    return (issue == null) ? null : issue.getReview();
  }
View Full Code Here

    return splitPane;
  }

  public boolean saveIfModified()
  {
    Issue current = issueTree.getSelectedIssue();

    if ((current == null) || !current.equals(issuePane.getCurrentIssue()))
    {
      return true;
    }

    // Already called in #updateData, but don't want to save review if item has not changed
    if (!issuePane.isModified(current))
    {
      return true;
    }

    if (issuePane.updateData(current))
    {
      project.getComponent(ReviewManager.class).saveSilently(current.getReview());
      return true;
    }

    return false;
  }
View Full Code Here

  private void updateIssues(int lineStart)
  {
    Map<Issue, RangeMarker> markersCopy = new HashMap<Issue, RangeMarker>(markers);
    for (Map.Entry<Issue, RangeMarker> entry : markersCopy.entrySet())
    {
      Issue issue = entry.getKey();
      if (issue.getLineStart() >= lineStart)
      {
        updateIssue(issue, entry.getValue());
      }
    }
  }
View Full Code Here

  public String getTooltipText()
  {
    StringBuilder buffer = new StringBuilder("<html><body>");
    for (Iterator<Issue> it = issues.keySet().iterator(); it.hasNext();)
    {
      Issue issue = it.next();
      buffer
        .append("[")
        .append(issue.getReview().getName())
        .append("]<br/><b>")
        .append(issue.getHistory().getCreatedBy().getDisplayName())
        .append("</b> - <i>")
        .append(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(
          issue.getHistory().getCreatedOn()))
        .append("</i><br/>")
        .append(issue.getSummary());
      if (it.hasNext())
      {
        buffer.append("<hr/>");
      }
    }
View Full Code Here

public class ShowUpdateIssuePopupAction extends AnAction
{
  public void actionPerformed(AnActionEvent e)
  {
    Project project = e.getData(DataKeys.PROJECT);
    Issue issue = e.getData(RevuDataKeys.ISSUE);

    if ((issue == null) || (project == null))
    {
      return;
    }
View Full Code Here

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

    Issue issue = new Issue();
    issue.setFile(vFile);
    if (editor != null)
    {
      Document document = editor.getDocument();
      int lineStart = document.getLineNumber(editor.getSelectionModel().getSelectionStart());
      int lineEnd = document.getLineNumber(editor.getSelectionModel().getSelectionEnd());

      issue.setLineStart(lineStart);
      issue.setLineEnd(lineEnd);
      CharSequence fragment = document.getCharsSequence().subSequence(document.getLineStartOffset(lineStart),
        document.getLineEndOffset(lineEnd));
      issue.setHash(fragment.toString().hashCode());
    }
    issue.setStatus(IssueStatus.TO_RESOLVE);

    IssueDialog dialog = new IssueDialog(project, true);
    dialog.show(issue);
    if ((dialog.isOK()) && dialog.updateData(issue))
    {
      Review review = issue.getReview();

      assert (RevuUtils.getCurrentUserLogin() != null) : "Login should be set";

      issue.setHistory(RevuUtils.buildHistory(review));

      if (RevuVcsUtils.fileIsModifiedFromVcs(project, vFile))
      {
        issue.setLocalRev(String.valueOf(System.currentTimeMillis()));
      }

      if (issue.getFile() != null)
      {
        VcsRevisionNumber vcsRev = RevuVcsUtils.getVcsRevisionNumber(project, issue.getFile());
        if (vcsRev != null)
        {
          issue.setVcsRev(vcsRev.toString());
        }
      }

      review.addIssue(issue);
View Full Code Here

TOP

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

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.