internal static void Unload(MonoDevelop.Projects.WorkspaceItem item)
        {
            var ws = item as MonoDevelop.Projects.Workspace;

            if (ws != null)
            {
                foreach (var it in ws.Items)
                {
                    Unload(it);
                }
                ws.ItemAdded   -= OnWorkspaceItemAdded;
                ws.ItemRemoved -= OnWorkspaceItemRemoved;
                MonoDocDocumentationProvider.ClearCommentCache();
            }
            else
            {
                var solution = item as MonoDevelop.Projects.Solution;
                if (solution != null)
                {
                    MonoDevelopWorkspace result = GetWorkspace(solution);
                    if (result != emptyWorkspace)
                    {
                        lock (workspaceLock)
                            workspaces = workspaces.Remove(result);
                        result.Dispose();
                    }
                    solution.SolutionItemAdded   -= OnSolutionItemAdded;
                    solution.SolutionItemRemoved -= OnSolutionItemRemoved;
                    if (solution.ParentWorkspace == null)
                    {
                        MonoDocDocumentationProvider.ClearCommentCache();
                    }
                }
            }
        }
 static Task InternalLoad(List <MonoDevelopWorkspace> list, MonoDevelop.Projects.WorkspaceItem item, ProgressMonitor progressMonitor, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(Task.Run(async() => {
         var ws = item as MonoDevelop.Projects.Workspace;
         if (ws != null)
         {
             foreach (var it in ws.Items)
             {
                 await InternalLoad(list, it, progressMonitor, cancellationToken);
             }
             ws.ItemAdded += OnWorkspaceItemAdded;
             ws.ItemRemoved += OnWorkspaceItemRemoved;
         }
         else
         {
             var solution = item as MonoDevelop.Projects.Solution;
             if (solution != null)
             {
                 var workspace = new MonoDevelopWorkspace();
                 list.Add(workspace);
                 workspace.ShowStatusIcon();
                 lock (workspaceLock)
                     workspaces = workspaces.Add(workspace);
                 await workspace.TryLoadSolution(solution, cancellationToken);
                 solution.SolutionItemAdded += OnSolutionItemAdded;
                 solution.SolutionItemRemoved += OnSolutionItemRemoved;
                 workspace.HideStatusIcon();
             }
         }
     }));
 }
Esempio n. 3
0
        internal void Unload(MonoDevelop.Projects.WorkspaceItem item)
        {
            var ws = item as MonoDevelop.Projects.Workspace;

            if (ws != null)
            {
                foreach (var it in ws.Items)
                {
                    Unload(it);
                }
                ws.ItemAdded   -= OnWorkspaceItemAdded;
                ws.ItemRemoved -= OnWorkspaceItemRemoved;
                MonoDocDocumentationProvider.ClearCommentCache();
            }
            else
            {
                var solution = item as MonoDevelop.Projects.Solution;
                if (solution != null)
                {
                    MonoDevelopWorkspace result = GetWorkspace(solution);
                    if (result != emptyWorkspace)
                    {
                        lock (workspaceLock)
                            workspaces = workspaces.Remove(result);

                        result.Dispose();
                    }

                    lock (solution.ExtendedProperties.SyncRoot) {
                        if (solution.ExtendedProperties [typeof(WorkspaceRequestRegistration)] is WorkspaceRequestRegistration registration)
                        {
                            registration.Dispose();
                        }
                    }

                    solution.SolutionItemAdded   -= OnSolutionItemAdded;
                    solution.SolutionItemRemoved -= OnSolutionItemRemoved;
                    if (solution.ParentWorkspace == null)
                    {
                        MonoDocDocumentationProvider.ClearCommentCache();
                    }
                }
            }
        }
 static Task InternalLoad(List <MonoDevelopWorkspace> list, MonoDevelop.Projects.WorkspaceItem item, ProgressMonitor progressMonitor, CancellationToken cancellationToken = default(CancellationToken), bool showStatusIcon = true)
 {
     return(Task.Run(async() => {
         var ws = item as MonoDevelop.Projects.Workspace;
         if (ws != null)
         {
             foreach (var it in ws.Items)
             {
                 await InternalLoad(list, it, progressMonitor, cancellationToken).ConfigureAwait(false);
             }
             ws.ItemAdded += OnWorkspaceItemAdded;
             ws.ItemRemoved += OnWorkspaceItemRemoved;
         }
         else
         {
             var solution = item as MonoDevelop.Projects.Solution;
             if (solution != null)
             {
                 var workspace = new MonoDevelopWorkspace(solution);
                 lock (workspaceLock)
                     workspaces = workspaces.Add(workspace);
                 list.Add(workspace);
                 if (showStatusIcon)
                 {
                     workspace.ShowStatusIcon();
                 }
                 await workspace.TryLoadSolution(cancellationToken).ConfigureAwait(false);
                 solution.SolutionItemAdded += OnSolutionItemAdded;
                 solution.SolutionItemRemoved += OnSolutionItemRemoved;
                 TaskCompletionSource <MonoDevelopWorkspace> request;
                 if (workspaceRequests.TryGetValue(solution, out request))
                 {
                     request.TrySetResult(workspace);
                 }
                 if (showStatusIcon)
                 {
                     workspace.HideStatusIcon();
                 }
             }
         }
     }));
 }
