コード例 #1
0
        /// <summary>
        /// Deploys a makefile to build the default configuration.
        /// </summary>
        /// <remarks>
        /// TODO: Make configuration-based targets as advertised.
        /// </remarks>
        public Makefile Deploy(AutotoolsContext ctx, MonoDevelop.Projects.SolutionItem entry, MonoDevelop.Core.IProgressMonitor monitor)
        {
            Makefile    mkfile            = new Makefile();
            ValaProject project           = (ValaProject)entry;
            ValaProjectConfiguration conf = (ValaProjectConfiguration)project.DefaultConfiguration;

            StringBuilder files = new StringBuilder();

            foreach (ProjectFile t in project.Files)
            {
                if (BuildAction.Compile == t.BuildAction)
                {
                    files.Append("\\\n\t" + FileService.AbsoluteToRelativePath(project.BaseDirectory, t.FilePath));
                }
            }

            string dir = ctx.DeployContext.GetResolvedPath(TargetDirectory.ProgramFiles, FileService.AbsoluteToRelativePath(conf.OutputDirectory, ctx.TargetSolution.BaseDirectory));

            dir = dir.Replace("@prefix@", "$(prefix)");
            dir = dir.Replace("@PACKAGE@", "$(PACKAGE)");

            TemplateEngine templateEngine = new TemplateEngine();

            templateEngine.Variables ["TOP_SRCDIR"]  = FileService.AbsoluteToRelativePath(project.BaseDirectory, ctx.TargetSolution.BaseDirectory);
            templateEngine.Variables ["FILES"]       = files.ToString();
            templateEngine.Variables ["BUILD_DIR"]   = ".";
            templateEngine.Variables ["INSTALL_DIR"] = "$(DESTDIR)" + dir;
            templateEngine.Variables ["ALL_TARGET"]  = string.Format("all-{0}", conf.Name);
            templateEngine.Variables ["VFLAGS"]      = string.Format("{0} {1}", ValaCompiler.GetCompilerFlags(conf), ValaCompiler.GeneratePkgCompilerArgs(project.Packages));
            templateEngine.Variables ["VTARGET"]     = conf.CompiledOutputName;

            StringWriter sw = new StringWriter();

            string mt;

            if (ctx.MakefileType == MakefileType.AutotoolsMakefile)
            {
                mt = "Makefile.am.template";
            }
            else
            {
                mt = "Makefile.template";
            }

            using (Stream stream = GetType().Assembly.GetManifestResourceStream(mt)) {
                StreamReader reader = new StreamReader(stream);

                templateEngine.Process(reader, sw);
                reader.Close();
            }

            mkfile.Append(sw.ToString());

            return(mkfile);
        }
コード例 #2
0
        public override bool GetNeedsBuilding(IBuildTarget item, ConfigurationSelector configuration)
        {
            if (item is SolutionItem)
            {
                SolutionItem entry = (SolutionItem)item;
                // This is a cache to avoid unneeded recursive calls to GetNeedsBuilding.
                bool cleanCache = false;
                if (needsBuildingCache == null)
                {
                    needsBuildingCache = new Dictionary <SolutionItem, bool> ();
                    cleanCache         = true;
                }
                else
                {
                    bool res;
                    if (needsBuildingCache.TryGetValue(entry, out res))
                    {
                        return(res);
                    }
                }

                bool nb = entry.OnGetNeedsBuilding(configuration);

                needsBuildingCache [entry] = nb;
                if (cleanCache)
                {
                    needsBuildingCache = null;
                }
                return(nb);
            }
            else if (item is WorkspaceItem)
            {
                return(((WorkspaceItem)item).OnGetNeedsBuilding(configuration));
            }
            else
            {
                throw new InvalidOperationException("Unknown item type: " + item);
            }
        }
コード例 #3
0
 static SolutionItem FindSolutionItemRecursive(SolutionFolderItemCollection items, string fullPath)
 {
     foreach (SolutionFolderItem it in items)
     {
         if (it is SolutionFolder sf)
         {
             SolutionItem r = FindSolutionItemRecursive(sf.Items, fullPath);
             if (r != null)
             {
                 return(r);
             }
         }
         else if (it is SolutionItem se)
         {
             if (!string.IsNullOrEmpty(se.FileName) && fullPath == Path.GetFullPath(se.FileName))
             {
                 return((SolutionItem)it);
             }
         }
     }
     return(null);
 }
