示例#1
0
        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.LoadError.TrimEnd('.');
                nodeInfo.Label          = escapedProjectName;
                nodeInfo.DisabledStyle  = true;
                nodeInfo.Icon           = Context.GetIcon(p.StockIcon);
                return;
            }

            nodeInfo.Icon = Context.GetIcon(p.StockIcon);
            if (p.ParentSolution != null && p.ParentSolution.SingleStartup && p.ParentSolution.StartupItem == p)
            {
                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");
                }
            }
        }
        void OnSetConfigurationsData(Gtk.TreeViewColumn treeColumn, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            SolutionConfigurationEntry entry = (SolutionConfigurationEntry)store.GetValue(iter, 0);

            ConfigurationData data = parentDialog.ConfigurationData.FindConfigurationData(entry.Item);

            string[] values = new string [data.Configurations.Count];
            for (int n = 0; n < values.Length; n++)
            {
                values [n] = data.Configurations [n].Id;
            }
            CellRendererComboBox comboCell = (CellRendererComboBox)cell;

            comboCell.Values = values;

            var escaped = GLib.Markup.EscapeText(entry.ItemConfiguration);

            if (entry.Item.Configurations [entry.ItemConfiguration] == null)
            {
                comboCell.Markup = string.Format("<span color='red'>{0}</span>", escaped);
            }
            else
            {
                comboCell.Markup = escaped;
            }
        }
示例#3
0
        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);
            string iconName;

            if (p is DotNetProject && ((DotNetProject)p).LanguageBinding == null)
            {
                iconName       = Gtk.Stock.DialogError;
                nodeInfo.Label = GettextCatalog.GetString("{0} <span foreground='red' size='small'>(Unknown language '{1}')</span>", escapedProjectName, ((DotNetProject)p).LanguageName);
            }
            else if (p is UnknownProject)
            {
                var up = (UnknownProject)p;
                nodeInfo.OverlayBottomLeft = ImageService.GetIcon(Stock.Warning).WithSize(10, 10);
                nodeInfo.Label             = "<span foreground='gray'>" + escapedProjectName + " <small>(" + GLib.Markup.EscapeText(up.LoadError.TrimEnd('.')) + ")</small></span>";
                nodeInfo.Icon = Context.GetIcon(p.StockIcon).WithAlpha(0.5);
                return;
            }
            else
            {
                iconName = p.StockIcon;
                if (p.ParentSolution != null && p.ParentSolution.SingleStartup && p.ParentSolution.StartupItem == p)
                {
                    nodeInfo.Label = "<b>" + escapedProjectName + "</b>";
                }
                else
                {
                    nodeInfo.Label = escapedProjectName;
                }
            }

            nodeInfo.Icon = Context.GetIcon(iconName);

            // 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)))
            {
                var ticon = Context.GetComposedIcon(nodeInfo.Icon, "project-no-build");
                if (ticon == null)
                {
                    ticon = Context.CacheComposedIcon(nodeInfo.Icon, "project-no-build", nodeInfo.Icon.WithAlpha(0.5));
                }
                nodeInfo.Icon  = ticon;
                nodeInfo.Label = missingConfig
                                        ? "<span foreground='red'>" + nodeInfo.Label + " <small>(invalid configuration mapping)</small></span>"
                                        : "<span foreground='gray'>" + nodeInfo.Label + " <small>(not built in active configuration)</small></span>";
            }
        }
        public void Update(HashSet <object> modifiedObjects)
        {
            foreach (ItemConfiguration conf in configurations)
            {
                ItemConfiguration old = entry.Configurations [conf.Id];
                if (old != null)
                {
                    old.CopyFrom(conf);
                }
                else
                {
                    entry.Configurations.Add(conf);
                }
            }
            List <ItemConfiguration> toRemove = new List <ItemConfiguration> ();

            foreach (ItemConfiguration conf in entry.Configurations)
            {
                if (configurations [conf.Id] == null)
                {
                    toRemove.Add(conf);
                }
            }

            foreach (ItemConfiguration conf in toRemove)
            {
                entry.Configurations.Remove(conf);
            }

            foreach (ConfigurationData data in children)
            {
                data.Update(modifiedObjects);
            }

            // If configurations have been renamed, update the references in the solution
            SolutionEntityItem item = entry as SolutionEntityItem;

            if (item != null && renameData.Count > 0)
            {
                Solution sol = item.ParentSolution;
                if (sol != null)
                {
                    foreach (RenameData rd in renameData)
                    {
                        foreach (SolutionConfiguration sc in sol.Configurations)
                        {
                            SolutionConfigurationEntry sce = sc.GetEntryForItem(item);
                            if (sce != null && sce.ItemConfiguration == rd.OldName)
                            {
                                sce.ItemConfiguration = rd.NewName;
                                modifiedObjects.Add(sol);
                            }
                        }
                    }
                }
            }
        }
        void OnBuildToggled(object sender, ToggledArgs args)
        {
            TreeIter iter;

            if (store.GetIter(out iter, new TreePath(args.Path)))
            {
                SolutionConfigurationEntry entry = (SolutionConfigurationEntry)store.GetValue(iter, 0);
                entry.Build = !entry.Build;
                store.SetValue(iter, 2, entry.Build);
            }
        }