Esempio n. 5
0
        public void CheckLocalCopy()
        {
            string solFile = Util.GetSampleProject("vs-local-copy", "VSLocalCopyTest.sln");

            WorkspaceItem item = Services.ProjectService.ReadWorkspaceItem(Util.GetMonitor(), solFile);

            Assert.IsTrue(item is Solution);
            Solution sol = (Solution)item;

            AssertCleanBuild(sol, "Debug");
            AssertCleanBuild(sol, "Release");

            AssertOutputFiles(sol, "VSLocalCopyTest", "Debug", new string[] {
                "ClassLibrary1.dll",
                "ClassLibrary1.dll.mdb",
                "ClassLibrary2.dll",
                "ClassLibrary2.dll.mdb",
                "ClassLibrary4.dll",
                "ClassLibrary4.dll.mdb",
                "VSLocalCopyTest.exe",
                "VSLocalCopyTest.exe.mdb",
                "TextFile1.txt",
                "TextFile2.txt",
                "app.config",
                "folder/baz.txt",
                "foo/bar.txt",
                "quux.txt",
                "VSLocalCopyTest.exe.config",
            });

            //FIXME: all of these should have mdb files in release mode.
            //See [Bug 431451] MD ignores DebugType pdbonly
            AssertOutputFiles(sol, "VSLocalCopyTest", "Release", new string[] {
                "ClassLibrary1.dll",
                "ClassLibrary2.dll",
                "ClassLibrary4.dll",
                "VSLocalCopyTest.exe",
                "TextFile1.txt",
                "TextFile2.txt",
                "app.config",
                "folder/baz.txt",
                "foo/bar.txt",
                "quux.txt",
                "VSLocalCopyTest.exe.config",
            });

            AssertOutputFiles(sol, "ClassLibrary1", "Debug", new string[] {
                "ClassLibrary1.dll",
                "ClassLibrary1.dll.mdb",
                "ClassLibrary2.dll",
                "ClassLibrary2.dll.mdb",
                "TextFile1.txt",
                "TextFile2.txt",
                "foo/bar.txt",
            });

            AssertOutputFiles(sol, "ClassLibrary1", "Release", new string[] {
                "ClassLibrary1.dll",
                "ClassLibrary2.dll",
                "TextFile1.txt",
                "TextFile2.txt",
                "foo/bar.txt",
            });

            AssertOutputFiles(sol, "ClassLibrary2", "Debug", new string[] {
                "ClassLibrary2.dll",
                "ClassLibrary2.dll.mdb",
                "TextFile2.txt"
            });

            AssertOutputFiles(sol, "ClassLibrary2", "Release", new string[] {
                "ClassLibrary2.dll",
                "TextFile2.txt"
            });

            AssertOutputFiles(sol, "ClassLibrary3", "Debug", new string[] {
                "ClassLibrary3.dll",
                "ClassLibrary3.dll.mdb"
            });

            AssertOutputFiles(sol, "ClassLibrary3", "Release", new string[] {
                "ClassLibrary3.dll"
            });

            AssertOutputFiles(sol, "ClassLibrary4", "Debug", new string[] {
                "ClassLibrary4.dll",
                "ClassLibrary4.dll.mdb"
            });

            AssertOutputFiles(sol, "ClassLibrary4", "Release", new string[] {
                "ClassLibrary4.dll"
            });

            AssertOutputFiles(sol, "ClassLibrary5", "Debug", new string[] {
                "ClassLibrary5.dll",
                "ClassLibrary5.dll.mdb",
            });

            AssertOutputFiles(sol, "ClassLibrary5", "Release", new string[] {
                "ClassLibrary5.dll"
            });
        }
Esempio n. 6
0
 public static Task Add(WorkspaceItem item)
 {
     using (readerWriterLock.Write()) {
         return(Watch_NoLock(item, registerEvent: true));
     }
 }
Esempio n. 7
0
 public virtual void Save(IProgressMonitor monitor, WorkspaceItem item)
 {
     GetNext(item).Save(monitor, item);
 }
Esempio n. 8
0
        internal void InternalWriteWorkspaceItem(IProgressMonitor monitor, string file, WorkspaceItem item)
        {
            string newFile = WriteFile(monitor, file, item, item.FileFormat);

            if (newFile != null)
            {
                item.FileName = newFile;
            }
            else
            {
                throw new InvalidOperationException("FileFormat not provided for workspace item '" + item.Name + "'");
            }
        }
