void UpdateReferences (IList<WebReferenceItem> items)
		{
			try {
				UpdateReferenceContext = IdeApp.Workbench.StatusBar.CreateContext ();
				UpdateReferenceContext.BeginProgress (GettextCatalog.GetPluralString ("Updating web reference", "Updating web references", items.Count));
				
				DispatchService.ThreadDispatch (() => {
					for (int i = 0; i < items.Count; i ++) {
						DispatchService.GuiDispatch (() => UpdateReferenceContext.SetProgressFraction (Math.Max (0.1, (double)i / items.Count)));
						items [i].Update();
					}
					
					DispatchService.GuiDispatch (() => {
						// Make sure that we save all relevant projects, there should only be 1 though
						foreach (var project in items.Select (i =>i.Project).Distinct ())
							IdeApp.ProjectOperations.Save (project);
						
						IdeApp.Workbench.StatusBar.ShowMessage(GettextCatalog.GetPluralString ("Updated Web Reference {0}", "Updated Web References", items.Count, items[0].Name));
						DisposeUpdateContext ();
					});
				});
			} catch {
				DisposeUpdateContext ();
				throw;
			}
		}
示例#2
0
        void SetLinkStatus(string link)
        {
            if (link == null)
            {
                DestroyStatusBar();
                return;
            }
            if (link.IndexOf("monodevelop://") != -1)
            {
                return;
            }

            if (statusBar == null)
            {
                statusBar = IdeApp.Workbench.StatusBar.CreateContext();
            }

            if (link.IndexOf("project://") != -1)
            {
                string message = link;
                message = message.Substring(10);
                string msg = GettextCatalog.GetString("Open solution {0}", message);
                if (IdeApp.Workspace.IsOpen)
                {
                    msg += " - " + GettextCatalog.GetString("Hold Control key to open in current workspace.");
                }
                statusBar.ShowMessage(msg);
            }
            else
            {
                string msg = GettextCatalog.GetString("Open {0}", link);
                statusBar.ShowMessage(msg);
            }
        }
        void UpdateReferences(IList <WebReferenceItem> items)
        {
            try
            {
                UpdateReferenceContext = IdeApp.Workbench.StatusBar.CreateContext();
                UpdateReferenceContext.BeginProgress(GettextCatalog.GetPluralString("Updating web reference", "Updating web references", items.Count));

                DispatchService.ThreadDispatch(() =>
                {
                    for (int i = 0; i < items.Count; i++)
                    {
                        DispatchService.GuiDispatch(() => UpdateReferenceContext.SetProgressFraction(Math.Max(0.1, (double)i / items.Count)));
                        items [i].Update();
                    }

                    DispatchService.GuiDispatch(() => {
                        // Make sure that we save all relevant projects, there should only be 1 though
                        foreach (var project in items.Select(i => i.Project).Distinct())
                        {
                            IdeApp.ProjectOperations.Save(project);
                        }

                        IdeApp.Workbench.StatusBar.ShowMessage(GettextCatalog.GetPluralString("Updated Web Reference {0}", "Updated Web References", items.Count, items[0].Name));
                        DisposeUpdateContext();
                    });
                });
            }
            catch
            {
                DisposeUpdateContext();
                throw;
            }
        }
示例#4
0
            /// <summary>
            /// Reloads annotations for the current document
            /// </summary>
            internal void UpdateAnnotations()
            {
                StatusBarContext ctx = IdeApp.Workbench.StatusBar.CreateContext();

                ctx.AutoPulse = true;
                ctx.ShowMessage("md-version-control", GettextCatalog.GetString("Retrieving history"));

                ThreadPool.QueueUserWorkItem(delegate {
                    try {
                        annotations = new List <Annotation> (widget.VersionControlItem.Repository.GetAnnotations(widget.Document.FileName));

//						for (int i = 0; i < annotations.Count; i++) {
//							Annotation varname = annotations[i];
//							System.Console.WriteLine (i + ":" + varname);
//						}
                        minDate = annotations.Min(a => a.Date);
                        maxDate = annotations.Max(a => a.Date);
                    } catch (Exception ex) {
                        LoggingService.LogError("Error retrieving history", ex);
                    }

                    DispatchService.GuiDispatch(delegate {
                        ctx.Dispose();
                        UpdateWidth();
                        QueueDraw();
                    });
                });
            }
 void DestroyStatusBar()
 {
     if (statusBar != null)
     {
         statusBar.Dispose();
         statusBar = null;
     }
 }