示例#6
0
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
        {
            base.BuildNode(treeBuilder, dataObject, ref label, ref icon, ref closedIcon);

            Project p = dataObject as Project;

            string escapedProjectName = GLib.Markup.EscapeText(p.Name);
            string iconName;

            if (p is DotNetProject && ((DotNetProject)p).LanguageBinding == null)
            {
                iconName = Gtk.Stock.DialogError;
                label    = GettextCatalog.GetString("{0} <span foreground='red' size='small'>(Unknown language '{1}')</span>", escapedProjectName, ((DotNetProject)p).LanguageName);
            }
            else if (p is UnknownProject)
            {
                iconName = Gtk.Stock.DialogError;
                label    = GettextCatalog.GetString("{0} <span foreground='red' size='small'>(Unknown project type)</span>", escapedProjectName);
            }
            else
            {
                iconName = p.StockIcon;
                if (p.ParentSolution != null && p.ParentSolution.SingleStartup && p.ParentSolution.StartupItem == p)
                {
                    label = "<b>" + escapedProjectName + "</b>";
                }
                else
                {
                    label = escapedProjectName;
                }
            }

            icon = Context.GetIcon(iconName);

            // 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 (noMapping || !ce.Build || (missingConfig = p.Configurations [ce.ItemConfiguration] == null))
            {
                Gdk.Pixbuf ticon = Context.GetComposedIcon(icon, "project-no-build");
                if (ticon == null)
                {
                    ticon = Context.CacheComposedIcon(icon, "project-no-build", ImageService.MakeTransparent(icon, 0.5));
                }
                icon  = ticon;
                label = missingConfig
                                        ? "<span foreground='red'>" + label + " <small>(invalid configuration mapping)</small></span>"
                                        : "<span foreground='gray'>" + label + " <small>(not built in active configuration)</small></span>";
            }
        }
        void OnSetConfigurationsData(Gtk.TreeViewColumn treeColumn, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            SolutionConfigurationEntry entry = (SolutionConfigurationEntry)store.GetValue(iter, 0);

            ConfigurationData data = parentDialog.ConfigurationData.FindConfigurationData(entry.Item);

            string[] values = new string [data.Configurations.Count];
            for (int n = 0; n < values.Length; n++)
            {
                values [n] = data.Configurations [n].Id;
            }
            CellRendererComboBox comboCell = (CellRendererComboBox)cell;

            comboCell.Values = values;
            comboCell.Text   = entry.ItemConfiguration;
        }
        void OnConfigSelectionChanged(object s, ComboSelectionChangedArgs args)
        {
            TreeIter iter;

            if (store.GetIter(out iter, new TreePath(args.Path)))
            {
                SolutionConfigurationEntry entry = (SolutionConfigurationEntry)store.GetValue(iter, 0);
                if (args.Active != -1)
                {
                    ConfigurationData data = parentDialog.ConfigurationData.FindConfigurationData(entry.Item);
                    entry.ItemConfiguration = data.Configurations [args.Active].Id;
                }
                else
                {
                    entry.ItemConfiguration = null;
                }
            }
        }
        void CreateCombineConfigurations(SolutionFolder folder)
        {
            IDictionary extendedProperties = folder.ExtendedProperties;

            CombineConfigurationSet configs = CreateCombineConfigurationSet(folder.ParentSolution, folder.IsRoot);

            configs.Active = folder.ParentSolution.DefaultConfigurationId;

            extendedProperties ["Configurations"] = configs;

            foreach (SolutionItem it in folder.Items)
            {
                if (it is SolutionFolder)
                {
                    foreach (SolutionConfiguration conf in folder.ParentSolution.Configurations)
                    {
                        CombineConfiguration      cc = configs.GetConfig(conf.Id);
                        CombineConfigurationEntry ce = new CombineConfigurationEntry(it.Name, true, conf.Id);
                        cc.Entries.Add(ce);
                    }
                    CreateCombineConfigurations((SolutionFolder)it);
                }
                else if (it is SolutionEntityItem)
                {
                    SolutionEntityItem sit = (SolutionEntityItem)it;
                    foreach (SolutionConfiguration conf in folder.ParentSolution.Configurations)
                    {
                        CombineConfiguration       cc  = configs.GetConfig(conf.Id);
                        SolutionConfigurationEntry sce = conf.GetEntryForItem(sit);
                        CombineConfigurationEntry  ce  = null;
                        if (sce == null)
                        {
                            ce = new CombineConfigurationEntry(it.Name, true, conf.Id);
                        }
                        else
                        {
                            ce = new CombineConfigurationEntry(it.Name, sce.Build, sce.ItemConfiguration);
                        }
                        cc.Entries.Add(ce);
                    }
                }
            }
        }
