void TreeNodeCreated(object sender, TreeViewEventArgs e)
        {
            SolutionNode sn = e.Node as SolutionNode;

            if (sn != null)
            {
                GitStatusCache.ClearCachedStatus(sn.Solution.FileName);
                OverlayIconManager.Enqueue(sn);
            }
            else
            {
                DirectoryNode dn = e.Node as DirectoryNode;
                if (dn != null)
                {
                    OverlayIconManager.Enqueue(dn);
                }
                else
                {
                    FileNode fn = e.Node as FileNode;
                    if (fn != null)
                    {
                        OverlayIconManager.Enqueue(fn);
                    }
                }
            }
        }
 void RemoveFile(string fileName)
 {
     if (GitStatusCache.GetFileStatus(fileName) == GitStatus.Added)
     {
         Git.Remove(fileName, true,
                    exitcode => WorkbenchSingleton.SafeThreadAsyncCall(ClearStatusCacheAndEnqueueFile, fileName));
     }
 }
        async void RemoveFile(string fileName)
        {
            if (GitStatusCache.GetFileStatus(fileName) == GitStatus.Added)
            {
                await Git.RemoveAsync(fileName, true);

                ClearStatusCacheAndEnqueueFile(fileName);
            }
        }
예제 #4
0
 Action AfterCommand(string nodeFileName, AbstractProjectBrowserTreeNode node)
 {
     return(delegate {
         WorkbenchSingleton.AssertMainThread();
         // and then refresh the project browser:
         GitStatusCache.ClearCachedStatus(nodeFileName);
         OverlayIconManager.EnqueueRecursive(node);
         OverlayIconManager.EnqueueParents(node);
     });
 }
        async void RemoveFile(string fileName)
        {
            if (!AddInOptions.AutomaticallyDeleteFiles)
            {
                return;
            }
            if (GitStatusCache.GetFileStatus(fileName) == GitStatus.Added)
            {
                await Git.RemoveAsync(fileName, true);

                ClearStatusCacheAndEnqueueFile(fileName);
            }
        }
예제 #6
0
        static void RunStep(AbstractProjectBrowserTreeNode node)
        {
            if (node.IsDisposed)
            {
                return;
            }

            FileNode  fileNode = node as FileNode;
            GitStatus status;

            if (fileNode != null)
            {
                status = GitStatusCache.GetFileStatus(fileNode.FileName);
            }
            else
            {
                DirectoryNode directoryNode = node as DirectoryNode;
                if (directoryNode != null)
                {
                    status = GitStatusCache.GetFileStatus(directoryNode.Directory);
                }
                else
                {
                    SolutionNode solNode = node as SolutionNode;
                    if (solNode != null)
                    {
                        status = GitStatusCache.GetFileStatus(solNode.Solution.Directory);
                    }
                    else
                    {
                        return;
                    }
                }
            }

            WorkbenchSingleton.SafeThreadAsyncCall(
                delegate {
                Image image = GetImage(status);
                if (image != null)
                {
                    node.Overlay = image;
                }
                else if (node.Overlay != null && (node.Overlay.Tag as Type) == typeof(GitAddIn.OverlayIconManager))
                {
                    // reset overlay to null only if the old overlay belongs to the OverlayIconManager
                    node.Overlay = null;
                }
            });
        }
        void ClearStatusCacheAndEnqueueFile(string fileName)
        {
            GitStatusCache.ClearCachedStatus(fileName);

            ProjectBrowserPad pad = ProjectBrowserPad.Instance;

            if (pad == null)
            {
                return;
            }
            FileNode node = pad.ProjectBrowserControl.FindFileNode(fileName);

            if (node == null)
            {
                return;
            }
            OverlayIconManager.EnqueueParents(node);
        }
예제 #8
0
        static void RunStep(AbstractProjectBrowserTreeNode node)
        {
            if (node.IsDisposed)
            {
                return;
            }

            FileNode  fileNode = node as FileNode;
            GitStatus status;

            if (fileNode != null)
            {
                status = GitStatusCache.GetFileStatus(fileNode.FileName);
            }
            else
            {
                DirectoryNode directoryNode = node as DirectoryNode;
                if (directoryNode != null)
                {
                    status = GitStatusCache.GetFileStatus(directoryNode.Directory);
                }
                else
                {
                    SolutionNode solNode = node as SolutionNode;
                    if (solNode != null)
                    {
                        status = GitStatusCache.GetFileStatus(solNode.Solution.Directory);
                    }
                    else
                    {
                        return;
                    }
                }
            }

            WorkbenchSingleton.SafeThreadAsyncCall(
                delegate {
                node.Overlay = GetImage(status);
            });
        }