コード例 #4
0
        void DisconnectChildEntryEvents(SolutionItem entry)
        {
            if (entry is Project)
            {
                Project pce = entry as Project;
                pce.FileRemovedFromProject       -= NotifyFileRemovedFromProject;
                pce.FileAddedToProject           -= NotifyFileAddedToProject;
                pce.FileChangedInProject         -= NotifyFileChangedInProject;
                pce.FilePropertyChangedInProject -= NotifyFilePropertyChangedInProject;
                pce.FileRenamedInProject         -= NotifyFileRenamedInProject;
                if (pce is DotNetProject)
                {
                    ((DotNetProject)pce).ReferenceRemovedFromProject -= NotifyReferenceRemovedFromProject;
                    ((DotNetProject)pce).ReferenceAddedToProject     -= NotifyReferenceAddedToProject;
                }
            }

            if (entry is SolutionFolder)
            {
                SolutionFolder cce = entry as SolutionFolder;
                cce.FileRemovedFromProject       -= NotifyFileRemovedFromProject;
                cce.FileAddedToProject           -= NotifyFileAddedToProject;
                cce.FileChangedInProject         -= NotifyFileChangedInProject;
                cce.FilePropertyChangedInProject -= NotifyFilePropertyChangedInProject;
                cce.FileRenamedInProject         -= NotifyFileRenamedInProject;
                cce.ReferenceRemovedFromProject  -= NotifyReferenceRemovedFromProject;
                cce.ReferenceAddedToProject      -= NotifyReferenceAddedToProject;
            }

            if (entry is SolutionEntityItem)
            {
                ((SolutionEntityItem)entry).Saved -= NotifyItemSaved;
//				((SolutionEntityItem)entry).ReloadRequired -= NotifyItemReloadRequired;
            }
            entry.Modified -= NotifyItemModified;
        }
コード例 #5
0
 public Task <SolutionItem> ReadSolutionItem(ProgressMonitor monitor, string file, MSBuildFileFormat format, string typeGuid = null, string itemGuid = null, SolutionLoadContext ctx = null)
 {
     return(Runtime.RunInMainThread(async delegate {
         if (!File.Exists(file))
         {
             throw new IOException(GettextCatalog.GetString("File not found: {0}", file));
         }
         file = Path.GetFullPath(file);
         using (Counters.ReadSolutionItem.BeginTiming("Read project " + file)) {
             file = GetTargetFile(file);
             var r = GetObjectReaderForFile(file, typeof(SolutionItem));
             if (r == null)
             {
                 throw new UnknownSolutionItemTypeException();
             }
             SolutionItem loadedItem = await r.LoadSolutionItem(monitor, ctx, file, format, typeGuid, itemGuid);
             if (loadedItem != null)
             {
                 loadedItem.NeedsReload = false;
             }
             return loadedItem;
         }
     }));
 }
コード例 #6
0
        void ConnectChildEntryEvents(SolutionItem item)
        {
            if (item is Project)
            {
                Project project = item as Project;
                project.FileRemovedFromProject       += NotifyFileRemovedFromProject;
                project.FileAddedToProject           += NotifyFileAddedToProject;
                project.FileChangedInProject         += NotifyFileChangedInProject;
                project.FilePropertyChangedInProject += NotifyFilePropertyChangedInProject;
                project.FileRenamedInProject         += NotifyFileRenamedInProject;
                if (item is DotNetProject)
                {
                    ((DotNetProject)project).ReferenceRemovedFromProject += NotifyReferenceRemovedFromProject;
                    ((DotNetProject)project).ReferenceAddedToProject     += NotifyReferenceAddedToProject;
                }
            }

            if (item is SolutionFolder)
            {
                SolutionFolder folder = item as SolutionFolder;
                folder.FileRemovedFromProject       += NotifyFileRemovedFromProject;
                folder.FileAddedToProject           += NotifyFileAddedToProject;
                folder.FileChangedInProject         += NotifyFileChangedInProject;
                folder.FilePropertyChangedInProject += NotifyFilePropertyChangedInProject;
                folder.FileRenamedInProject         += NotifyFileRenamedInProject;
                folder.ReferenceRemovedFromProject  += NotifyReferenceRemovedFromProject;
                folder.ReferenceAddedToProject      += NotifyReferenceAddedToProject;
            }

            if (item is SolutionEntityItem)
            {
                ((SolutionEntityItem)item).Saved += NotifyItemSaved;
//				((SolutionEntityItem)item).ReloadRequired += NotifyItemReloadRequired;
            }
            item.Modified += NotifyItemModified;
        }