示例#10
0
        /* Gets the CombineConfigurationEntry corresponding to the @entry in its parentCombine's
         * CombineConfiguration. Creates the required bits if not present */
        SolutionConfigurationEntry GetConfigEntry(Solution sol, SolutionItem item, string configName)
        {
            configName = FromSlnConfigurationId(configName);

            SolutionConfiguration solutionConfig = sol.Configurations [configName];

            if (solutionConfig == null)
            {
                solutionConfig = CreateSolutionConfigurationFromId(configName);
                sol.Configurations.Add(solutionConfig);
            }

            SolutionConfigurationEntry conf = solutionConfig.GetEntryForItem(item);

            if (conf != null)
            {
                return(conf);
            }
            return(solutionConfig.AddItem(item));
        }
        void CreateSolutionConfigurations(Solution sol)
        {
            CombineConfigurationSet configs = (CombineConfigurationSet)sol.ExtendedProperties ["Configurations"];

            foreach (CombineConfiguration config in configs.Configurations)
            {
                SolutionConfiguration sconf = config.SolutionConfiguration ?? new SolutionConfiguration(config.Name);
                sol.Configurations.Add(sconf);
            }

            foreach (SolutionEntityItem item in sol.GetAllSolutionItems <SolutionEntityItem> ())
            {
                List <IExtendedDataItem> chain = new List <IExtendedDataItem> ();
                SolutionItem             it    = item;
                while (it != null)
                {
                    chain.Insert(0, it);
                    it = it.ParentFolder;
                }
                chain [0] = sol;

                foreach (SolutionConfiguration sconfig in sol.Configurations)
                {
                    SolutionConfigurationEntry se = sconfig.AddItem(item);
                    string itemConfig             = FindItemConfiguration(chain, sconfig.Id);
                    if (itemConfig != null)
                    {
                        se.Build             = true;
                        se.ItemConfiguration = itemConfig;
                    }
                    else
                    {
                        se.Build = false;
                    }
                }
            }

            sol.DefaultConfigurationId = configs.Active;
        }
		public ItemConfiguration AddConfiguration (string name, string sourceName, bool createChildConfigurations)
		{
			ItemConfiguration conf = entry.CreateConfiguration (name);

			if (sourceName != null) {
				ItemConfiguration sc = configurations [sourceName];
				if (sc != null)
					conf.CopyFrom (sc);
				else
					sourceName = null;
			}
			
			if (entry is Solution) {
				SolutionConfiguration cc = (SolutionConfiguration) conf;
				foreach (ConfigurationData data in children) {
					SolutionConfigurationEntry ce = null;
					if (sourceName != null)
						ce = cc.GetEntryForItem ((SolutionEntityItem)data.Entry);
					if (ce == null)
						ce = cc.AddItem ((SolutionEntityItem) data.Entry);
					if (ce == null)
						continue;
					if (createChildConfigurations) {
						ce.ItemConfiguration = name;
						if (data.Configurations [name] == null)
							data.AddConfiguration (name, sourceName, createChildConfigurations);
					} else if (sourceName == null) {
						if (data.Configurations.Count > 0)
							ce.ItemConfiguration = data.Configurations [0].Id;
					}
				}
			}
			
			configurations.Add (conf);
			if (ConfigurationsChanged != null)
				ConfigurationsChanged (this, null);
			return conf;
		}
