public SearchProgressMonitor (Pad pad)
		{
			outputPad = (SearchResultPad) pad.Content;
			outputPad.AsyncOperation = AsyncOperation;
			outputPad.BeginProgress (pad.Title);
			statusMonitor = IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor (GettextCatalog.GetString ("Searching..."), Stock.StatusSearch, false, true, false, pad);
		}
		internal SearchProgressMonitor (Pad pad, CancellationTokenSource cancellationTokenSource = null): base (Runtime.MainSynchronizationContext, cancellationTokenSource)
		{
			AddFollowerMonitor (IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor (GettextCatalog.GetString ("Searching..."), Stock.StatusSearch, false, true, false, pad, true));

			outputPad = (SearchResultPad) pad.Content;
			outputPad.CancellationTokenSource = CancellationTokenSource;
			outputPad.BeginProgress (pad.Title);
		}
Ejemplo n.º 3
0
		void GetXPathQueryPad()
		{
			foreach (Pad currentPad in IdeApp.Workbench.Pads) {
				if (currentPad.Id == "MonoDevelop.XmlEditor.XPathQueryPad") {
					pad = currentPad;
					break;
				}
			}
		}
Ejemplo n.º 4
0
 void ShowSelectedPad()
 {
     Gtk.TreeIter iter;
     if (treeviewPads.Selection.GetSelected(out iter))
     {
         MonoDevelop.Ide.Gui.Pad pad = padListStore.GetValue(iter, 2) as MonoDevelop.Ide.Gui.Pad;
         ShowType(ImageService.GetPixbuf(!pad.Icon.IsNull ? pad.Icon : MonoDevelop.Ide.Gui.Stock.MiscFiles, Gtk.IconSize.Dialog),
                  pad.Title,
                  "",
                  "");
     }
 }
		public StatusProgressMonitor (string title, string iconName, bool showErrorDialogs, bool showTaskTitles, bool lockGui, Pad statusSourcePad)
		{
			this.lockGui = lockGui;
			this.showErrorDialogs = showErrorDialogs;
			this.showTaskTitles = showTaskTitles;
			this.title = title;
			this.statusSourcePad = statusSourcePad;
			icon = ImageService.GetImage (iconName, Gtk.IconSize.Menu);
			statusBar = IdeApp.Workbench.StatusBar.CreateContext ();
			statusBar.StatusSourcePad = statusSourcePad;
			statusBar.BeginProgress (icon, title);
			if (lockGui)
				IdeApp.Workbench.LockGui ();
		}
		public StatusProgressMonitor (string title, string iconName, bool showErrorDialogs, bool showTaskTitles, bool lockGui, Pad statusSourcePad): base (Runtime.MainSynchronizationContext)
		{

			this.lockGui = lockGui;
			this.showErrorDialogs = showErrorDialogs;
			this.showTaskTitles = showTaskTitles;
			this.title = title;
			this.statusSourcePad = statusSourcePad;
			icon = iconName;
			statusBar = IdeApp.Workbench.StatusBar.CreateContext ();
			statusBar.StatusSourcePad = statusSourcePad;
			statusBar.BeginProgress (iconName, title);
			if (lockGui)
				IdeApp.Workbench.LockGui ();
		}
		void SelectPad (Pad pad)
		{
			Gtk.TreeIter iter;
			if (padListStore.GetIterFirst (out iter)) {
				do {
					Pad curPad = padListStore.GetValue (iter, 2) as Pad;
					if (pad == curPad) {
						treeviewPads.Selection.SelectIter (iter);
						return;
					}
				} while (padListStore.IterNext (ref iter));
			}
		}
		Pad GetPrevPad (Pad pad)
		{
			if (this.padListStore.NColumns == 0)
				return null;
			int index = IdeApp.Workbench.Pads.IndexOf (pad);
			Pad result = IdeApp.Workbench.Pads [(index + IdeApp.Workbench.Pads.Count - 1) % IdeApp.Workbench.Pads.Count];
			if (!result.Visible)
				return GetPrevPad (result);
			return result;
		}
