コード例 #1
0
ファイル: VSIDEHelper.cs プロジェクト: vendettamit/ReviewPal
 private static void DrillDownInProjectItems(ProjectItems projectItems, Review review, ProcessProjectItemScanResult psr, out bool found)
 {
     found = false;
     ProjectItems projItems;
     ProjectItem projectItem = projectItems.Parent as ProjectItem;
     //Check if the parent itself matches before searching for the parent's children.
     if (projectItem.Name == review.File)
     {
         psr.Invoke(projectItem, review);
         found = true;
         return;
     }
     foreach (ProjectItem projItem in projectItems)
     {
         projItems = projItem.ProjectItems;
         if ((projItems != null
              && (projItems.Count > 0)))
         {
             //  recurse to get to the bottom of the tree
             DrillDownInProjectItems(projItems, review, psr, out found);
             if (found)
             {
                 return;
             }
         }
         else if (projItem.Name == review.File && projItem.ContainingProject.Name == review.Project)
         {
             //  call back to the user function delegated to
             //  handle a single project item
             psr.Invoke(projItem, review);
             found = true;
             return;
         }
     }
 }
コード例 #2
0
ファイル: ReviewEditor.cs プロジェクト: vendettamit/ReviewPal
        /// <summary>
        /// Sets the review properties in the ReviewEditor window.
        /// </summary>
        /// <param name="rev">The rev.</param>
        /// <param name="isNew">if set to <c>true</c> [is new].</param>
        public void SetReview(Review rev, bool isNew)
        {
            _reviewId = rev.ReviewId;
            grpReview.Text = "Review ID : " + _reviewId;
            if(isNew)
            {

                cmbComment.SelectedIndex = 0;
                cmbStatus.SelectedIndex = 0;
                cmbReExamined.SelectedIndex = 0;
                cmbSeverity.SelectedIndex = 0;
                cmbDefectType.SelectedIndex = 0;
                cmbInjectedPhase.SelectedIndex = 0;
            }
            else
            {
                cmbComment.SelectedValue = rev.Comment;
                cmbStatus.SelectedValue = rev.Status;
                cmbReExamined.SelectedValue = rev.ReExamined;
                cmbSeverity.SelectedValue = rev.Severity;
                cmbDefectType.SelectedValue = rev.DefectType;
                cmbInjectedPhase.SelectedValue = rev.InjectedPhase;
            }

            txtDescription.Text = rev.Description;
            txtRevieweeComments.Text = rev.RevieweeComment;
            txtReviewerComments.Text = rev.ReviewerComment;

            stsProject.Text = "Project : " + rev.Project;
            stsFile.Text = "File: " + rev.File;
            stsLine.Text = "Line : " + rev.Line.ToString();
        }
コード例 #3
0
        /// <summary>
        /// Sets the review properties in the ReviewEditor window.
        /// </summary>
        /// <param name="rev">The rev.</param>
        public void SetReview(Review rev)
        {
            //if this a new addition, passed in Review will be null
            if(rev == null)
            {
                _isNew = true;
                // TODO: this needs to be moved into the VSIDEHelper
                TextSelection textSelection = (TextSelection)VSIDEHelper.VisualStudioInstance.ActiveDocument.Selection;
                int line = textSelection.CurrentLine;
                int col = textSelection.CurrentColumn;
                string file = VSIDEHelper.VisualStudioInstance.ActiveDocument.Name;
                string project = VSIDEHelper.VisualStudioInstance.ActiveDocument.ProjectItem.ContainingProject.Name;

                rev = new Review()
                {
                    ReviewId = _reviewRepo.GetNextReviewId(),
                    Project = project,
                    File = file,
                    Line = line
                };
            }
            else
            {
                _isNew = false;
            }
            _reviewId = rev.ReviewId;
            grpReview.Header = "Review ID : " + _reviewId;
            if (_isNew)
            {

                cmbComment.SelectedIndex = 0;
                cmbStatus.SelectedIndex = 0;
                cmbReExamined.SelectedIndex = 0;
                cmbSeverity.SelectedIndex = 0;
                cmbDefectType.SelectedIndex = 0;
                cmbInjectedPhase.SelectedIndex = 0;
            }
            else
            {
                UIHelper.SelectByString(cmbComment, rev.Comment);
                UIHelper.SelectByString(cmbStatus, rev.Status);
                UIHelper.SelectByString(cmbReExamined, rev.ReExamined);
                UIHelper.SelectByString(cmbSeverity, rev.Severity);
                UIHelper.SelectByString(cmbDefectType, rev.DefectType);
                UIHelper.SelectByString(cmbInjectedPhase, rev.InjectedPhase);
            }

            txtDescription.Text = rev.Description;
            txtRevieweeComments.Text = rev.RevieweeComment;
            txtReviewerComments.Text = rev.ReviewerComment;

            stsProject.Text = "Project : " + rev.Project;
            stsFile.Text = "File: " + rev.File;
            stsLine.Text = "Line : " + rev.Line;

            _review = rev;
        }