コード例 #7
0
        public SolutionItem FindSolutionItem(string fileName)
        {
            string path = Path.GetFullPath(fileName);

            foreach (SolutionFolderItem it in Items)
            {
                if (it is SolutionFolder sf)
                {
                    SolutionItem r = sf.FindSolutionItem(fileName);
                    if (r != null)
                    {
                        return(r);
                    }
                }
                else if (it is SolutionItem se)
                {
                    if (!string.IsNullOrEmpty(se.FileName) && path == Path.GetFullPath(se.FileName))
                    {
                        return((SolutionItem)it);
                    }
                }
            }
            return(null);
        }
コード例 #8
0
        public SolutionItem ReloadItem(IProgressMonitor monitor, SolutionItem sitem)
        {
            if (Items.IndexOf(sitem) == -1)
            {
                throw new InvalidOperationException("Solution item '" + sitem.Name + "' does not belong to folder '" + Name + "'");
            }

            SolutionEntityItem item = sitem as SolutionEntityItem;

            if (item != null)
            {
                // Load the new item

                SolutionEntityItem newItem;
                try {
                    if (ParentSolution.IsSolutionItemEnabled(item.FileName))
                    {
                        newItem = Services.ProjectService.ReadSolutionItem(monitor, item.FileName);
                    }
                    else
                    {
                        UnknownSolutionItem e = new UnknownSolutionItem()
                        {
                            FileName      = item.FileName,
                            UnloadedEntry = true
                        };
                        var ch = item.GetItemHandler() as MonoDevelop.Projects.Formats.MSBuild.MSBuildHandler;
                        if (ch != null)
                        {
                            var h = new MonoDevelop.Projects.Formats.MSBuild.MSBuildHandler(ch.TypeGuid, ch.ItemId)
                            {
                                Item = e,
                            };
                            e.SetItemHandler(h);
                        }
                        newItem = e;
                    }
                } catch (Exception ex) {
                    UnknownSolutionItem e = new UnknownSolutionItem();
                    e.LoadError = ex.Message;
                    e.FileName  = item.FileName;
                    newItem     = e;
                }

                // Replace in the file list
                Items.Replace(item, newItem);

                DisconnectChildEntryEvents(item);
                ConnectChildEntryEvents(newItem);

                NotifyModified("Items");
                OnItemRemoved(new SolutionItemChangeEventArgs(item, ParentSolution, true)
                {
                    ReplacedItem = item
                }, true);
                OnItemAdded(new SolutionItemChangeEventArgs(newItem, ParentSolution, true)
                {
                    ReplacedItem = item
                }, true);

                item.Dispose();
                return(newItem);
            }
            else
            {
                return(sitem);
            }
        }
コード例 #9
0
        void GetBuildableReferencedItems(Set <SolutionItem> visited, List <SolutionItem> referenced, SolutionItem item, ConfigurationSelector configuration)
        {
            if (!visited.Add(item))
            {
                return;
            }

            referenced.Add(item);

            foreach (SolutionItem ritem in item.GetReferencedItems(configuration))
            {
                GetBuildableReferencedItems(visited, referenced, ritem, configuration);
            }
        }
コード例 #10
0
 internal void SetParentItem(SolutionItem item)
 {
     parentItem = item;
 }
コード例 #11
0
        string FindMatchingConfiguration(SolutionItem item)
        {
            SolutionItemConfiguration startupConfiguration = null;

            // There are no configurations so do nothing
            if (item.Configurations.Count == 0)
            {
                return(null);
            }

            // Direct match if there's the same name and platform
            if (item.Configurations [Id] != null)
            {
                return(Id);
            }

            // This configuration is not present in the project. Try to find the best match.
            // First of all try matching name
            foreach (SolutionItemConfiguration iconf in item.Configurations)
            {
                if (iconf.Name == Name && iconf.Platform == "")
                {
                    return(iconf.Id);
                }
            }

            // Run some heuristics based on the startup project if it exists
            if (ParentSolution != null && ParentSolution.StartupItem != null)
            {
                var startup = ParentSolution.StartupItem;
                startupConfiguration = startup.GetConfiguration(Selector);
                if (startupConfiguration != null)
                {
                    var match = startupConfiguration.FindBestMatch(item.Configurations);
                    if (match != null)
                    {
                        return(match.Id);
                    }
                }
            }
            if (Platform.Length > 0)
            {
                // No name coincidence, now try matching the platform
                foreach (SolutionItemConfiguration iconf in item.Configurations)
                {
                    if (iconf.Platform == Platform)
                    {
                        return(iconf.Id);
                    }
                }
            }

            // Now match name, ignoring platform
            foreach (SolutionItemConfiguration iconf in item.Configurations)
            {
                if (iconf.Name == Name)
                {
                    return(iconf.Id);
                }
            }

            // No luck. Pick whatever.
            return(item.Configurations [0].Id);
        }
