コード例 #1
0
        public static ProgressMonitor GetProgressMonitor(string operation, VersionControlOperationType op)
        {
            IconId padIcon, statusIcon;
            bool   cancellable;

            switch (op)
            {
            case VersionControlOperationType.Pull:
                padIcon     = Stock.PadDownload;
                statusIcon  = Stock.StatusDownload;
                cancellable = true;
                break;

            case VersionControlOperationType.Push:
                padIcon     = Stock.PadUpload;
                statusIcon  = Stock.StatusUpload;
                cancellable = true;
                break;

            default:
                padIcon     = "md-version-control";
                statusIcon  = "md-version-control";
                cancellable = false;
                break;
            }

            ProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor("MonoDevelop.VersionControlOutput", GettextCatalog.GetString("Version Control"), padIcon, false, true);
            Pad             outPad  = IdeApp.Workbench.ProgressMonitors.GetPadForMonitor(monitor);

            AggregatedProgressMonitor mon = new AggregatedProgressMonitor(monitor);

            mon.AddFollowerMonitor(IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor(operation, statusIcon, false, true, false, outPad, cancellable));
            return(mon);
        }
        protected override bool OnBuild(ProgressMonitor monitor, DeployContext ctx)
        {
            string             sourceFile;
            SolutionFolderItem entry = RootSolutionItem;

            if (entry is SolutionFolder)
            {
                sourceFile = entry.ParentSolution.FileName;
            }
            else
            {
                sourceFile = ((SolutionItem)entry).FileName;
            }

            AggregatedProgressMonitor mon = new AggregatedProgressMonitor();

            mon.AddSlaveMonitor(monitor, MonitorAction.WriteLog | MonitorAction.ReportError | MonitorAction.ReportWarning | MonitorAction.ReportSuccess);

            string tmpFolder = FileService.CreateTempDirectory();

            try {
                string tf = Path.GetFileNameWithoutExtension(targetFile);
                if (tf.EndsWith(".tar"))
                {
                    tf = Path.GetFileNameWithoutExtension(tf);
                }

                string folder = FileService.GetFullPath(Path.Combine(tmpFolder, tf));
                Directory.CreateDirectory(folder);

                // Export the project

                SolutionFolderItem[] ents   = GetChildEntries();
                string[]             epaths = new string [ents.Length];
                for (int n = 0; n < ents.Length; n++)
                {
                    epaths [n] = ents [n].ItemId;
                }

                var r = Services.ProjectService.Export(mon, sourceFile, epaths, folder, FileFormat).Result;
                if (string.IsNullOrEmpty(r))
                {
                    return(false);
                }

                // Create the archive
                string td = Path.GetDirectoryName(targetFile);
                if (!Directory.Exists(td))
                {
                    Directory.CreateDirectory(td);
                }
                DeployService.CreateArchive(mon, tmpFolder, targetFile);
            }
            finally {
                Directory.Delete(tmpFolder, true);
            }
            monitor.Log.WriteLine(GettextCatalog.GetString("Created file: {0}", targetFile));
            return(true);
        }
        public override void Run()
        {
            var commandLine = PaketCommandLine.CreateCommandLine("outdated");
            var message     = ProgressMonitorStatusMessageFactory.CreateOutdatedMessage();
            AggregatedProgressMonitor progressMonitor = CreateProgressMonitor(message);

            PaketConsolePad.Show(progressMonitor);
            PaketServices.CommandRunner.Run(commandLine, message, progressMonitor);
        }
コード例 #4
0
        internal static void QueryAddinUpdates()
        {
            AggregatedProgressMonitor monitor = UpdateMonitor;

            if (monitor != null)
            {
                monitor.AsyncOperation.WaitForCompleted();
            }
        }
コード例 #5
0
        public IProgressMonitor GetBuildProgressMonitor()
        {
            Pad          pad              = IdeApp.Workbench.GetPad <ErrorListPad> ();
            ErrorListPad errorPad         = (ErrorListPad)pad.Content;
            AggregatedProgressMonitor mon = new AggregatedProgressMonitor(errorPad.GetBuildProgressMonitor());

            mon.AddSlaveMonitor(GetStatusProgressMonitor(GettextCatalog.GetString("Building..."), Stock.BuildCombine, false, true, false, pad));
            return(mon);
        }