Esempio n. 9
0
 public override void Save(IProgressMonitor monitor, WorkspaceItem entry)
 {
     entry.OnSave(monitor);
 }
Esempio n. 10
0
 public override object GetService(WorkspaceItem item, Type type)
 {
     return(item.OnGetService(type));
 }
Esempio n. 11
0
        public async Task CheckLocalCopy()
        {
            Assert.Inconclusive("This test is failing on windows and mac");

            string solFile = Util.GetSampleProject("vs-local-copy", "VSLocalCopyTest.sln");

            WorkspaceItem item = await Services.ProjectService.ReadWorkspaceItem(Util.GetMonitor(), solFile);

            Assert.IsTrue(item is Solution);
            Solution sol = (Solution)item;

            await AssertCleanBuild(sol, "Debug");
            await AssertCleanBuild(sol, "Release");

            string dllDebug = Platform.IsWindows ? ".pdb" : ".dll.mdb";
            string exeDebug = Platform.IsWindows ? ".pdb" : ".exe.mdb";

            AssertOutputFiles(sol, "VSLocalCopyTest", "Debug", new string[] {
                "ClassLibrary1.dll",
                "ClassLibrary1" + dllDebug,
                "ClassLibrary2.dll",
                "ClassLibrary2" + dllDebug,
                "ClassLibrary4.dll",
                "ClassLibrary4" + dllDebug,
                "VSLocalCopyTest.exe",
                "VSLocalCopyTest" + exeDebug,
                "TextFile1.txt",
                "TextFile2.txt",
                "app.config",
                "folder/baz.txt",
                "foo/bar.txt",
                "quux.txt",
                "VSLocalCopyTest.exe.config",
            });

            //FIXME: all of these should have mdb files in release mode.
            //See [Bug 431451] MD ignores DebugType pdbonly
            AssertOutputFiles(sol, "VSLocalCopyTest", "Release", new string[] {
                "ClassLibrary1.dll",
                "ClassLibrary2.dll",
                "ClassLibrary4.dll",
                "VSLocalCopyTest.exe",
                "TextFile1.txt",
                "TextFile2.txt",
                "app.config",
                "folder/baz.txt",
                "foo/bar.txt",
                "quux.txt",
                "VSLocalCopyTest.exe.config",
            });

            AssertOutputFiles(sol, "ClassLibrary1", "Debug", new string[] {
                "ClassLibrary1.dll",
                "ClassLibrary1" + dllDebug,
                "ClassLibrary2.dll",
                "ClassLibrary2" + dllDebug,
                "TextFile1.txt",
                "TextFile2.txt",
                "foo/bar.txt",
            });

            AssertOutputFiles(sol, "ClassLibrary1", "Release", new string[] {
                "ClassLibrary1.dll",
                "ClassLibrary2.dll",
                "TextFile1.txt",
                "TextFile2.txt",
                "foo/bar.txt",
            });

            AssertOutputFiles(sol, "ClassLibrary2", "Debug", new string[] {
                "ClassLibrary2.dll",
                "ClassLibrary2" + dllDebug,
                "TextFile2.txt"
            });

            AssertOutputFiles(sol, "ClassLibrary2", "Release", new string[] {
                "ClassLibrary2.dll",
                "TextFile2.txt"
            });

            AssertOutputFiles(sol, "ClassLibrary3", "Debug", new string[] {
                "ClassLibrary3.dll",
                "ClassLibrary3" + dllDebug
            });

            AssertOutputFiles(sol, "ClassLibrary3", "Release", new string[] {
                "ClassLibrary3.dll"
            });

            AssertOutputFiles(sol, "ClassLibrary4", "Debug", new string[] {
                "ClassLibrary4.dll",
                "ClassLibrary4" + dllDebug
            });

            AssertOutputFiles(sol, "ClassLibrary4", "Release", new string[] {
                "ClassLibrary4.dll"
            });

            AssertOutputFiles(sol, "ClassLibrary5", "Debug", new string[] {
                "ClassLibrary5.dll",
                "ClassLibrary5" + dllDebug,
            });

            AssertOutputFiles(sol, "ClassLibrary5", "Release", new string[] {
                "ClassLibrary5.dll"
            });
        }
Esempio n. 12
0
 public WorkspaceItemChangeEventArgs(WorkspaceItem item, bool reloading) : base(item)
 {
     this.reloading = reloading;
 }
Esempio n. 13
0
 public WorkspaceItemEventArgs(WorkspaceItem item)
 {
     this.item = item;
 }
Esempio n. 14
0
 internal protected override bool SupportsItem(WorkspaceItem item)
 {
     return(item is Solution);
 }
Esempio n. 15
0
 internal protected virtual bool SupportsItem(WorkspaceItem item)
 {
     return(next.SupportsItem(item));
 }
 public WorkspaceItemRenamedEventArgs(WorkspaceItem item, string oldName, string newName) : base(item)
 {
     this.oldName = oldName;
     this.newName = newName;
 }