コード例 #12
0
        static void UpdateReadSolutionItemMetadata(ReadSolutionItemMetadata metadata, SolutionItem item)
        {
            metadata.ProjectType = item.TypeGuid;
            metadata.ProjectID   = item.ItemId;
            metadata.LoadSucceed = true;

            var project = item as Project;

            if (project == null)
            {
                return;
            }

            // Use TypeGuid by default for ProjectFlavor.
            metadata.ProjectFlavor = project.FlavorGuids.FirstOrDefault() ?? item.TypeGuid;
            metadata.Flavors       = string.Join(";", project.GetItemTypeGuids());

            var capabilities = project.GetProjectCapabilities();

            if (capabilities.Any())
            {
                metadata.Capabilities = string.Join(" ", capabilities);
            }
        }
コード例 #13
0
 public override object GetService(SolutionItem item, Type type)
 {
     return(item.OnGetService(type));
 }
コード例 #14
0
 internal void NotifyItemRemoved(SolutionItem item, bool removedFromSolution)
 {
     DisconnectChildEntryEvents(item);
     NotifyModified("Items");
     OnItemRemoved(new SolutionItemChangeEventArgs(item, ParentSolution, false), removedFromSolution);
 }
コード例 #15
0
        public override void ModifyTags(MonoDevelop.Projects.SolutionItem policyParent, MonoDevelop.Projects.Project project, string language, string identifier, string fileName, ref Dictionary <string, string> tags)
        {
            base.ModifyTags(policyParent, project, language, identifier, fileName, ref tags);
            if (fileName == null)
            {
                return;
            }

            tags ["AspNetMaster"]        = "";
            tags ["AspNetMasterContent"] = "";

            AspNetAppProject aspProj = project as AspNetAppProject;

            if (aspProj == null)
            {
                throw new InvalidOperationException("MasterContentFileDescriptionTemplate is only valid for ASP.NET projects");
            }

            ProjectFile masterPage = null;

            var dialog = new MonoDevelop.Ide.Projects.ProjectFileSelectorDialog(aspProj, null, "*.master");

            try {
                dialog.Title = GettextCatalog.GetString("Select a Master Page...");
                int response = MonoDevelop.Ide.MessageService.RunCustomDialog(dialog);
                if (response == (int)Gtk.ResponseType.Ok)
                {
                    masterPage = dialog.SelectedFile;
                }
            } finally {
                dialog.Destroy();
            }
            if (masterPage == null)
            {
                return;
            }

            tags ["AspNetMaster"] = aspProj.LocalToVirtualPath(masterPage);

            try {
                var pd = TypeSystemService.ParseFile(project, masterPage.FilePath)
                         as AspNetParsedDocument;
                if (pd == null)
                {
                    return;
                }

                var sb = new System.Text.StringBuilder();
                foreach (string id in pd.XDocument.GetAllPlaceholderIds())
                {
                    sb.Append("<asp:Content ContentPlaceHolderID=\"");
                    sb.Append(id);
                    sb.Append("\" ID=\"");
                    sb.Append(id);
                    sb.Append("Content\" runat=\"server\">\n</asp:Content>\n");
                }

                tags["AspNetMasterContent"] = sb.ToString();
            }
            catch (Exception ex) {
                //no big loss if we just insert blank space
                //it's just a template for the user to start editing
                LoggingService.LogWarning("Error generating AspNetMasterContent for template", ex);
            }
        }
コード例 #16
0
 public SolutionItemChangeEventArgs(SolutionItem item, Solution parentSolution, bool reloading) : base(item, parentSolution)
 {
     this.reloading = reloading;
 }