コード例 #6
0
ファイル: ProgressMonitors.cs プロジェクト: t9up/monodevelop
        private ProgressMonitor GetBuildProgressMonitor(string statusText)
        {
            Pad          pad              = IdeApp.Workbench.GetPad <ErrorListPad> ();
            ErrorListPad errorPad         = (ErrorListPad)pad.Content;
            AggregatedProgressMonitor mon = new AggregatedProgressMonitor(errorPad.GetBuildProgressMonitor());

            mon.AddFollowerMonitor(GetStatusProgressMonitor(statusText, Stock.StatusBuild, false, true, false, pad, true));
            return(mon);
        }
コード例 #7
0
        public static IProgressMonitor GetProgressMonitor(string operation)
        {
            IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor("MonoDevelop.VersionControlOutput", "Version Control", "md-version-control", false, true);
            Pad outPad = IdeApp.Workbench.ProgressMonitors.GetPadForMonitor(monitor);

            AggregatedProgressMonitor mon = new AggregatedProgressMonitor(monitor);

            mon.AddSlaveMonitor(IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor(operation, "md-version-control", true, true, false, outPad));
            return(mon);
        }
コード例 #8
0
        public void TestReportObjectToFollowers()
        {
            var main = new ProgressMonitor();
            var m    = new ReportObjectMonitor();
            var agr  = new AggregatedProgressMonitor(main, m);
            var foo  = new object();

            agr.ReportObject(foo);
            Assert.IsTrue(m.ReportedObjects.Contains(foo));
        }
コード例 #9
0
 public static void Show(AggregatedProgressMonitor monitor)
 {
     Runtime.RunInMainThread(() => {
         Pad pad = IdeApp.Workbench.ProgressMonitors.GetPadForMonitor(monitor.LeaderMonitor);
         if (pad != null)
         {
             pad.BringToFront();
         }
     });
 }
コード例 #10
0
 ProgressMonitor GetBuildProgressMonitor(string statusText)
 {
     return(Runtime.RunInMainThread(() => {
         Pad pad = IdeApp.Workbench.GetPad <ErrorListPad> ();
         ErrorListPad errorPad = (ErrorListPad)pad.Content;
         AggregatedProgressMonitor mon = new AggregatedProgressMonitor(errorPad.GetBuildProgressMonitor());
         mon.AddFollowerMonitor(GetStatusProgressMonitor(statusText, Stock.StatusBuild, false, true, false, pad, true));
         return mon;
     }).Result);
 }
コード例 #11
0
        protected internal override void OnExecute(IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration)
        {
            if (SingleStartup)
            {
                if (StartupItem == null)
                {
                    monitor.ReportError(GettextCatalog.GetString("Startup item not set"), null);
                    return;
                }
                StartupItem.Execute(monitor, context, configuration);
            }
            else
            {
                List <IAsyncOperation> list = new List <IAsyncOperation> ();
                monitor.BeginTask("Executing projects", 1);

                SynchronizedProgressMonitor syncMonitor = new SynchronizedProgressMonitor(monitor);

                foreach (SolutionEntityItem it in MultiStartupItems)
                {
                    if (!it.CanExecute(context, configuration))
                    {
                        continue;
                    }
                    AggregatedProgressMonitor mon = new AggregatedProgressMonitor();
                    mon.AddSlaveMonitor(syncMonitor, MonitorAction.ReportError | MonitorAction.ReportWarning | MonitorAction.SlaveCancel);
                    list.Add(mon.AsyncOperation);
                    SolutionEntityItem cit = it;

                    Thread t = new Thread(delegate()
                    {
                        try
                        {
                            using (mon)
                            {
                                cit.Execute(mon, context, configuration);
                            }
                        }
                        catch (Exception ex)
                        {
                            LoggingService.LogError("Project execution failed", ex);
                        }
                    });
                    t.Name         = "Project execution";
                    t.IsBackground = true;
                    t.Start();
                }
                foreach (IAsyncOperation op in list)
                {
                    op.WaitForCompleted();
                }

                monitor.EndTask();
            }
        }
