public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo) { base.BuildNode(treeBuilder, dataObject, nodeInfo); Project p = dataObject as Project; string escapedProjectName = GLib.Markup.EscapeText(p.Name); if (p is DotNetProject && ((DotNetProject)p).LanguageBinding == null) { nodeInfo.Icon = Context.GetIcon(Stock.Project); nodeInfo.Label = escapedProjectName; nodeInfo.StatusSeverity = TaskSeverity.Error; nodeInfo.StatusMessage = GettextCatalog.GetString("Unknown language '{0}'", ((DotNetProject)p).LanguageName); nodeInfo.DisabledStyle = true; return; } else if (p is UnknownProject) { var up = (UnknownProject)p; nodeInfo.StatusSeverity = TaskSeverity.Warning; nodeInfo.StatusMessage = up.UnsupportedProjectMessage.TrimEnd('.'); nodeInfo.Label = escapedProjectName; nodeInfo.DisabledStyle = true; nodeInfo.Icon = Context.GetIcon(p.StockIcon); return; } nodeInfo.Icon = Context.GetIcon(p.StockIcon); var sc = p.ParentSolution?.StartupConfiguration; if (sc != null && IsStartupProject(p, sc)) { nodeInfo.Label = "<b>" + escapedProjectName + "</b>"; } else { nodeInfo.Label = escapedProjectName; } // Gray out the project name if it is not selected in the current build configuration SolutionConfiguration conf = p.ParentSolution.GetConfiguration(IdeApp.Workspace.ActiveConfiguration); SolutionConfigurationEntry ce = null; bool noMapping = conf == null || (ce = conf.GetEntryForItem(p)) == null; bool missingConfig = false; if (p.SupportsBuild() && (noMapping || !ce.Build || (missingConfig = p.Configurations [ce.ItemConfiguration] == null))) { nodeInfo.DisabledStyle = true; if (missingConfig) { nodeInfo.StatusSeverity = TaskSeverity.Error; nodeInfo.StatusMessage = GettextCatalog.GetString("Invalid configuration mapping"); } else { nodeInfo.StatusSeverity = TaskSeverity.Information; nodeInfo.StatusMessage = GettextCatalog.GetString("Project not built in active configuration"); } } }
string GetSelectedConfiguration(SolutionItem item) { var entry = configuration.GetEntryForItem(item); return(entry != null ? entry.ItemConfiguration : (item.DefaultConfiguration != null ? item.DefaultConfiguration.Id : "")); }