コード例 #17
0
 public SolutionItemEventArgs(SolutionItem entry, Solution solution)
 {
     this.solution = solution;
     this.entry    = entry;
 }
コード例 #18
0
 public SolutionItemEventArgs(SolutionItem entry)
 {
     this.entry = entry;
 }
コード例 #19
0
 public StartupItem(SolutionItem item, SolutionItemRunConfiguration configuration)
 {
     SolutionItem     = item;
     RunConfiguration = configuration;
 }
コード例 #20
0
        public void ModelQueries()
        {
            DotNetProject     it2, it3, it4;
            DummySolutionItem it1;
            string            someFile, someId;

            Workspace ws  = new Workspace();
            Workspace cws = new Workspace();

            ws.Items.Add(cws);

            Solution sol1 = new Solution();

            cws.Items.Add(sol1);
            sol1.RootFolder.Items.Add(it1 = new DummySolutionItem());
            sol1.RootFolder.Items.Add(it2 = Services.ProjectService.CreateDotNetProject("C#"));

            Solution sol2 = new Solution();

            cws.Items.Add(sol2);
            SolutionFolder f = new SolutionFolder();

            sol2.RootFolder.Items.Add(f);
            f.Items.Add(it3 = Services.ProjectService.CreateDotNetProject("C#"));
            f.Items.Add(it4 = Services.ProjectService.CreateDotNetProject("C#"));

            it3.Name     = "it3";
            it4.FileName = "/test/it4";
            someFile     = it4.FileName;
            someId       = it3.ItemId;
            Assert.IsFalse(string.IsNullOrEmpty(someId));

            Assert.AreEqual(2, sol1.Items.Count);
            Assert.IsTrue(sol1.Items.Contains(it1));
            Assert.IsTrue(sol1.Items.Contains(it2));

            Assert.AreEqual(2, sol2.Items.Count);
            Assert.IsTrue(sol2.Items.Contains(it3));
            Assert.IsTrue(sol2.Items.Contains(it4));

            var its = ws.GetAllItems <SolutionFolderItem> ().ToList();

            Assert.AreEqual(7, its.Count);
            Assert.IsTrue(its.Contains(it1));
            Assert.IsTrue(its.Contains(it2));
            Assert.IsTrue(its.Contains(it3));
            Assert.IsTrue(its.Contains(it4));
            Assert.IsTrue(its.Contains(sol1.RootFolder));
            Assert.IsTrue(its.Contains(sol2.RootFolder));
            Assert.IsTrue(its.Contains(f));

            var its2 = ws.GetAllItems <DotNetProject> ().ToList();

            Assert.AreEqual(3, its2.Count);
            Assert.IsTrue(its2.Contains(it2));
            Assert.IsTrue(its2.Contains(it3));
            Assert.IsTrue(its2.Contains(it4));

            var its3 = ws.GetAllItems <Project> ().ToList();

            Assert.AreEqual(3, its3.Count);
            Assert.IsTrue(its3.Contains(it2));
            Assert.IsTrue(its3.Contains(it3));
            Assert.IsTrue(its3.Contains(it4));

            var its4 = ws.GetAllItems <Solution> ().ToList();

            Assert.AreEqual(2, its4.Count);
            Assert.IsTrue(its4.Contains(sol1));
            Assert.IsTrue(its4.Contains(sol2));

            var its5 = ws.GetAllItems <WorkspaceItem> ().ToList();

            Assert.AreEqual(4, its5.Count);
            Assert.IsTrue(its5.Contains(ws));
            Assert.IsTrue(its5.Contains(cws));
            Assert.IsTrue(its5.Contains(sol2));
            Assert.IsTrue(its5.Contains(sol2));

            var its6 = ws.GetAllItems <Workspace> ().ToList();

            Assert.AreEqual(2, its6.Count);
            Assert.IsTrue(its6.Contains(ws));
            Assert.IsTrue(its6.Contains(cws));

            SolutionFolderItem si = sol2.GetSolutionItem(someId);

            Assert.AreEqual(it3, si);

            SolutionItem fi = sol2.FindSolutionItem(someFile);

            Assert.AreEqual(it4, fi);

            fi = sol2.FindProjectByName("it3");
            Assert.AreEqual(it3, fi);

            fi = sol2.FindProjectByName("it4");
            Assert.AreEqual(it4, fi);

            fi = sol2.FindProjectByName("it2");
            Assert.IsNull(fi);

            ws.Dispose();
            cws.Dispose();
        }