コード例 #4
0
ファイル: ReviewEditor.cs プロジェクト: vendettamit/ReviewPal
        /// <summary>
        /// Updates the review properties.
        /// </summary>
        /// <param name="review">The review.</param>
        public void UpdateReview(Review review)
        {
            review.Comment = cmbComment.Text;
            review.Status = cmbStatus.Text;

            review.ReExamined = cmbReExamined.SelectedItem.ToString();
            review.Severity = cmbSeverity.SelectedItem.ToString();
            review.DefectType = cmbDefectType.SelectedItem.ToString();
            review.InjectedPhase = cmbInjectedPhase.SelectedItem.ToString();

            review.Description = txtDescription.Text;
            review.RevieweeComment = txtRevieweeComments.Text;
            review.ReviewerComment = txtReviewerComments.Text;

            review.Line = int.Parse(stsLine.Text.Substring(6));
            review.File = stsFile.Text.Substring(6);
            review.Project = stsProject.Text.Substring(10);
        }
コード例 #5
0
ファイル: VSIDEHelper.cs プロジェクト: vendettamit/ReviewPal
 /// <summary>
 /// Scans for project items.
 /// </summary>
 /// <param name="project">The project.</param>
 /// <param name="review">The review.</param>
 /// <param name="processProjectItemScanResult">The PSR.</param>
 /// <param name="itemFound">if set to <c>true</c> [item found].</param>
 public static void ScanForProjectItems(Project project, Review review, ProcessProjectItemScanResult processProjectItemScanResult, out bool itemFound)
 {
     ProjectItems projItems;
     foreach (ProjectItem projItem in project.ProjectItems)
     {
         projItems = projItem.ProjectItems;
         if ((projItems != null
              && (projItems.Count > 0)))
         {
             bool found;
             DrillDownInProjectItems(projItems, review, processProjectItemScanResult, out found);
             if (found)
             {
                 itemFound = true;
                 return;
             }
         }
         else if (projItem.SubProject != null)
         {
             //try to find the item from project under solutoin folders
             projItems = projItem.SubProject.ProjectItems;
             if ((projItems != null
                  && (projItems.Count > 0)))
             {
                 bool found;
                 DrillDownInProjectItems(projItems, review, processProjectItemScanResult, out found);
                 if (found)
                 {
                     itemFound = true;
                     return;
                 }
             }
         }
         else if (projItem.Name == review.File && projItem.ContainingProject.Name == review.Project)
         {
             //  call back to the user function delegated to
             //  handle a single project item
             processProjectItemScanResult.Invoke(projItem, review);
             itemFound = true;
             return;
         }
     }
     itemFound = false;
 }
コード例 #6
0
 /// <summary>
 /// Handles the project item.
 /// </summary>
 /// <param name="projectItem">The project item.</param>
 /// <param name="review">The review.</param>
 private void HandleProjectItem(ProjectItem projectItem, Review review)
 {
     VSIDEHelper.VisualStudioInstance.ItemOperations.OpenFile(projectItem.get_FileNames(0), Constants.vsViewKindPrimary);
     Document document = projectItem.Document;
     document.Activate();
     TextSelection textSelection = (TextSelection)VSIDEHelper.VisualStudioInstance.ActiveDocument.Selection;
     textSelection.GotoLine(review.Line, false);
     textSelection.SetBookmark();
 }
コード例 #7
0
 public abstract void Update(Review review);
コード例 #8
0
 public abstract void Delete(Review review);
コード例 #9
0
 public abstract void Add(Review newReview);
コード例 #10
0
 public override void Update(Review review)
 {
     CodeReview.Reviews[review.ReviewId] = review;
 }
コード例 #11
0
 public override void Delete(Review review)
 {
     CodeReview.Reviews.Remove(review);
     AdjustReviewId();
 }
コード例 #12
0
 public override void Add(Review newReview)
 {
     CodeReview.Reviews.Add(newReview);
 }