Ejemplo n.º 9
0
        public SearchProgressMonitor GetSearchProgressMonitor(bool bringToFront, bool focusPad = false, CancellationTokenSource cancellationTokenSource = null)
        {
            Pad    pad   = null;
            string title = GettextCatalog.GetString("Search Results");

            int instanceNum = -1;

            lock (searchMonitors) {
                // Look for an available pad
                for (int n = 0; n < searchMonitors.Count; n++)
                {
                    Pad             mpad = (Pad)searchMonitors [n];
                    SearchResultPad rp   = (SearchResultPad)mpad.Content;
                    if (rp.InstanceNum > instanceNum)
                    {
                        instanceNum = rp.InstanceNum;
                    }
                    if (rp.AllowReuse)
                    {
                        pad = mpad;
                        break;
                    }
                }
            }
            if (pad != null)
            {
                if (bringToFront)
                {
                    pad.BringToFront(focusPad);
                }
                return(new SearchProgressMonitor(pad, cancellationTokenSource));
            }

            instanceNum++;

            string newPadId  = "SearchPad - " + title + " - " + instanceNum;
            string basePadId = "SearchPad - " + title + " - 0";

            if (instanceNum > 0)
            {
                title += " (" + (instanceNum + 1) + ")";
            }

            SearchResultPad monitorPad = new SearchResultPad(instanceNum)
            {
                FocusPad = focusPad
            };

            pad        = IdeApp.Workbench.ShowPad(monitorPad, newPadId, title, basePadId + "/Center Bottom", Stock.FindIcon);
            pad.Sticky = true;
            lock (searchMonitors) {
                searchMonitors.Add(pad);

                if (searchMonitors.Count > 1)
                {
                    // This is needed due to ContextBoundObject not being able to do a reflection access on private fields
                    var searchMonitorsCopy = searchMonitors;
                    // Additional search pads will be destroyed when hidden
                    pad.Window.PadHidden += delegate {
                        lock (searchMonitorsCopy) {
                            searchMonitorsCopy.Remove(pad);
                        }
                        pad.Destroy();
                    };
                }
            }

            if (bringToFront)
            {
                pad.BringToFront(focusPad);
            }

            return(new SearchProgressMonitor(pad, cancellationTokenSource));
        }
Ejemplo n.º 10
0
 protected override ProgressMonitor OnGetStatusProgressMonitor(string title, IconId icon, bool showErrorDialogs, bool showTaskTitle, bool lockGui, Pad statusSourcePad, bool showCancelButton)
 {
     return(Runtime.RunInMainThread(() => {
         return new StatusProgressMonitor(title, icon, showErrorDialogs, showTaskTitle, lockGui, statusSourcePad, showCancelButton);
     }).Result);
 }
Ejemplo n.º 11
0
		public void SetMessageSourcePad (Pad pad)
		{
			StatusSourcePad = pad;
			if (statusBar.IsCurrentContext (this))
				statusBar.SetMessageSourcePad (pad);
		}
Ejemplo n.º 12
0
		public void ShowMessage (Image image, string message, bool isMarkup)
		{
			if (message == lastText)
				return;
			sourcePad = null;
			lastText = message;
			DispatchService.AssertGuiThread ();
			if (currentStatusImage != image) {
				if (currentStatusImage != null) 
					messageBox.Remove (currentStatusImage);
				currentStatusImage = image;
				if (image != null) {
					image.SetPadding (0, 0);
					messageBox.PackStart (image, false, false, 3);
					messageBox.ReorderChild (image, 1);
					image.Show ();
				}
			}
			
			string txt = !String.IsNullOrEmpty (message) ? " " + message.Replace ("\n", " ") : "";
			if (isMarkup) {
				statusLabel.Markup = txt;
			} else {
				statusLabel.Text = txt;
			}
		}
Ejemplo n.º 13
0
 void DestroyPad(Pad pad)
 {
     outputMonitors.Remove(pad);
     pad.Destroy();
 }