コード例 #12
0
 public static IProgressMonitor GetInstrumentedMonitor(IProgressMonitor monitor, TimerCounter counter)
 {
     if (enabled)
     {
         AggregatedProgressMonitor mon = new AggregatedProgressMonitor(monitor);
         mon.AddSlaveMonitor(new IntrumentationMonitor(counter), MonitorAction.Tasks | MonitorAction.WriteLog);
         return(mon);
     }
     else
     {
         return(monitor);
     }
 }
コード例 #13
0
        public async static void ShowManager()
        {
            Task t = Instance != null ? Instance.currentTask : null;

            if (t != null && t.IsCompleted)
            {
                AggregatedProgressMonitor monitor = new AggregatedProgressMonitor(Instance.updateMonitor);
                monitor.AddFollowerMonitor(new MessageDialogProgressMonitor(true, true, false));
                await t;
            }
            HideAlert();
            OpenAddinManagerWindow();
        }
コード例 #14
0
    public static void ShowManager ()
    {
        IProgressMonitor m = Instance != null ? Instance.updateMonitor : null;
        if (m != null && !m.AsyncOperation.IsCompleted)
        {
            AggregatedProgressMonitor monitor = new AggregatedProgressMonitor (m);
            monitor.AddSlaveMonitor (new MessageDialogProgressMonitor (true, true, false));
            monitor.AsyncOperation.WaitForCompleted ();
        }
        HideAlert ();

        AddinManagerWindow.Run (IdeApp.Workbench.RootWindow);
    }
コード例 #15
0
ファイル: ErrorListPad.cs プロジェクト: lasloyu/monodevelop
        public ProgressMonitor GetBuildProgressMonitor()
        {
            if (control == null)
            {
                CreateControl();
            }

            var monitor = new AggregatedProgressMonitor();

            monitor.AddFollowerMonitor(buildOutput.GetProgressMonitor());
            monitor.AddFollowerMonitor(logView.GetProgressMonitor());

            return(monitor);
        }
コード例 #16
0
        public async static void ShowManager()
        {
            Task t = Instance != null ? Instance.currentTask : null;

            if (t != null && t.IsCompleted)
            {
                AggregatedProgressMonitor monitor = new AggregatedProgressMonitor(Instance.updateMonitor);
                monitor.AddSlaveMonitor(new MessageDialogProgressMonitor(true, true, false));
                await t;
            }
            HideAlert();

            AddinManagerWindow.Run(IdeApp.Workbench.RootWindow);
        }
コード例 #17
0
        public void TestLogObjectToFollowers()
        {
            var main = new ProgressMonitor();
            var m    = new ReportObjectMonitor();
            var agr  = new AggregatedProgressMonitor(main, m);
            var foo  = new object();

            agr.Log.Write("one");
            agr.LogObject(foo);
            agr.Log.Write("two");
            Assert.AreEqual(3, m.LoggedObjects.Count);
            Assert.AreEqual("one", m.LoggedObjects [0]);
            Assert.AreSame(foo, m.LoggedObjects [1]);
            Assert.AreEqual("two", m.LoggedObjects [2]);
        }
コード例 #18
0
        public ProgressMonitor GetProgressMonitor(ProgressMonitor monitor)
        {
            var aggregatedMonitor = monitor as AggregatedProgressMonitor;

            if (aggregatedMonitor == null)
            {
                aggregatedMonitor = new AggregatedProgressMonitor(monitor);
            }

            // Generate a bin log file.
            context.BinLogFilePath = buildTarget.BinLogFileName;

            progressMonitor = new MSBuildTargetProgressMonitor(buildTarget.LogFileName);
            aggregatedMonitor.AddFollowerMonitor(progressMonitor, progressMonitor.Actions);

            return(aggregatedMonitor);
        }