示例#13
0
        void LoadProjectConfigurationMappings(SlnPropertySetCollection sets, Solution sln, Dictionary <string, SolutionFolderItem> items, ProgressMonitor monitor)
        {
            if (sets == null)
            {
                return;
            }

            Dictionary <string, SolutionConfigurationEntry> cache = new Dictionary <string, SolutionConfigurationEntry> ();
            Dictionary <string, string> ignoredProjects           = new Dictionary <string, string> ();

            foreach (var pset in sets)
            {
                var projGuid = pset.Id;

                if (!items.ContainsKey(projGuid))
                {
                    if (ignoredProjects.ContainsKey(projGuid))
                    {
                        // already warned
                        continue;
                    }

                    LoggingService.LogWarning(GettextCatalog.GetString("{0} ({1}) : Project with guid = '{2}' not found or not loaded. Ignoring",
                                                                       sln.FileName, pset.Line + 1, projGuid));
                    ignoredProjects [projGuid] = projGuid;
                    continue;
                }

                SolutionFolderItem it;
                if (!items.TryGetValue(projGuid, out it))
                {
                    continue;
                }

                SolutionItem item = it as SolutionItem;

                if (item == null || !item.SupportsConfigurations())
                {
                    continue;
                }

                //Format:
                // {projectGuid}.SolutionConfigName|SolutionPlatform.ActiveCfg = ProjConfigName|ProjPlatform
                // {projectGuid}.SolutionConfigName|SolutionPlatform.Build.0 = ProjConfigName|ProjPlatform
                // {projectGuid}.SolutionConfigName|SolutionPlatform.Deploy.0 = ProjConfigName|ProjPlatform

                foreach (var prop in pset)
                {
                    string action;
                    string projConfig = prop.Value;

                    string left = prop.Key;
                    if (left.EndsWith(".ActiveCfg"))
                    {
                        action = "ActiveCfg";
                        left   = left.Substring(0, left.Length - 10);
                    }
                    else if (left.EndsWith(".Build.0"))
                    {
                        action = "Build.0";
                        left   = left.Substring(0, left.Length - 8);
                    }
                    else if (left.EndsWith(".Deploy.0"))
                    {
                        action = "Deploy.0";
                        left   = left.Substring(0, left.Length - 9);
                    }
                    else
                    {
                        LoggingService.LogWarning(GettextCatalog.GetString("{0} ({1}) : Unknown action. Only ActiveCfg, Build.0 and Deploy.0 supported.",
                                                                           sln.FileName, pset.Line));
                        continue;
                    }

                    string slnConfig = left;

                    string key = projGuid + "." + slnConfig;
                    SolutionConfigurationEntry combineConfigEntry = null;
                    if (cache.ContainsKey(key))
                    {
                        combineConfigEntry = cache [key];
                    }
                    else
                    {
                        combineConfigEntry       = GetConfigEntry(sln, item, slnConfig);
                        combineConfigEntry.Build = false;                         // Not buildable by default. Build will be enabled if a Build.0 entry is found
                        cache [key] = combineConfigEntry;
                    }

                    /* If both ActiveCfg & Build.0 entries are missing
                     * for a project, then default values :
                     *	ActiveCfg : same as the solution config
                     *	Build : true
                     *
                     * ELSE
                     * if Build (true/false) for the project will
                     * will depend on presence/absence of Build.0 entry
                     */

                    if (action == "ActiveCfg")
                    {
                        combineConfigEntry.ItemConfiguration = FromSlnConfigurationId(projConfig);
                    }
                    else if (action == "Build.0")
                    {
                        combineConfigEntry.Build = true;
                    }
                    else if (action == "Deploy.0")
                    {
                        combineConfigEntry.Deploy = true;
                    }
                }
            }
        }