Ejemplo n.º 14
0
        Pad CreateMonitorPad(string id, string title, string icon, bool bringToFront, bool allowMonitorReuse, bool show)
        {
            Pad pad = null;

            if (icon == null)
            {
                icon = Stock.OutputIcon;
            }

            if (id == null)
            {
                id = title;
            }

            int instanceCount = -1;

            if (allowMonitorReuse)
            {
                lock (outputMonitors) {
                    // Look for an available pad
                    for (int n = 0; n < outputMonitors.Count; n++)
                    {
                        Pad mpad = (Pad)outputMonitors [n];
                        DefaultMonitorPad mon = (DefaultMonitorPad)mpad.Content;
                        if (mon.TypeTag == id)
                        {
                            if (mon.InstanceNum > instanceCount)
                            {
                                instanceCount = mon.InstanceNum;
                            }
                            if (mon.AllowReuse)
                            {
                                pad = mpad;
                                break;
                            }
                        }
                    }
                }
                if (pad != null)
                {
                    if (bringToFront)
                    {
                        pad.BringToFront();
                    }
                    return(pad);
                }
            }

            instanceCount++;
            DefaultMonitorPad monitorPad = new DefaultMonitorPad(id, icon, instanceCount);

            string newPadId  = "OutputPad-" + id + "-" + instanceCount;
            string basePadId = "OutputPad-" + id + "-0";

            if (instanceCount > 0)
            {
                // Translate the title before adding the count
                title  = GettextCatalog.GetString(title);
                title += " (" + (instanceCount + 1) + ")";
            }

            if (show)
            {
                pad = IdeApp.Workbench.ShowPad(monitorPad, newPadId, title, basePadId + "/Center Bottom", DockItemStatus.AutoHide, icon);
            }
            else
            {
                pad = IdeApp.Workbench.AddPad(monitorPad, newPadId, title, basePadId + "/Center Bottom", DockItemStatus.AutoHide, icon);
            }

            monitorPad.StatusSourcePad = pad;
            pad.Sticky = true;
            outputMonitors.Add(pad);

            if (instanceCount > 0)
            {
                // Additional output pads will be destroyed when hidden
                pad.Window.PadHidden += delegate {
                    // Workaround for crash reported in bug #18096. Look like MS.NET can't access private fields
                    // when the delegate is invoked through the remoting chain.
                    DestroyPad(pad);
                };
            }

            if (bringToFront)
            {
                pad.Visible = true;
                pad.BringToFront();
            }

            return(pad);
        }
Ejemplo n.º 15
0
 public StatusProgressMonitor(string title, string iconName, bool showErrorDialogs, bool showTaskTitles, bool lockGui, Pad statusSourcePad)
 {
     this.lockGui          = lockGui;
     this.showErrorDialogs = showErrorDialogs;
     this.showTaskTitles   = showTaskTitles;
     this.title            = title;
     this.statusSourcePad  = statusSourcePad;
     icon      = ImageService.GetImage(iconName, Gtk.IconSize.Menu);
     statusBar = IdeApp.Workbench.StatusBar.CreateContext();
     statusBar.StatusSourcePad = statusSourcePad;
     statusBar.BeginProgress(icon, title);
     if (lockGui)
     {
         IdeApp.Workbench.LockGui();
     }
 }
Ejemplo n.º 16
0
 void DestroyPad(Pad pad)
 {
     outputMonitors.Remove (pad);
     pad.Destroy ();
 }
Ejemplo n.º 17
0
 public StatusProgressMonitor(string title, string iconName, bool showErrorDialogs, bool showTaskTitles, bool lockGui, Pad statusSourcePad) : base(Runtime.MainSynchronizationContext)
 {
     this.lockGui          = lockGui;
     this.showErrorDialogs = showErrorDialogs;
     this.showTaskTitles   = showTaskTitles;
     this.title            = title;
     this.statusSourcePad  = statusSourcePad;
     icon      = iconName;
     statusBar = IdeApp.Workbench.StatusBar.CreateContext();
     statusBar.StatusSourcePad = statusSourcePad;
     statusBar.BeginProgress(iconName, title);
     if (lockGui)
     {
         IdeApp.Workbench.LockGui();
     }
 }
		public IProgressMonitor GetStatusProgressMonitor (string title, IconId icon, bool showErrorDialogs, bool showTaskTitle, bool lockGui, Pad statusSourcePad)
		{
			return new StatusProgressMonitor (title, icon, showErrorDialogs, showTaskTitle, lockGui, statusSourcePad);
		}
Ejemplo n.º 19
0
 /******************************/
 public ProgressMonitor GetStatusProgressMonitor(string title, IconId icon, bool showErrorDialogs, bool showTaskTitle, bool lockGui, Pad statusSourcePad, bool showCancelButton)
 {
     return(new StatusProgressMonitor(title, icon, showErrorDialogs, showTaskTitle, lockGui, statusSourcePad, showCancelButton));
 }
Ejemplo n.º 20
0
		public void SetMessageSourcePad (Pad pad)
		{
			sourcePad = pad;
		}
