protected override void OnCompleted()
        {
            if (lockGui)
            {
                IdeApp.Workbench.UnlockGui();
            }

            statusBar.EndProgress();

            if (!IsCancelRequested)
            {
                try {
                    if (Errors.Count > 0 || Warnings.Count > 0)
                    {
                        if (Errors.Count > 0)
                        {
                            statusBar.ShowError(Errors [Errors.Count - 1]);
                        }
                        else if (SuccessMessages.Count == 0)
                        {
                            statusBar.ShowWarning(Warnings [Warnings.Count - 1]);
                        }

                        DesktopService.ShowGlobalProgressError();

                        base.OnCompleted();

                        if (showErrorDialogs)
                        {
                            ShowResultDialog();
                        }
                        return;
                    }

                    if (SuccessMessages.Count > 0)
                    {
                        statusBar.ShowMessage(MonoDevelop.Ide.Gui.Stock.StatusSuccess, SuccessMessages [SuccessMessages.Count - 1]);
                    }
                } finally {
                    statusBar.StatusSourcePad = statusSourcePad;
                    statusBar.Dispose();
                }
            }
            else
            {
                statusBar.Dispose();
            }

            DesktopService.SetGlobalProgress(GlobalWork);

            base.OnCompleted();
        }
Beispiel #2
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;
     }
 }
 static void OnCommandDeselected(object s, EventArgs args)
 {
     if (menuDescriptionContext != null)
     {
         menuDescriptionContext.Dispose();
         menuDescriptionContext = null;
     }
 }
        protected override void OnCompleted()
        {
            if (lockGui)
            {
                IdeApp.Workbench.UnlockGui();
            }

            statusBar.Dispose();

            if (Errors.Count > 0 || Warnings.Count > 0)
            {
                if (Errors.Count > 0)
                {
                    Gtk.Image img = ImageService.GetImage(Stock.Error, Gtk.IconSize.Menu);
                    IdeApp.Workbench.StatusBar.ShowMessage(img, Errors [Errors.Count - 1]);
                }
                else if (SuccessMessages.Count == 0)
                {
                    Gtk.Image img = ImageService.GetImage(Stock.Warning, Gtk.IconSize.Menu);
                    IdeApp.Workbench.StatusBar.ShowMessage(img, Warnings [Warnings.Count - 1]);
                }

                base.OnCompleted();

                if (showErrorDialogs)
                {
                    MultiMessageDialog resultDialog = new MultiMessageDialog();
                    foreach (string m in Errors)
                    {
                        resultDialog.AddError(m);
                    }
                    foreach (string m in Warnings)
                    {
                        resultDialog.AddWarning(m);
                    }
                    resultDialog.TransientFor = IdeApp.Workbench.RootWindow;
                    resultDialog.Run();
                    resultDialog.Destroy();
                }
                IdeApp.Workbench.StatusBar.SetMessageSourcePad(statusSourcePad);
                return;
            }

            if (SuccessMessages.Count > 0)
            {
                IdeApp.Workbench.StatusBar.ShowMessage(SuccessMessages [SuccessMessages.Count - 1]);
            }

            IdeApp.Workbench.StatusBar.SetMessageSourcePad(statusSourcePad);
            base.OnCompleted();
        }
Beispiel #6
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();
                    });
Beispiel #7
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();
                    });
        protected override void OnCompleted()
        {
            if (lockGui)
            {
                IdeApp.Workbench.UnlockGui();
            }

            statusBar.EndProgress();

            try {
                if (Errors.Length > 0 || Warnings.Length > 0)
                {
                    if (Errors.Length > 0)
                    {
                        statusBar.ShowError(Errors [Errors.Length - 1].Message);
                    }
                    else if (SuccessMessages.Length == 0)
                    {
                        statusBar.ShowWarning(Warnings [Warnings.Length - 1]);
                    }

                    DesktopService.ShowGlobalProgressError();

                    base.OnCompleted();

                    if (!CancellationToken.IsCancellationRequested && showErrorDialogs)
                    {
                        this.ShowResultDialog();
                    }
                    return;
                }

                if (SuccessMessages.Length > 0)
                {
                    statusBar.ShowMessage(MonoDevelop.Ide.Gui.Stock.StatusSuccess, SuccessMessages [SuccessMessages.Length - 1]);
                }
            } finally {
                statusBar.StatusSourcePad = statusSourcePad;
                statusBar.Dispose();
            }

            DesktopService.SetGlobalProgress(Progress);

            base.OnCompleted();
        }
Beispiel #9
0
        protected override void OnCompleted()
        {
            if (lockGui)
            {
                IdeApp.Workbench.UnlockGui();
            }

            statusBar.Dispose();

            if (Errors.Count > 0 || Warnings.Count > 0)
            {
                if (Errors.Count > 0)
                {
                    Gtk.Image img = ImageService.GetImage(Stock.Error, Gtk.IconSize.Menu);
                    IdeApp.Workbench.StatusBar.ShowMessage(img, Errors [Errors.Count - 1]);
                }
                else if (SuccessMessages.Count == 0)
                {
                    Gtk.Image img = ImageService.GetImage(Stock.Warning, Gtk.IconSize.Menu);
                    IdeApp.Workbench.StatusBar.ShowMessage(img, Warnings [Warnings.Count - 1]);
                }

                base.OnCompleted();

                if (showErrorDialogs)
                {
                    ShowResultDialog();
                }

                IdeApp.Workbench.StatusBar.SetMessageSourcePad(statusSourcePad);
                return;
            }

            if (SuccessMessages.Count > 0)
            {
                IdeApp.Workbench.StatusBar.ShowMessage(SuccessMessages [SuccessMessages.Count - 1]);
            }

            IdeApp.Workbench.StatusBar.SetMessageSourcePad(statusSourcePad);
            base.OnCompleted();
        }
Beispiel #10
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();
                    });
                });
            }
Beispiel #11
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);
            }
        }
        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;
                }
            };
        }
        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;
                }
            };
        }