コード例 #21
0
 public void AddItem(SolutionItem item)
 {
     AddItem(item, false);
 }
コード例 #22
0
        public void ModelQueries()
        {
            DotNetProject     it2, it3, it4;
            DummySolutionItem it1;
            string            someFile, someId;

            Workspace ws  = new Workspace();
            Workspace cws = new Workspace();

            ws.Items.Add(cws);

            Solution sol1 = new Solution();

            cws.Items.Add(sol1);
            sol1.RootFolder.Items.Add(it1 = new DummySolutionItem());
            sol1.RootFolder.Items.Add(it2 = new DotNetAssemblyProject("C#"));

            Solution sol2 = new Solution();

            cws.Items.Add(sol2);
            SolutionFolder f = new SolutionFolder();

            sol2.RootFolder.Items.Add(f);
            f.Items.Add(it3 = new DotNetAssemblyProject("C#"));
            f.Items.Add(it4 = new DotNetAssemblyProject("C#"));

            it3.Name     = "it3";
            it4.FileName = "/test/it4";
            someFile     = it4.FileName;
            someId       = it3.ItemId;
            Assert.IsFalse(string.IsNullOrEmpty(someId));

            Assert.AreEqual(2, sol1.Items.Count);
            Assert.IsTrue(sol1.Items.Contains(it1));
            Assert.IsTrue(sol1.Items.Contains(it2));

            Assert.AreEqual(2, sol2.Items.Count);
            Assert.IsTrue(sol2.Items.Contains(it3));
            Assert.IsTrue(sol2.Items.Contains(it4));

            ReadOnlyCollection <SolutionItem> its = ws.GetAllSolutionItems();

            Assert.AreEqual(7, its.Count);
            Assert.IsTrue(its.Contains(it1));
            Assert.IsTrue(its.Contains(it2));
            Assert.IsTrue(its.Contains(it3));
            Assert.IsTrue(its.Contains(it4));
            Assert.IsTrue(its.Contains(sol1.RootFolder));
            Assert.IsTrue(its.Contains(sol2.RootFolder));
            Assert.IsTrue(its.Contains(f));

            ReadOnlyCollection <DotNetProject> its2 = ws.GetAllSolutionItems <DotNetProject> ();

            Assert.AreEqual(3, its2.Count);
            Assert.IsTrue(its2.Contains(it2));
            Assert.IsTrue(its2.Contains(it3));
            Assert.IsTrue(its2.Contains(it4));

            ReadOnlyCollection <Project> its3 = ws.GetAllProjects();

            Assert.AreEqual(3, its3.Count);
            Assert.IsTrue(its3.Contains(it2));
            Assert.IsTrue(its3.Contains(it3));
            Assert.IsTrue(its3.Contains(it4));

            ReadOnlyCollection <Solution> its4 = ws.GetAllSolutions();

            Assert.AreEqual(2, its4.Count);
            Assert.IsTrue(its4.Contains(sol1));
            Assert.IsTrue(its4.Contains(sol2));

            ReadOnlyCollection <WorkspaceItem> its5 = ws.GetAllItems();

            Assert.AreEqual(4, its5.Count);
            Assert.IsTrue(its5.Contains(ws));
            Assert.IsTrue(its5.Contains(cws));
            Assert.IsTrue(its5.Contains(sol2));
            Assert.IsTrue(its5.Contains(sol2));

            ReadOnlyCollection <Workspace> its6 = ws.GetAllItems <Workspace> ();

            Assert.AreEqual(2, its6.Count);
            Assert.IsTrue(its6.Contains(ws));
            Assert.IsTrue(its6.Contains(cws));

            SolutionEntityItem fi = ws.FindSolutionItem(someFile);

            Assert.AreEqual(it4, fi);

            fi = ws.FindSolutionItem(someFile + ".wrong");
            Assert.IsNull(fi);

            SolutionItem si = sol2.GetSolutionItem(someId);

            Assert.AreEqual(it3, si);

            fi = sol2.FindSolutionItem(someFile);
            Assert.AreEqual(it4, fi);

            fi = sol2.FindProjectByName("it3");
            Assert.AreEqual(it3, fi);

            fi = sol2.FindProjectByName("it4");
            Assert.AreEqual(it4, fi);

            fi = sol2.FindProjectByName("it2");
            Assert.IsNull(fi);
        }