Ejemplo n.º 21
0
 public ProgressMonitor GetStatusProgressMonitor(string title, IconId icon, bool showErrorDialogs, bool showTaskTitle = true, bool lockGui = false, Pad statusSourcePad = null)
 {
     return(GetStatusProgressMonitor(title, icon, showErrorDialogs, showTaskTitle, lockGui, statusSourcePad, showCancelButton: false));
 }
Ejemplo n.º 22
0
        internal Pad CreateMonitorPad(string id, string title, string icon, bool bringToFront, bool allowMonitorReuse, bool show)
        {
            Pad pad = null;

            if (icon == null)
            {
                icon = Stock.OutputIcon;
            }

            string originalTitle = title;

            if (id == null)
            {
                id = originalTitle;
            }

            int instanceCount      = -1;
            int titleInstanceCount = 0;

            if (allowMonitorReuse)
            {
                var usedTitleIds = new List <int> ();
                lock (outputMonitors) {
                    // Look for an available pad
                    for (int n = 0; n < outputMonitors.Count; n++)
                    {
                        var mpad = outputMonitors [n];
                        DefaultMonitorPad mon = (DefaultMonitorPad)mpad.Content;
                        if (mon.TypeTag == id)
                        {
                            if (mon.InstanceNum > instanceCount)
                            {
                                instanceCount = mon.InstanceNum;
                            }
                            if (mon.Title == originalTitle && !mon.AllowReuse)
                            {
                                usedTitleIds.Add(mon.TitleInstanceNum);
                            }
                            if (mon.AllowReuse &&
                                (pad == null ||
                                 mon.Title == originalTitle))                             //Prefer reusing output with same title(project)
                            {
                                pad = mpad;
                            }
                        }
                    }
                }
                titleInstanceCount = usedTitleIds.Count;                //Set pesimisticly to largest possible number
                for (int i = 0; i < usedTitleIds.Count; i++)
                {
                    if (!usedTitleIds.Contains(i))
                    {
                        titleInstanceCount = i;                        //Find smallest free number
                        break;
                    }
                }
                if (titleInstanceCount > 0)
                {
                    title = originalTitle + $" ({titleInstanceCount})";
                }
                else
                {
                    title = originalTitle;
                }
                if (pad != null)
                {
                    if (bringToFront)
                    {
                        pad.BringToFront();
                    }
                    pad.Window.Title = title;
                    var mon = (DefaultMonitorPad)pad.Content;
                    mon.Title            = originalTitle;
                    mon.TitleInstanceNum = titleInstanceCount;
                    return(pad);
                }
            }

            instanceCount++;
            DefaultMonitorPad monitorPad = new DefaultMonitorPad(id, icon, instanceCount, originalTitle, titleInstanceCount);

            string newPadId  = "OutputPad-" + id + "-" + instanceCount;
            string basePadId = "OutputPad-" + id + "-0";

            if (show)
            {
                pad = IdeApp.Workbench.ShowPad(monitorPad, newPadId, title, basePadId + "/Center Bottom", DockItemStatus.AutoHide, icon);
            }
            else
            {
                pad = IdeApp.Workbench.AddPad(monitorPad, newPadId, title, basePadId + "/Center Bottom", DockItemStatus.AutoHide, icon);
            }

            monitorPad.StatusSourcePad = pad;
            pad.Sticky = true;
            lock (outputMonitors) {
                outputMonitors.Add(pad);
            }

            if (instanceCount > 0)
            {
                // Additional output pads will be destroyed when hidden
                pad.Window.PadHidden += (s, a) => {
                    // Workaround for crash reported in bug #18096. Look like MS.NET can't access private fields
                    // when the delegate is invoked through the remoting chain.
                    if (!a.SwitchingLayout)
                    {
                        DestroyPad(pad);
                    }
                };
            }

            if (bringToFront)
            {
                pad.Visible = true;
                pad.BringToFront();
            }

            return(pad);
        }
Ejemplo n.º 23
0
		public ProgressMonitor GetStatusProgressMonitor (string title, IconId icon, bool showErrorDialogs, bool showTaskTitle = true, bool lockGui = false, Pad statusSourcePad = null)
		{
			return GetStatusProgressMonitor (title, icon, showErrorDialogs, showTaskTitle, lockGui, statusSourcePad, showCancelButton: false);
		}