private void ImportCloneDetectiveResults()
 {
     if (openFileDialog.ShowDialog() == DialogResult.OK)
     {
         CloneDetectiveManager.ImportCloneDetectiveResults(openFileDialog.FileName);
     }
 }
Esempio n. 2
0
        private static void findAllOccurencesToolStripItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem item  = (ToolStripMenuItem)sender;
            Clone             clone = (Clone)item.Tag;

            CloneDetectiveManager.FindClones(clone.CloneClass);
        }
 private void ExportCloneDetectiveResults()
 {
     if (saveFileDialog.ShowDialog() == DialogResult.OK)
     {
         CloneDetectiveManager.ExportCloneDetectiveResults(saveFileDialog.FileName);
     }
 }
        public int OnAfterSave(uint docCookie)
        {
            // As the document has been saved the CloneDetectiveManager needs the
            // opportunity to save the current state of our text markers.
            CloneDetectiveManager.OnDocumentSaved(docCookie);

            return(VSConstants.S_OK);
        }
Esempio n. 5
0
        public int OnLoadCompleted(int fReload)
        {
            // The load procedure completed. Now we can safely notify the
            // CloneDetectiveManager about it and so we don't need to listen to these
            // events any more.
            ConnectionPoint.Unadvise(Cookie);
            CloneDetectiveManager.OnDocumentOpened(TextLines);

            return(VSConstants.S_OK);
        }
Esempio n. 6
0
        public int ExecMarkerCommand(IVsTextMarker pMarker, int iItem)
        {
            switch (iItem)
            {
            case 0:
                CloneDetectiveManager.FindClones(CloneDetectiveManager.GetCloneClass(_marker));
                return(VSConstants.S_OK);

            case 1:
                CloneDetectiveManager.ShowCloneIntersections();
                return(VSConstants.S_OK);

            default:
                return(VSConstants.S_FALSE);
            }
        }
        private void RunCloneDetective()
        {
            bool started = CloneDetectiveManager.RunCloneDetective(
                delegate(object sender, CloneDetectiveCompletedEventArgs e)
            {
                if (e.Exception != null)
                {
                    VSPackage.Instance.ShowError(e.Exception.Message);
                }
                UpdateUI();
            });

            if (started)
            {
                UpdateUI();
            }
        }
Esempio n. 8
0
        public void OnUnregisterView(IVsTextView pView)
        {
            // It's interesting to us when a document is closed because we need this
            // information to keep track when a document is opened. Furthermore we
            // have to free all text markers.
            IVsTextLines textLines;

            ErrorHandler.ThrowOnFailure(pView.GetBuffer(out textLines));
            if (textLines == null)
            {
                return;
            }

            // Decrement the stored view count. This is a little bit special as we use
            // IVsTextLines instances as keys in our dictionary. That means that we
            // have to remove the whole entry from the dictionary when the counter drops
            // to zero to prevent memory leaks.
            int documentViewCount;

            if (_documentViewCounts.TryGetValue(textLines, out documentViewCount))
            {
                if (documentViewCount > 1)
                {
                    // There are several open views for the same document. In this case
                    // we only have to decrement the view count.
                    _documentViewCounts[textLines] = documentViewCount - 1;
                }
                else
                {
                    // When we reach this branch the last view of a document has been
                    // closed. That means we have to free the whole IVsTextLines reference
                    // by removing it from the dictionary.
                    _documentViewCounts.Remove(textLines);

                    // Notify the CloneDetectiveManager of this event.
                    CloneDetectiveManager.OnDocumentClosed(textLines);
                }
            }
        }
 public int OnAfterCloseSolution(object pUnkReserved)
 {
     VSPackage.Instance.OnSolutionClosed();
     CloneDetectiveManager.OnSolutionClosed();
     return(VSConstants.S_OK);
 }
 public int OnAfterOpenSolution(object pUnkReserved, int fNewSolution)
 {
     VSPackage.Instance.OnSolutionOpened();
     CloneDetectiveManager.OnSolutionOpened();
     return(VSConstants.S_OK);
 }
Esempio n. 11
0
 public void MarkerInvalidated()
 {
     CloneDetectiveManager.OnMarkerInvalidated(_marker);
 }
 private static void CloseCloneDetectiveResults()
 {
     CloneDetectiveManager.CloseCloneDetectiveResults();
 }
 private static void AbortCloneDetective()
 {
     CloneDetectiveManager.AbortCloneDetective();
 }