void SelectActiveConfiguration()
        {
            configurationCombo.Changed -= HandleConfigurationChanged;
            string name = configurationMerger.GetUnresolvedConfiguration(IdeApp.Workspace.ActiveConfigurationId);
            int    i    = 0;

            Gtk.TreeIter iter;
            if (configurationStore.GetIterFirst(out iter))
            {
                do
                {
                    string val = (string)configurationStore.GetValue(iter, 1);
                    if (name == val)
                    {
                        configurationCombo.Active = i;
                        break;
                    }
                    i++;
                }while (configurationStore.IterNext(ref iter));
            }
            var validTargets = configurationMerger.GetTargetsForConfiguration(IdeApp.Workspace.ActiveConfigurationId, false).ToArray();

            if (IdeApp.Workspace.PreferredActiveExecutionTarget == null || !validTargets.Any(t => t.Id == IdeApp.Workspace.PreferredActiveExecutionTarget))
            {
                IdeApp.Workspace.ActiveExecutionTarget = validTargets.FirstOrDefault();
            }

            configurationCombo.Changed += HandleConfigurationChanged;
            SelectActiveRuntime();
        }
Beispiel #2
0
        void FillRuntimes()
        {
            runtimeCombo.Changed -= HandleRuntimeChanged;
            try {
                runtimeStore.Clear();
                if (!IdeApp.Workspace.IsOpen || currentSolution == null || !currentSolution.SingleStartup || currentSolution.StartupItem == null)
                {
                    return;
                }

                // Check that the current startup project is enabled for the current configuration
                var solConf = currentSolution.GetConfiguration(IdeApp.Workspace.ActiveConfiguration);
                if (solConf == null || !solConf.BuildEnabledForItem(currentSolution.StartupItem))
                {
                    return;
                }

                int runtimes = 0;
                foreach (var target in configurationMerger.GetTargetsForConfiguration(IdeApp.Workspace.ActiveConfigurationId, true))
                {
                    runtimeStore.AppendValues(target.Name, target.Name, target);
                    runtimes++;
                }

                runtimeCombo.Sensitive = runtimes > 1;
            } finally {
                runtimeCombo.Changed += HandleRuntimeChanged;
            }
        }
        void FillRuntimes()
        {
            ignoreRuntimeChangedCount++;
            try {
                runtimeStore.Clear();
                if (!IdeApp.Workspace.IsOpen || currentSolution == null || !currentSolution.SingleStartup || currentSolution.StartupItem == null)
                {
                    return;
                }

                // Check that the current startup project is enabled for the current configuration
                var solConf = currentSolution.GetConfiguration(IdeApp.Workspace.ActiveConfiguration);
                if (solConf == null || !solConf.BuildEnabledForItem(currentSolution.StartupItem))
                {
                    return;
                }

                ExecutionTarget previous = null;
                int             runtimes = 0;

                foreach (var target in configurationMerger.GetTargetsForConfiguration(IdeApp.Workspace.ActiveConfigurationId, true))
                {
                    if (target is ExecutionTargetGroup)
                    {
                        var devices = (ExecutionTargetGroup)target;

                        if (previous != null)
                        {
                            runtimeStore.AppendValues(null, false);
                        }

                        runtimeStore.AppendValues(target, false);
                        foreach (var device in devices)
                        {
                            if (device is ExecutionTargetGroup)
                            {
                                var versions = (ExecutionTargetGroup)device;

                                if (versions.Count > 1)
                                {
                                    var iter = runtimeStore.AppendValues(device, true);

                                    foreach (var version in versions)
                                    {
                                        runtimeStore.AppendValues(iter, version, false);
                                        runtimes++;
                                    }
                                }
                                else
                                {
                                    runtimeStore.AppendValues(versions[0], true);
                                    runtimes++;
                                }
                            }
                            else
                            {
                                runtimeStore.AppendValues(device, true);
                                runtimes++;
                            }
                        }
                    }
                    else
                    {
                        if (previous is ExecutionTargetGroup)
                        {
                            runtimeStore.AppendValues(null, false);
                        }

                        runtimeStore.AppendValues(target, false);
                        runtimes++;
                    }

                    previous = target;
                }

                var cmds = IdeApp.CommandService.CreateCommandEntrySet(TargetsMenuPath);
                if (cmds.Count > 0)
                {
                    bool needsSeparator = runtimes > 0;
                    foreach (CommandEntry ce in cmds)
                    {
                        if (ce.CommandId == Command.Separator)
                        {
                            needsSeparator = true;
                            continue;
                        }
                        var cmd = ce.GetCommand(IdeApp.CommandService) as ActionCommand;
                        if (cmd != null)
                        {
                            var ci = IdeApp.CommandService.GetCommandInfo(cmd.Id, new CommandTargetRoute(LastCommandTarget));
                            if (ci.Visible)
                            {
                                if (needsSeparator)
                                {
                                    runtimeStore.AppendValues(null, false);
                                    needsSeparator = false;
                                }
                                runtimeStore.AppendValues(null, false, cmd);
                                runtimes++;
                            }
                        }
                    }
                }

                runtimeCombo.Sensitive = runtimes > 1;
            } finally {
                ignoreRuntimeChangedCount--;
            }
        }
Beispiel #4
0
        void FillRuntimes()
        {
            runtimeCombo.Changed -= HandleRuntimeChanged;
            try {
                runtimeStore.Clear();
                if (!IdeApp.Workspace.IsOpen || currentSolution == null || !currentSolution.SingleStartup || currentSolution.StartupItem == null)
                {
                    return;
                }

                // Check that the current startup project is enabled for the current configuration
                var solConf = currentSolution.GetConfiguration(IdeApp.Workspace.ActiveConfiguration);
                if (solConf == null || !solConf.BuildEnabledForItem(currentSolution.StartupItem))
                {
                    return;
                }

                ExecutionTarget previous = null;
                int             runtimes = 0;

                foreach (var target in configurationMerger.GetTargetsForConfiguration(IdeApp.Workspace.ActiveConfigurationId, true))
                {
                    if (target is ExecutionTargetGroup)
                    {
                        var devices = (ExecutionTargetGroup)target;

                        if (previous != null)
                        {
                            runtimeStore.AppendValues(null, false);
                        }

                        runtimeStore.AppendValues(target, false);
                        foreach (var device in devices)
                        {
                            if (device is ExecutionTargetGroup)
                            {
                                var versions = (ExecutionTargetGroup)device;

                                if (versions.Count > 1)
                                {
                                    var iter = runtimeStore.AppendValues(device, true);

                                    foreach (var version in versions)
                                    {
                                        runtimeStore.AppendValues(iter, version, false);
                                        runtimes++;
                                    }
                                }
                                else
                                {
                                    runtimeStore.AppendValues(versions[0], true);
                                    runtimes++;
                                }
                            }
                            else
                            {
                                runtimeStore.AppendValues(device, true);
                                runtimes++;
                            }
                        }
                    }
                    else
                    {
                        if (previous is ExecutionTargetGroup)
                        {
                            runtimeStore.AppendValues(null, false);
                        }

                        runtimeStore.AppendValues(target, false);
                        runtimes++;
                    }

                    previous = target;
                }

                runtimeCombo.Sensitive = runtimes > 1;
            } finally {
                runtimeCombo.Changed += HandleRuntimeChanged;
            }
        }