コード例 #19
0
        ProgressMonitor AddMSBuildBinLogProgressMonitor(ProgressMonitor monitor)
        {
            var aggregatedMonitor = monitor as AggregatedProgressMonitor;

            if (aggregatedMonitor == null)
            {
                aggregatedMonitor = new AggregatedProgressMonitor(monitor);
            }

            // Enable monitor for WriteLog only. This avoids errors due to a task being started before
            // the OnBeginBuildOperation was called which the bin log progress monitor is not aware of.
            var binLogMonitor = new MSBuildBinLogProgressMonitor();

            aggregatedMonitor.AddFollowerMonitor(binLogMonitor, binLogMonitor.Actions);

            return(aggregatedMonitor);
        }
コード例 #20
0
        protected override void Run()
        {
            bool checkForUpdates = PropertyService.Get("MonoDevelop.Ide.AddinUpdater.CkeckForUpdates", true);

            if (!checkForUpdates)
            {
                return;
            }

            DateTime lastUpdate = PropertyService.Get("MonoDevelop.Ide.AddinUpdater.LastCheck", DateTime.MinValue);
            int      updateSpan = PropertyService.Get("MonoDevelop.Ide.AddinUpdater.UpdateSpanValue", 1);
            string   unit       = PropertyService.Get("MonoDevelop.Ide.AddinUpdater.UpdateSpanUnit", "D");

            bool check = false;

            if (unit == "D")
            {
                lastUpdate = lastUpdate.Date;
                check      = (DateTime.Now - lastUpdate).TotalDays >= updateSpan;
            }
            else if (unit == "M")
            {
                lastUpdate = new DateTime(lastUpdate.Year, lastUpdate.Month, 1, 0, 0, 0);
                check      = DateTime.Now >= lastUpdate.AddMonths(updateSpan);
            }

            if (check)
            {
                IProgressMonitor mon = IdeApp.Workbench.ProgressMonitors.GetBackgroundProgressMonitor("Looking for add-in updates", "md-software-update");
                UpdateMonitor = new AggregatedProgressMonitor(mon);

                Thread t = new Thread(new ThreadStart(UpdateAddins));
                t.Name = "Addin updater";
                t.Start();
            }
            else
            {
                updates = Runtime.AddinSetupService.Repositories.GetAvailableUpdates();
                if (updates.Length > 0)
                {
                    WarnAvailableUpdates();
                }
            }
        }
コード例 #21
0
        /*protected virtual*/ async Task OnExecute(ProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration)
        {
            if (SingleStartup)
            {
                if (StartupItem == null)
                {
                    monitor.ReportError(GettextCatalog.GetString("Startup item not set"), null);
                    return;
                }
                await StartupItem.Execute(monitor, context, configuration);
            }
            else
            {
                var tasks    = new List <Task> ();
                var monitors = new List <AggregatedProgressMonitor> ();
                monitor.BeginTask("Executing projects", 1);

                foreach (SolutionItem it in MultiStartupItems)
                {
                    if (!it.CanExecute(context, configuration))
                    {
                        continue;
                    }
                    AggregatedProgressMonitor mon = new AggregatedProgressMonitor();
                    mon.AddSlaveMonitor(monitor, MonitorAction.ReportError | MonitorAction.ReportWarning | MonitorAction.SlaveCancel);
                    monitors.Add(mon);
                    tasks.Add(it.Execute(mon, context, configuration));
                }
                try {
                    await Task.WhenAll(tasks);
                } catch (Exception ex) {
                    LoggingService.LogError("Project execution failed", ex);
                } finally {
                    foreach (var m in monitors)
                    {
                        m.Dispose();
                    }
                }

                monitor.EndTask();
            }
        }
コード例 #22
0
        public static IProgressMonitor GetProgressMonitor(string operation, VersionControlOperationType op)
        {
            IconId icon;

            switch (op)
            {
            case VersionControlOperationType.Pull: icon = Stock.StatusDownload; break;

            case VersionControlOperationType.Push: icon = Stock.StatusUpload; break;

            default: icon = "md-version-control"; break;
            }

            IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor("MonoDevelop.VersionControlOutput", "Version Control", "md-version-control", false, true);
            Pad outPad = IdeApp.Workbench.ProgressMonitors.GetPadForMonitor(monitor);

            AggregatedProgressMonitor mon = new AggregatedProgressMonitor(monitor);

            mon.AddSlaveMonitor(IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor(operation, icon, true, true, false, outPad));
            return(mon);
        }