示例#6
0
 void DisposeUpdateContext()
 {
     if (UpdateReferenceContext != null)
     {
         UpdateReferenceContext.Dispose();
         UpdateReferenceContext = null;
     }
 }
 static void OnCommandDeselected(object s, EventArgs args)
 {
     if (menuDescriptionContext != null)
     {
         menuDescriptionContext.Dispose();
         menuDescriptionContext = null;
     }
 }
 public void Update()
 {
     using (StatusBarContext sbc = IdeApp.Workbench.StatusBar.CreateContext()) {
         sbc.BeginProgress(GettextCatalog.GetString("Updating web reference"));
         sbc.AutoPulse = true;
         WebReferenceItem item = (WebReferenceItem)CurrentNode.DataItem;
         DispatchService.BackgroundDispatchAndWait(item.Update);
         IdeApp.ProjectOperations.Save(item.Project);
         IdeApp.Workbench.StatusBar.ShowMessage("Updated Web Reference " + item.Name);
     }
 }
示例#9
0
            /// <summary>
            /// Reloads annotations for the current document
            /// </summary>
            internal void UpdateAnnotations()
            {
                StatusBarContext ctx = IdeApp.Workbench.StatusBar.CreateContext();

                ctx.AutoPulse = true;
                ctx.ShowMessage("md-version-control", GettextCatalog.GetString("Retrieving history"));

                Task.Run(async delegate {
                    try {
                        annotations = new List <Annotation> (await widget.VersionControlItem.Repository.GetAnnotationsAsync(widget.Document.FileName, widget.revision));

                        //						for (int i = 0; i < annotations.Count; i++) {
                        //							Annotation varname = annotations[i];
                        //							System.Console.WriteLine (i + ":" + varname);
                        //						}
                        if (annotations.Count > 0)
                        {
                            minDate = annotations.Min(a => a.Date);
                            maxDate = annotations.Max(a => a.Date);
                        }
                    } catch (Exception ex) {
                        LoggingService.LogError("Error retrieving history", ex);
                    }
                    var widgetText = widget.revision == null ? null : await widget.VersionControlItem.Repository.GetTextAtRevisionAsync(widget.Document.FileName, widget.revision);
                    Runtime.RunInMainThread(delegate {
                        if (widget.revision != null)
                        {
                            var location  = widget.Editor.Caret.Location;
                            var adj       = widget.editor.VAdjustment.Value;
                            document.Text = widgetText;
                            widget.editor.Caret.Location    = location;
                            widget.editor.VAdjustment.Value = adj;
                        }
                        else
                        {
                            if (widget.Document.GetContent <ITextView> () is ITextView textView)
                            {
                                document.Text     = textView.TextSnapshot.GetText();
                                var(line, column) = textView.Caret.Position.BufferPosition.GetLineAndColumn1Based();
                                widget.Editor.SetCaretTo(line, column);
                                int firstLineNumber             = textView.TextViewLines.FirstVisibleLine.Start.GetContainingLine().LineNumber;
                                widget.Editor.VAdjustment.Value = widget.Editor.LineToY(firstLineNumber + 1);
                            }
                        }

                        ctx.AutoPulse = false;
                        ctx.Dispose();
                        UpdateWidth();
                        QueueDraw();
                    });
示例#10
0
        public SelectSheetAction()
        {
            informationContext = new StatusBarContext()
            {
                RestoresInitialState = true
            };

            timer = new Timer()
            {
                Interval  = 5 * 1000,
                AutoReset = false
            };
            timer.Elapsed += OnTimerElapsed;
        }
		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 ();
		}
示例#13
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      = iconName;
     statusBar = IdeApp.Workbench.StatusBar.CreateContext();
     statusBar.StatusSourcePad = statusSourcePad;
     statusBar.BeginProgress(iconName, title);
     if (lockGui)
     {
         IdeApp.Workbench.LockGui();
     }
 }
 public void UpdateAll()
 {
     using (StatusBarContext sbc = IdeApp.Workbench.StatusBar.CreateContext()) {
         sbc.BeginProgress(GettextCatalog.GetString("Updating web references"));
         sbc.AutoPulse = true;
         DotNetProject           project = ((WebReferenceFolder)CurrentNode.DataItem).Project;
         List <WebReferenceItem> items   = new List <WebReferenceItem> (WebReferencesService.GetWebReferenceItems(project));
         DispatchService.BackgroundDispatchAndWait(delegate {
             foreach (var item in items)
             {
                 item.Update();
             }
         });
         IdeApp.ProjectOperations.Save(project);
         IdeApp.Workbench.StatusBar.ShowMessage("Updated all Web References");
     }
 }
示例#15
0
            /// <summary>
            /// Reloads annotations for the current document
            /// </summary>
            internal void UpdateAnnotations()
            {
                StatusBarContext ctx = IdeApp.Workbench.StatusBar.CreateContext();

                ctx.AutoPulse = true;
                ctx.ShowMessage("md-version-control", GettextCatalog.GetString("Retrieving history"));

                ThreadPool.QueueUserWorkItem(delegate {
                    try {
                        annotations = new List <Annotation> (widget.VersionControlItem.Repository.GetAnnotations(widget.Document.FileName, widget.revision));

//						for (int i = 0; i < annotations.Count; i++) {
//							Annotation varname = annotations[i];
//							System.Console.WriteLine (i + ":" + varname);
//						}
                        minDate = annotations.Min(a => a.Date);
                        maxDate = annotations.Max(a => a.Date);
                    } catch (Exception ex) {
                        LoggingService.LogError("Error retrieving history", ex);
                    }

                    Runtime.RunInMainThread(delegate {
                        var location = widget.Editor.Caret.Location;
                        var adj      = widget.editor.VAdjustment.Value;
                        if (widget.revision != null)
                        {
                            document.Text = widget.VersionControlItem.Repository.GetTextAtRevision(widget.Document.FileName, widget.revision);
                        }
                        else
                        {
                            document.Text = widget.Document.Editor.Text;
                            if (widget.Document.Editor.TextView is MonoTextEditor exEditor)
                            {
                                document.UpdateFoldSegments(exEditor.Document.FoldSegments.Select(f => new Mono.TextEditor.FoldSegment(f)));
                                widget.Editor.SetCaretTo(exEditor.Caret.Line, exEditor.Caret.Column);
                                widget.Editor.VAdjustment.Value = exEditor.VAdjustment.Value;
                            }
                        }
                        widget.editor.Caret.Location    = location;
                        widget.editor.VAdjustment.Value = adj;

                        ctx.AutoPulse = false;
                        ctx.Dispose();
                        UpdateWidth();
                        QueueDraw();
                    });
示例#16
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;
     if (!string.IsNullOrEmpty(iconName))
     {
         icon = ImageService.GetImage(iconName, Gtk.IconSize.Menu);
     }
     statusBar = IdeApp.Workbench.StatusBar.CreateContext();
     statusBar.StatusSourcePad = statusSourcePad;
     statusBar.BeginProgress(icon, title);
     if (lockGui)
     {
         IdeApp.Workbench.LockGui();
     }
 }
示例#17
0
            /// <summary>
            /// Reloads annotations for the current document
            /// </summary>
            internal void UpdateAnnotations(object sender, EventArgs e)
            {
                StatusBarContext ctx = IdeApp.Workbench.StatusBar.CreateContext();

                ctx.AutoPulse = true;
                ctx.ShowMessage(ImageService.GetImage("md-version-control", IconSize.Menu), GettextCatalog.GetString("Retrieving history"));

                ThreadPool.QueueUserWorkItem(delegate {
                    try {
                        annotations = new List <Annotation> (widget.VersionControlItem.Repository.GetAnnotations(widget.Document.FileName));
                    } catch (Exception ex) {
                        LoggingService.LogError("Error retrieving history", ex);
                    }

                    DispatchService.GuiDispatch(delegate {
                        ctx.Dispose();
                        UpdateWidth();
                        QueueDraw();
                    });
                });
            }
 public StatusProgressMonitor(string title, string iconName, bool showErrorDialogs, bool showTaskTitles, bool lockGui, Pad statusSourcePad, bool showCancelButton) : base(Runtime.MainSynchronizationContext)
 {
     this.lockGui          = lockGui;
     this.showErrorDialogs = showErrorDialogs;
     this.showTaskTitles   = showTaskTitles;
     this.title            = title;
     this.statusSourcePad  = statusSourcePad;
     this.showCancelButton = showCancelButton;
     icon      = iconName;
     statusBar = IdeApp.Workbench.StatusBar.CreateContext();
     statusBar.StatusSourcePad = statusSourcePad;
     if (showCancelButton)
     {
         statusBar.CancellationTokenSource = CancellationTokenSource;
     }
     statusBar.BeginProgress(iconName, title);
     if (lockGui)
     {
         IdeApp.Workbench.LockGui();
     }
 }
示例#19
0
        void UpdateReferences(IList <WebReferenceItem> items)
        {
            try {
                UpdateReferenceContext = IdeApp.Workbench.StatusBar.CreateContext();
                UpdateReferenceContext.BeginProgress(GettextCatalog.GetPluralString("Updating web reference", "Updating web references", items.Count));

                Task.Run(() => {
                    for (int i = 0; i < items.Count; i++)
                    {
                        Runtime.RunInMainThread(() => UpdateReferenceContext.SetProgressFraction(Math.Max(0.1, (double)i / items.Count)));
                        try {
                            items [i].Update();
                        } catch (Exception ex) {
                            Runtime.RunInMainThread(() => {
                                MessageService.ShowError(GettextCatalog.GetString("Failed to update Web Reference '{0}'", items [i].Name), ex);
                                DisposeUpdateContext();
                            }).Wait();
                            return;
                        }
                    }

                    Runtime.RunInMainThread(() => {
                        // Make sure that we save all relevant projects, there should only be 1 though
                        foreach (var project in items.Select(i => i.Project).Distinct())
                        {
                            IdeApp.ProjectOperations.SaveAsync(project);
                        }

                        IdeApp.Workbench.StatusBar.ShowMessage(GettextCatalog.GetPluralString("Updated Web Reference {0}", "Updated Web References", items.Count, items[0].Name));
                        DisposeUpdateContext();
                    });
                });
            } catch {
                DisposeUpdateContext();
                throw;
            }
        }
        static void OnCommandSelected(object s, CommandSelectedEventArgs args)
        {
            string msg = args.CommandInfo.Description;

            if (string.IsNullOrEmpty(msg))
            {
                msg = args.CommandInfo.Text;
                // only replace _ outside of markup: usecase : Field <b>some_field</b>
                int idx = msg.IndexOf('<');
                if (idx < 0)
                {
                    idx = msg.Length;
                }
                msg = msg.Substring(0, idx).Replace("_", "") + msg.Substring(idx);
            }
            if (!string.IsNullOrEmpty(msg))
            {
                if (menuDescriptionContext == null)
                {
                    menuDescriptionContext = Workbench.StatusBar.CreateContext();
                }
                menuDescriptionContext.ShowMessage(msg, args.CommandInfo.UseMarkup);
            }
        }
示例#21
0
		public void SetLinkStatus (string link)
		{
			if (link == null) {
				if (statusBar != null) {
					statusBar.Dispose ();
					statusBar = null;
				}
				return;
			}
			if (link.IndexOf ("monodevelop://") != -1)
				return;
				
			if (statusBar == null)
				statusBar = IdeApp.Workbench.StatusBar.CreateContext ();
			
			if (link.IndexOf ("project://") != -1) {
				string message = link;
				message = message.Substring (10);
				string msg = GettextCatalog.GetString ("Open solution {0}", message);
				if (IdeApp.Workspace.IsOpen)
					msg += " - " + GettextCatalog.GetString ("Hold Control key to open in current workspace.");
				statusBar.ShowMessage (msg);
			} else {
				string msg = GettextCatalog.GetString ("Open {0}", link);
				statusBar.ShowMessage (msg);
			}
		}
		void UpdateReferences (IList<WebReferenceItem> items)
		{
			try {
				UpdateReferenceContext = IdeApp.Workbench.StatusBar.CreateContext ();
				UpdateReferenceContext.BeginProgress (GettextCatalog.GetPluralString ("Updating web reference", "Updating web references", items.Count));
				
				Task.Run (() => {
					for (int i = 0; i < items.Count; i ++) {
						Runtime.RunInMainThread (() => UpdateReferenceContext.SetProgressFraction (Math.Max (0.1, (double)i / items.Count)));
						try {
							items [i].Update();
						} catch (Exception ex) {
							Runtime.RunInMainThread (() => {
								MessageService.ShowError (GettextCatalog.GetString ("Failed to update Web Reference '{0}'", items [i].Name), ex);
								DisposeUpdateContext ();
							}).Wait ();
							return;
						}
					}
					
					Runtime.RunInMainThread (() => {
						// Make sure that we save all relevant projects, there should only be 1 though
						foreach (var project in items.Select (i =>i.Project).Distinct ())
							IdeApp.ProjectOperations.SaveAsync (project);
						
						IdeApp.Workbench.StatusBar.ShowMessage(GettextCatalog.GetPluralString ("Updated Web Reference {0}", "Updated Web References", items.Count, items[0].Name));
						DisposeUpdateContext ();
					});
				});
			} catch {
				DisposeUpdateContext ();
				throw;
			}
		}
        internal MonoDevelopStatusBar()
        {
            mainContext   = new MainStatusBarContextImpl(this);
            activeContext = mainContext;
            contexts.Add(mainContext);

            Frame originalFrame = (Frame)Children[0];

//			originalFrame.WidthRequest = 8;
//			originalFrame.Shadow = ShadowType.In;
//			originalFrame.BorderWidth = 0;

            BorderWidth = 0;
            Spacing     = 0;

            // Feedback button

            CustomFrame fr = new CustomFrame(0, 0, 1, 1);

            Gdk.Pixbuf px = Gdk.Pixbuf.LoadFromResource("balloon.png");
            HBox       b  = new HBox(false, 3);

            b.PackStart(new Gtk.Image(px));
            b.PackStart(new Gtk.Label("Feedback"));
            Gtk.Alignment al = new Gtk.Alignment(0f, 0f, 1f, 1f);
            al.RightPadding = 5;
            al.LeftPadding  = 3;
            al.Add(b);
            feedbackButton = new MiniButton(al);
            //feedbackButton.BackroundColor = new Gdk.Color (200, 200, 255);
            fr.Add(feedbackButton);
            PackStart(fr, false, false, 0);
            feedbackButton.Clicked                += HandleFeedbackButtonClicked;
            feedbackButton.ButtonPressEvent       += HandleFeedbackButtonButtonPressEvent;;
            feedbackButton.ClickOnRelease          = true;
            FeedbackService.FeedbackPositionGetter = delegate {
                int x, y;
                feedbackButton.GdkWindow.GetOrigin(out x, out y);
                x += feedbackButton.Allocation.Width;
                y -= 6;
                return(new Gdk.Point(x, y));
            };

            // Dock area

            DefaultWorkbench wb = (DefaultWorkbench)IdeApp.Workbench.RootWindow;

            wb.DockFrame.ShadedContainer.Add(this);
            Gtk.Widget dockBar = wb.DockFrame.ExtractDockBar(PositionType.Bottom);
            dockBar.NoShowAll = true;
            PackStart(dockBar, false, false, 0);

            // Status panels

            progressBar           = new ProgressBar();
            progressBar.PulseStep = 0.1;
            progressBar.SizeRequest();
            progressBar.HeightRequest = 1;

            statusBox             = new HBox(false, 0);
            statusBox.BorderWidth = 0;

            statusLabel = new Label();
            statusLabel.SetAlignment(0, 0.5f);
            statusLabel.Wrap = false;
            int w, h;

            Gtk.Icon.SizeLookup(IconSize.Menu, out w, out h);
            statusLabel.HeightRequest = h;
            statusLabel.SetPadding(0, 0);

            EventBox eventMessageBox = new EventBox();

            messageBox = new HBox();
            messageBox.PackStart(progressBar, false, false, 0);
            messageBox.PackStart(statusLabel, true, true, 0);
            eventMessageBox.Add(messageBox);
            statusBox.PackStart(eventMessageBox, true, true, 0);
            eventMessageBox.ButtonPressEvent += HandleEventMessageBoxButtonPressEvent;

            textStatusBarPanel.BorderWidth = 0;
            textStatusBarPanel.ShadowType  = ShadowType.None;
            textStatusBarPanel.Add(statusBox);
            Label fillerLabel = new Label();

            fillerLabel.WidthRequest = 8;
            statusBox.PackEnd(fillerLabel, false, false, 0);

            modeLabel = new Label(" ");
            statusBox.PackEnd(modeLabel, false, false, 8);

            cursorLabel = new Label(" ");
            statusBox.PackEnd(cursorLabel, false, false, 0);

            statusIconBox             = new HBox();
            statusIconBox.BorderWidth = 0;
            statusIconBox.Spacing     = 3;
            statusBox.PackEnd(statusIconBox, false, false, 4);

            this.PackStart(textStatusBarPanel, true, true, 0);

            ShowReady();
            Gtk.Box.BoxChild boxChild = (Gtk.Box.BoxChild) this[textStatusBarPanel];
            boxChild.Position = 0;
            boxChild.Expand   = boxChild.Fill = true;

            //		boxChild = (Gtk.Box.BoxChild)this[originalFrame];
            //		boxChild.Padding = 0;
            //		boxChild.Expand = boxChild.Fill = false;

            this.progressBar.Fraction = 0.0;
            this.ShowAll();
            statusIconBox.HideAll();

            originalFrame.HideAll();
            progressBar.Visible = false;

            StatusBarContext completionStatus = null;

            // todo: Move this to the CompletionWindowManager when it's possible.
            CompletionWindowManager.WindowShown += delegate {
                CompletionListWindow wnd = CompletionWindowManager.Wnd;
                if (wnd != null && wnd.List != null && wnd.List.CategoryCount > 1)
                {
                    if (completionStatus == null)
                    {
                        completionStatus = CreateContext();
                    }
                    completionStatus.ShowMessage(string.Format(GettextCatalog.GetString("To toggle categorized completion mode press {0}."), IdeApp.CommandService.GetCommandInfo(Commands.TextEditorCommands.ShowCompletionWindow).AccelKey));
                }
            };

            CompletionWindowManager.WindowClosed += delegate {
                if (completionStatus != null)
                {
                    completionStatus.Dispose();
                    completionStatus = null;
                }
            };
        }
		void DisposeUpdateContext ()
		{
			if (UpdateReferenceContext != null) {
				UpdateReferenceContext.Dispose ();
				UpdateReferenceContext = null;
			}
		}
		static void OnCommandSelected (object s, CommandSelectedEventArgs args)
		{
			string msg = args.CommandInfo.Description;
			if (string.IsNullOrEmpty (msg)) {
				msg = args.CommandInfo.Text;
				// only replace _ outside of markup: usecase : Field <b>some_field</b>
				int idx = msg.IndexOf ('<');
				if (idx < 0)
					idx = msg.Length;
				msg = msg.Substring (0, idx).Replace ("_", "") + msg.Substring (idx);
			}
			if (!string.IsNullOrEmpty (msg)) {
				if (menuDescriptionContext == null)
					menuDescriptionContext = Workbench.StatusBar.CreateContext ();
				menuDescriptionContext.ShowMessage (msg, args.CommandInfo.UseMarkup);
			}
		}
        internal MonoDevelopStatusBar()
        {
            mainContext   = new MainStatusBarContextImpl(this);
            activeContext = mainContext;
            contexts.Add(mainContext);

            Frame originalFrame = (Frame)Children[0];

//			originalFrame.WidthRequest = 8;
//			originalFrame.Shadow = ShadowType.In;
//			originalFrame.BorderWidth = 0;

            BorderWidth = 0;

            DefaultWorkbench wb = (DefaultWorkbench)IdeApp.Workbench.RootWindow;

            wb.DockFrame.ShadedContainer.Add(this);
            Gtk.Widget dockBar = wb.DockFrame.ExtractDockBar(PositionType.Bottom);
            dockBar.NoShowAll = true;
            PackStart(dockBar, false, false, 0);

            progressBar           = new ProgressBar();
            progressBar.PulseStep = 0.1;
            progressBar.SizeRequest();
            progressBar.HeightRequest = 1;

            statusBox             = new HBox(false, 0);
            statusBox.BorderWidth = 0;

            statusLabel = new Label();
            statusLabel.SetAlignment(0, 0.5f);
            statusLabel.Wrap = false;
            int w, h;

            Gtk.Icon.SizeLookup(IconSize.Menu, out w, out h);
            statusLabel.HeightRequest = h;
            statusLabel.SetPadding(0, 0);

            EventBox eventMessageBox = new EventBox();

            messageBox = new HBox();
            messageBox.PackStart(progressBar, false, false, 0);
            messageBox.PackStart(statusLabel, true, true, 0);
            eventMessageBox.Add(messageBox);
            statusBox.PackStart(eventMessageBox, true, true, 0);
            eventMessageBox.ButtonPressEvent += HandleEventMessageBoxButtonPressEvent;

            textStatusBarPanel.BorderWidth = 0;
            textStatusBarPanel.ShadowType  = ShadowType.None;
            textStatusBarPanel.Add(statusBox);
            Label fillerLabel = new Label();

            fillerLabel.WidthRequest = 8;
            statusBox.PackEnd(fillerLabel, false, false, 0);

            modeLabel = new Label(" ");
            statusBox.PackEnd(modeLabel, false, false, 8);

            cursorLabel = new Label(" ");
            statusBox.PackEnd(cursorLabel, false, false, 0);

            statusIconBox             = new HBox();
            statusIconBox.BorderWidth = 0;
            statusIconBox.Spacing     = 3;
            statusBox.PackEnd(statusIconBox, false, false, 4);

            this.PackStart(textStatusBarPanel, true, true, 0);

            ShowReady();
            Gtk.Box.BoxChild boxChild = (Gtk.Box.BoxChild) this[textStatusBarPanel];
            boxChild.Position = 0;
            boxChild.Expand   = boxChild.Fill = true;

            //		boxChild = (Gtk.Box.BoxChild)this[originalFrame];
            //		boxChild.Padding = 0;
            //		boxChild.Expand = boxChild.Fill = false;

            this.progressBar.Fraction = 0.0;
            this.ShowAll();
            statusIconBox.HideAll();

            originalFrame.HideAll();
            progressBar.Visible = false;

            StatusBarContext completionStatus = null;

            // todo: Move this to the CompletionWindowManager when it's possible.
            CompletionWindowManager.WindowShown += delegate {
                CompletionListWindow wnd = CompletionWindowManager.Wnd;
                if (wnd != null && wnd.List != null && wnd.List.CategoryCount > 1)
                {
                    if (completionStatus == null)
                    {
                        completionStatus = CreateContext();
                    }
                    completionStatus.ShowMessage(string.Format(GettextCatalog.GetString("To toggle categorized completion mode press {0}."), IdeApp.CommandService.GetCommandInfo(Commands.TextEditorCommands.ShowCompletionWindow).AccelKey));
                }
            };

            CompletionWindowManager.WindowClosed += delegate {
                if (completionStatus != null)
                {
                    completionStatus.Dispose();
                    completionStatus = null;
                }
            };
        }
		static void OnCommandDeselected (object s, EventArgs args)
		{
			if (menuDescriptionContext != null) {
				menuDescriptionContext.Dispose ();
				menuDescriptionContext = null;
			}
		}
		void DestroyStatusBar ()
		{
			if (statusBar != null) {
				statusBar.Dispose ();
				statusBar = null;
			}
		}