コード例 #23
0
 public SolutionItemModifiedEventArgs(SolutionItem item, string hint)
 {
     Add(new SolutionItemModifiedEventInfo(item, hint));
 }
コード例 #24
0
 public bool CanDeploy(MonoDevelop.Projects.SolutionItem entry, MakefileType type)
 {
     return(entry is ValaProject);
 }
コード例 #25
0
 public SolutionItemRenamedEventArgs(SolutionItem node, string oldName, string newName)
     : base(node)
 {
     this.oldName = oldName;
     this.newName = newName;
 }
コード例 #26
0
 public SolutionItemModifiedEventInfo(SolutionItem item, string hint) : base(item)
 {
     this.hint = hint;
 }
コード例 #27
0
ファイル: SolutionFolder.cs プロジェクト: wjohnke/CSS18
        public async Task <SolutionFolderItem> ReloadItem(ProgressMonitor monitor, SolutionFolderItem sitem)
        {
            if (Items.IndexOf(sitem) == -1)
            {
                throw new InvalidOperationException("Solution item '" + sitem.Name + "' does not belong to folder '" + Name + "'");
            }

            SolutionItem item = sitem as SolutionItem;

            if (item != null)
            {
                // Load the new item

                SolutionItem newItem;
                try {
                    if (ParentSolution.IsSolutionItemEnabled(item.FileName))
                    {
                        using (var ctx = new SolutionLoadContext(ParentSolution))
                            newItem = await Services.ProjectService.ReadSolutionItem(monitor, item.FileName, null, ctx : ctx, itemGuid : item.ItemId);
                    }
                    else
                    {
                        UnknownSolutionItem e = new UnloadedSolutionItem()
                        {
                            FileName = item.FileName
                        };
                        e.ItemId   = item.ItemId;
                        e.TypeGuid = item.TypeGuid;
                        newItem    = e;
                    }
                } catch (Exception ex) {
                    UnknownSolutionItem e = new UnknownSolutionItem();
                    e.LoadError = ex.Message;
                    e.FileName  = item.FileName;
                    newItem     = e;
                }

                if (!Items.Contains(item))
                {
                    // The old item is gone, which probably means it has already been reloaded (BXC20615), or maybe removed.
                    // In this case, there isn't anything else we can do
                    newItem.Dispose();

                    // Find the replacement if it exists
                    return(Items.OfType <SolutionItem> ().FirstOrDefault(it => it.FileName == item.FileName));
                }

                // Replace in the file list
                Items.Replace(item, newItem);

                item.ParentFolder = null;
                DisconnectChildEntryEvents(item);
                ConnectChildEntryEvents(newItem);

                NotifyModified("Items");
                OnItemRemoved(new SolutionItemChangeEventArgs(item, ParentSolution, true)
                {
                    ReplacedItem = item
                }, true);
                OnItemAdded(new SolutionItemChangeEventArgs(newItem, ParentSolution, true)
                {
                    ReplacedItem = item
                }, true);

                item.Dispose();
                return(newItem);
            }
            else
            {
                return(sitem);
            }
        }
コード例 #28
0
ファイル: ProjectService.cs プロジェクト: wjohnke/CSS18
        static void UpdateReadSolutionItemMetadata(IDictionary <string, string> metadata, SolutionItem item)
        {
            metadata ["ProjectType"] = item.TypeGuid;
            metadata ["ProjectID"]   = item.ItemId;
            metadata ["LoadSucceed"] = bool.TrueString;

            var project = item as Project;

            if (project == null)
            {
                return;
            }

            // Use TypeGuid by default for ProjectFlavor.
            metadata ["ProjectFlavor"] = project.FlavorGuids.FirstOrDefault() ?? item.TypeGuid;
            metadata ["Flavors"]       = string.Join(";", project.GetItemTypeGuids());

            var capabilities = project.GetProjectCapabilities();

            if (capabilities.Any())
            {
                metadata ["Capabilities"] = string.Join(" ", capabilities);
            }
        }
コード例 #29
0
        void SignalBuildToContinue(SolutionItem p)
        {
            var file = p.FileName.ParentDirectory.Combine("continue-event");

            File.WriteAllText(file, "");
        }
コード例 #30
0
        public SolutionConfigurationEntry AddItem(SolutionItem item)
        {
            string conf = FindMatchingConfiguration(item);

            return(AddItem(item, conf != null, conf));
        }