예제 #1
0
        public ProgressMonitor GetBuildProgressMonitor()
        {
            if (control == null)
            {
                CreateControl();
            }

            var monitor = new AggregatedProgressMonitor();

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

            return(monitor);
        }
예제 #2
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.AddFollowerMonitor(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);
        }
예제 #4
0
        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);
        }
예제 #5
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);
 }
예제 #6
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();
        }
예제 #7
0
 public static ProgressMonitor GetInstrumentedMonitor(ProgressMonitor monitor, TimerCounter counter)
 {
     if (enabled)
     {
         AggregatedProgressMonitor mon = new AggregatedProgressMonitor(monitor);
         mon.AddFollowerMonitor(new IntrumentationMonitor(counter), MonitorAction.Tasks | MonitorAction.WriteLog);
         return(mon);
     }
     else
     {
         return(monitor);
     }
 }
예제 #8
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.AddFollowerMonitor(monitor, MonitorAction.ReportError | MonitorAction.ReportWarning | MonitorAction.FollowerCancel);
                    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();
            }
        }