Exemple #1
0
        protected override void Run()
        {
            Pad pad = null;

            try
            {
                var pads = IdeApp.Workbench.Pads; // Try get Pads for first time
            }
            catch
            {
            }
            foreach (var p in IdeApp.Workbench.Pads)
            {
                if (string.Equals(p.Id, "MonoDevelop.VersionControl.TFS.TeamExplorerPad", System.StringComparison.OrdinalIgnoreCase))
                {
                    pad = p;
                }
            }
            if (pad == null)
            {
                var content = new MonoDevelop.VersionControl.TFS.GUI.TeamExplorerPad();
                //pad = IdeApp.Workbench.AddPad(content, "MonoDevelop.VersionControl.TFS.TeamExplorerPad", "Team Explorer", "Right", null);
                pad = IdeApp.Workbench.ShowPad(content, "MonoDevelop.VersionControl.TFS.TeamExplorerPad", "Team Explorer", "Right", null);
                if (pad == null)
                {
                    return;
                }
            }
            pad.Sticky   = true;
            pad.AutoHide = false;
            pad.BringToFront();
        }
Exemple #2
0
        public static void Run(string filePath, DProject project, DProjectConfiguration conf)
        {
            if (manager == null)
            {
                manager = new ProgressMonitorManager();
                monitor = manager.GetOutputProgressMonitor("Run Unittest", Stock.RunProgramIcon, true, true);
            }

            Pad pad = manager.GetPadForMonitor(monitor);

            if (pad != null)
            {
                pad.BringToFront();
            }

            monitor.BeginTask("start unittest...", 1);

            new System.Threading.Thread(delegate(){
                string[] cmdParts = GetCmdParts(project);
                string args       = GetCommandArgs(cmdParts.Length >= 2 ?cmdParts[1] : "", filePath, project, conf);
                string errorOutput;
                string stdOutput;
                string execDir = GetExecDir(project, conf);

                ProjectBuilder.ExecuteCommand(cmdParts[0], args, execDir, monitor, out stdOutput, out errorOutput);

                monitor.Log.WriteLine("unittest done.");
                monitor.EndTask();
            }).Start();
        }
 protected void OnSelectTestInTree()
 {
     Pad pad = IdeApp.Workbench.GetPad<TestPad> ();
     pad.BringToFront ();
     TestPad content = (TestPad)pad.Content;
     content.SelectTest (GetSelectedTest ());
 }
 void OnShowPad(object sender, MouseButtonEventArgs e)
 {
     if (sourcePad != null)
     {
         sourcePad.BringToFront(true);
     }
 }
 void HandleEventMessageBoxButtonPressEvent(object o, ButtonPressEventArgs args)
 {
     if (sourcePad != null)
     {
         sourcePad.BringToFront(true);
     }
 }
Exemple #6
0
        protected override void Run()
        {
            Pad pad = null;

            var pads = IdeApp.Workbench.Pads;

            foreach (var p in IdeApp.Workbench.Pads)
            {
                if (string.Equals(p.Id, "LiveXAMLAddin.Pads.XAMLPreviewerPad", StringComparison.OrdinalIgnoreCase))
                {
                    pad = p;
                }
            }

            if (pad == null)
            {
                var content = new Pads.XAMLPreviewerPad();

                pad = IdeApp.Workbench.ShowPad(content, "LiveXAMLAddin.Pads.XAMLPreviewerPad", "XAML Previewer", "Right", null);

                if (pad == null)
                {
                    return;
                }
            }

            pad.Sticky   = true;
            pad.AutoHide = false;
            pad.BringToFront();
        }
        protected override bool OnKeyReleaseEvent(Gdk.EventKey evnt)
        {
            bool ret;

            if (evnt.Key == Gdk.Key.Control_L || evnt.Key == Gdk.Key.Control_R)
            {
                Gdk.Window focusTarget = null;
                Document   doc         = SelectedDocument;
                if (doc != null)
                {
                    doc.Select();
                    focusTarget = doc.ActiveView.Control.Toplevel.GdkWindow;
                }
                else
                {
                    Pad pad = SelectedPad;
                    if (pad != null)
                    {
                        pad.BringToFront(true);
                        focusTarget = pad.Window.Content.Control.Toplevel.GdkWindow;
                    }
                }
                ret = base.OnKeyReleaseEvent(evnt);
                Gtk.Window parent = this.TransientFor;
                this.Destroy();

                (focusTarget ?? parent.GdkWindow).Focus(0);
            }
            else
            {
                ret = base.OnKeyReleaseEvent(evnt);
            }
            return(ret);
        }
        public IAsyncOperation RunTest(UnitTest test, IExecutionHandler context, bool buildOwnerObject)
        {
            string testName = test.FullName;

            if (buildOwnerObject)
            {
                IBuildTarget bt = test.OwnerObject as IBuildTarget;
                if (bt != null && bt.NeedsBuilding(IdeApp.Workspace.ActiveConfiguration))
                {
                    if (!IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted)
                    {
                        MonoDevelop.Ide.Commands.StopHandler.StopBuildOperations();
                        IdeApp.ProjectOperations.CurrentRunOperation.WaitForCompleted();
                    }

                    AsyncOperation retOper = new AsyncOperation();

                    IAsyncOperation op = IdeApp.ProjectOperations.Build(bt);
                    retOper.TrackOperation(op, false);

                    op.Completed += delegate {
                        // The completed event of the build operation is run in the gui thread,
                        // so we need a new thread, because refreshing must be async
                        System.Threading.ThreadPool.QueueUserWorkItem(delegate {
                            if (op.Success)
                            {
                                RefreshTests();
                                test = SearchTest(testName);
                                if (test != null)
                                {
                                    Gtk.Application.Invoke(delegate {
                                        // RunTest must run in the gui thread
                                        retOper.TrackOperation(RunTest(test, context, false), true);
                                    });
                                }
                                else
                                {
                                    retOper.SetCompleted(false);
                                }
                            }
                        });
                    };

                    return(retOper);
                }
            }

            Pad resultsPad = IdeApp.Workbench.GetPad <TestResultsPad>();

            if (resultsPad == null)
            {
                resultsPad = IdeApp.Workbench.ShowPad(new TestResultsPad(), "MonoDevelop.NUnit.TestResultsPad", GettextCatalog.GetString("Test results"), "Bottom", "md-solution");
            }

            resultsPad.BringToFront();
            TestSession session = new TestSession(test, context, (TestResultsPad)resultsPad.Content);

            session.Start();
            return(session);
        }
        public static void AddWatch(string expression)
        {
            Pad pad = IdeApp.Workbench.GetPad <WatchPad> ();

            pad.BringToFront(false);
            WatchPad wp = (WatchPad)pad.Content;

            wp.AddWatch(expression);
        }
Exemple #10
0
 public static void Show(AggregatedProgressMonitor monitor)
 {
     Runtime.RunInMainThread(() => {
         Pad pad = IdeApp.Workbench.ProgressMonitors.GetPadForMonitor(monitor.LeaderMonitor);
         if (pad != null)
         {
             pad.BringToFront();
         }
     });
 }
        public static void ShowErrors()
        {
            Pad errorsPad = IdeApp.Workbench.GetPad <MonoDevelop.Ide.Gui.Pads.ErrorListPad> ();

            if (errorsPad != null)
            {
                errorsPad.Visible = true;
                errorsPad.BringToFront();
            }
        }
 public static void ShowPackageConsole(this IProgressMonitor monitor)
 {
     DispatchService.GuiDispatch(() => {
         var aggregatedMonitor = (PackageManagementProgressMonitor)monitor;
         Pad pad = IdeApp.Workbench.ProgressMonitors.GetPadForMonitor(aggregatedMonitor.ConsoleMonitor);
         if (pad != null)
         {
             pad.BringToFront();
         }
     });
 }
 protected override void Run()
 {
     if (pad == null)
     {
         GetXPathQueryPad();
     }
     if (pad != null)
     {
         pad.BringToFront();
     }
 }
 public static void ShowPackageConsole(this ProgressMonitor monitor)
 {
     Runtime.RunInMainThread(() => {
         var aggregatedMonitor = (PackageManagementProgressMonitor)monitor;
         Pad pad = IdeApp.Workbench.ProgressMonitors.GetPadForMonitor(aggregatedMonitor.ConsoleMonitor);
         if (pad != null)
         {
             pad.BringToFront();
         }
     });
 }
Exemple #15
0
        public override void MouseDown(NSEvent theEvent)
        {
            base.MouseDown(theEvent);

            CGPoint location = ConvertPointFromView(theEvent.LocationInWindow, null);

            if (textField.IsMouseInRect(location, textField.Frame) && sourcePad != null)
            {
                sourcePad.BringToFront(true);
            }
        }
Exemple #16
0
        protected override void Run(object dataItem)
        {
            if (dataItem == null)
            {
                return;
            }
            Pad pad = (Pad)dataItem;

            pad.Visible = true;
            pad.BringToFront(true);
        }
Exemple #17
0
        internal static void EvaluateText(string text)
        {
            Runtime.AssertMainThread();

            Pad pad = IdeApp.Workbench.GetPad <CSharpInteractivePad> ();

            pad.BringToFront();

            var input = new ConsoleInputEventArgs(text);

            Instance.OnConsoleInput(Instance.view, input);
        }
Exemple #18
0
        void OnInspect(object obj)
        {
            ObjectPath path  = obj.GetObjectPath(expression);
            var        value = ObjectValueCreator.Create(obj, path);

            Runtime.RunInMainThread(() => {
                Pad pad = IdeApp.Workbench.GetPad <ObjectInspectorPad> ();

                var objectInspectorPad = (ObjectInspectorPad)pad.Content;
                objectInspectorPad.Inspect(value);

                pad.BringToFront();
            }).Ignore();
        }
Exemple #19
0
        protected override void Run(object dataItem)
        {
            if (dataItem == null)
            {
                return;
            }
            Pad pad = (Pad)dataItem;

            pad.Visible = true;
            pad.BringToFront(true);

            Counters.PadShown.Inc(1, null, new Dictionary <string, object> {
                { "Pad", pad.Id }
            });
        }
Exemple #20
0
        static Pad GetTestResultsPad()
        {
            Pad resultsPad = IdeApp.Workbench.GetPad <TestResultsPad> ();

            if (resultsPad == null)
            {
                resultsPad = IdeApp.Workbench.ShowPad(new TestResultsPad(), "MonoDevelop.UnitTesting.TestResultsPad", GettextCatalog.GetString("Test results"), "Bottom", "md-solution");
            }

            // Make the pad sticky while the tests are runnig, so the results pad is always visible (even if minimized)
            // That's required since when running in debug mode, the layout is automatically switched to debug.

            resultsPad.Sticky = true;
            resultsPad.BringToFront();
            return(resultsPad);
        }
Exemple #21
0
        public override void MouseDown(NSEvent theEvent)
        {
            base.MouseDown(theEvent);

            CGPoint location = ConvertPointFromView(theEvent.LocationInWindow, null);
            var     layer    = LayerForPoint(location);

            if (layer != null && layer.Name != null)
            {
                Xwt.PointerButton button = Xwt.PointerButton.Left;
                switch ((NSEventType)(long)theEvent.ButtonNumber)
                {
                case NSEventType.LeftMouseDown:
                    button = Xwt.PointerButton.Left;
                    break;

                case NSEventType.RightMouseDown:
                    button = Xwt.PointerButton.Right;
                    break;

                case NSEventType.OtherMouseDown:
                    button = Xwt.PointerButton.Middle;
                    break;
                }

                if (layerToStatus.ContainsKey(layer.Name))
                {
                    DestroyPopover();
                    layerToStatus [layer.Name].NotifyClicked(button);
                    return;
                }

                if (layer.Name == BuildIconLayerId || layer.Name == BuildTextLayerId)                   // We clicked error icon.
                {
                    IdeApp.Workbench.GetPad <MonoDevelop.Ide.Gui.Pads.ErrorListPad> ().BringToFront();
                    return;
                }
            }

            if (sourcePad != null)
            {
                sourcePad.BringToFront(true);
            }
        }
Exemple #22
0
        public StatusArea()
        {
            theme     = new StatusAreaTheme();
            renderArg = new RenderArg();

            mainContext   = new MainStatusBarContextImpl(this);
            activeContext = mainContext;
            contexts.Add(mainContext);

            VisibleWindow = false;
            NoShowAll     = true;
            WidgetFlags  |= Gtk.WidgetFlags.AppPaintable;

            statusIconBox.BorderWidth = 0;
            statusIconBox.Spacing     = 3;

            Action <bool> animateProgressBar =
                showing => this.Animate("ProgressBarFade",
                                        val => renderArg.ProgressBarAlpha = val,
                                        renderArg.ProgressBarAlpha,
                                        showing ? 1.0f : 0.0f,
                                        easing: Easing.CubicInOut);

            ProgressBegin += delegate {
                renderArg.ShowProgressBar = true;
//				StartBuildAnimation ();
                renderArg.ProgressBarFraction = 0;
                QueueDraw();
                animateProgressBar(true);
            };

            ProgressEnd += delegate {
                renderArg.ShowProgressBar = false;
//				StopBuildAnimation ();
                QueueDraw();
                animateProgressBar(false);
            };

            ProgressFraction += delegate(object sender, FractionEventArgs e) {
                renderArg.ProgressBarFraction = (float)e.Work;
                QueueDraw();
            };

            contentBox.PackStart(messageBox, true, true, 0);
            contentBox.PackEnd(statusIconBox, false, false, 0);
            contentBox.PackEnd(statusIconSeparator = new StatusAreaSeparator(), false, false, 0);
            contentBox.PackEnd(buildResultWidget   = CreateBuildResultsWidget(Orientation.Horizontal), false, false, 0);

            HasTooltip    = true;
            QueryTooltip += messageBoxToolTip;

            mainAlign              = new Alignment(0, 0.5f, 1, 0);
            mainAlign.LeftPadding  = 12;
            mainAlign.RightPadding = 8;
            mainAlign.Add(contentBox);
            Add(mainAlign);

            mainAlign.ShowAll();
            statusIconBox.Hide();
            statusIconSeparator.Hide();
            buildResultWidget.Hide();
            Show();

            this.ButtonPressEvent += delegate {
                if (sourcePad != null)
                {
                    sourcePad.BringToFront(true);
                }
            };

            statusIconBox.Shown += delegate {
                UpdateSeparators();
            };

            statusIconBox.Hidden += delegate {
                UpdateSeparators();
            };

            messageQueue = new Queue <Message> ();

            tracker                 = new MouseTracker(this);
            tracker.MouseMoved     += (sender, e) => QueueDraw();
            tracker.HoveredChanged += (sender, e) => {
                this.Animate("Hovered",
                             x => renderArg.HoverProgress = x,
                             renderArg.HoverProgress,
                             tracker.Hovered ? 1.0f : 0.0f,
                             easing: Easing.SinInOut);
            };

            IdeApp.FocusIn += delegate {
                // If there was an error while the application didn't have the focus,
                // trigger the error animation again when it gains the focus
                if (errorAnimPending)
                {
                    errorAnimPending = false;
                    TriggerErrorAnimation();
                }
            };
        }
Exemple #23
0
        internal static async Task RunTests(IEnumerable <UnitTest> tests, MonoDevelop.Projects.ExecutionContext context, bool buildOwnerObject, bool checkCurrentRunOperation, CancellationTokenSource cs)
        {
            if (buildOwnerObject)
            {
                var build_targets = new HashSet <IBuildTarget> ();
                foreach (var t in tests)
                {
                    IBuildTarget bt = t.OwnerObject as IBuildTarget;
                    if (bt != null)
                    {
                        build_targets.Add(bt);
                    }
                }
                if (build_targets.Count > 0)
                {
                    if (!IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted)
                    {
                        MonoDevelop.Ide.Commands.StopHandler.StopBuildOperations();
                        await IdeApp.ProjectOperations.CurrentRunOperation.Task;
                    }

                    foreach (var bt in build_targets)
                    {
                        var res = await IdeApp.ProjectOperations.Build(bt, cs.Token).Task;

                        if (res.HasErrors)
                        {
                            return;
                        }
                    }

                    var test_names = new HashSet <string> (tests.Select((v) => v.FullName));

                    await RefreshTests(cs.Token);

                    tests = test_names.Select((fullName) => SearchTest(fullName)).Where((t) => t != null).ToList();

                    if (tests.Any())
                    {
                        await RunTests(tests, context, false, checkCurrentRunOperation, cs);
                    }
                    return;
                }
            }

            if (checkCurrentRunOperation && !IdeApp.ProjectOperations.ConfirmExecutionOperation())
            {
                return;
            }

            Pad resultsPad = IdeApp.Workbench.GetPad <TestResultsPad>();

            if (resultsPad == null)
            {
                resultsPad = IdeApp.Workbench.ShowPad(new TestResultsPad(), "MonoDevelop.UnitTesting.TestResultsPad", GettextCatalog.GetString("Test results"), "Bottom", "md-solution");
            }

            // Make the pad sticky while the tests are runnig, so the results pad is always visible (even if minimized)
            // That's required since when running in debug mode, the layout is automatically switched to debug.

            resultsPad.Sticky = true;
            resultsPad.BringToFront();

            var         test    = tests.Count() == 1 ? tests.First() : new UnitTestSelection(tests, tests.First().OwnerObject);
            TestSession session = new TestSession(test, context, (TestResultsPad)resultsPad.Content, cs);

            OnTestSessionStarting(new TestSessionEventArgs {
                Session = session, Test = test
            });

            if (checkCurrentRunOperation)
            {
                IdeApp.ProjectOperations.AddRunOperation(session);
            }

            try {
                await session.Start();
            } finally {
                resultsPad.Sticky = false;
            }
        }
Exemple #24
0
        void StatusBarIconClicked(object sender, StatusBarIconClickedEventArgs e)
        {
            Pad pad = IdeApp.Workbench.GetPad <LogMonitorPad> ();

            pad.BringToFront(true);
        }
        internal static async Task RunTest(UnitTest test, MonoDevelop.Projects.ExecutionContext context, bool buildOwnerObject, bool checkCurrentRunOperation, CancellationTokenSource cs)
        {
            string testName = test.FullName;

            if (buildOwnerObject)
            {
                IBuildTarget bt = test.OwnerObject as IBuildTarget;
                if (bt != null)
                {
                    if (!IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted)
                    {
                        MonoDevelop.Ide.Commands.StopHandler.StopBuildOperations();
                        await IdeApp.ProjectOperations.CurrentRunOperation.Task;
                    }

                    var res = await IdeApp.ProjectOperations.Build(bt, cs.Token).Task;

                    if (res.HasErrors)
                    {
                        return;
                    }

                    await RefreshTests(cs.Token);

                    test = SearchTest(testName);
                    if (test != null)
                    {
                        await RunTest(test, context, false, checkCurrentRunOperation, cs);
                    }
                    return;
                }
            }

            if (checkCurrentRunOperation && !IdeApp.ProjectOperations.ConfirmExecutionOperation())
            {
                return;
            }

            Pad resultsPad = IdeApp.Workbench.GetPad <TestResultsPad>();

            if (resultsPad == null)
            {
                resultsPad = IdeApp.Workbench.ShowPad(new TestResultsPad(), "MonoDevelop.UnitTesting.TestResultsPad", GettextCatalog.GetString("Test results"), "Bottom", "md-solution");
            }

            // Make the pad sticky while the tests are runnig, so the results pad is always visible (even if minimized)
            // That's required since when running in debug mode, the layout is automatically switched to debug.

            resultsPad.Sticky = true;
            resultsPad.BringToFront();

            TestSession session = new TestSession(test, context, (TestResultsPad)resultsPad.Content, cs);

            OnTestSessionStarting(new TestSessionEventArgs {
                Session = session, Test = test
            });

            if (checkCurrentRunOperation)
            {
                IdeApp.ProjectOperations.CurrentRunOperation = session;
            }

            try {
                await session.Start();
            } finally {
                resultsPad.Sticky = false;
            }
        }
Exemple #26
0
        internal IAsyncOperation RunTest(UnitTest test, IExecutionHandler context, bool buildOwnerObject, bool checkCurrentRunOperation)
        {
            string testName = test.FullName;

            if (buildOwnerObject)
            {
                IBuildTarget bt = test.OwnerObject as IBuildTarget;
                if (bt != null && bt.NeedsBuilding(IdeApp.Workspace.ActiveConfiguration))
                {
                    if (!IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted)
                    {
                        MonoDevelop.Ide.Commands.StopHandler.StopBuildOperations();
                        IdeApp.ProjectOperations.CurrentRunOperation.WaitForCompleted();
                    }

                    AsyncOperation retOper = new AsyncOperation();

                    IAsyncOperation op = IdeApp.ProjectOperations.Build(bt);
                    retOper.TrackOperation(op, false);

                    op.Completed += delegate {
                        // The completed event of the build operation is run in the gui thread,
                        // so we need a new thread, because refreshing must be async
                        System.Threading.ThreadPool.QueueUserWorkItem(delegate {
                            if (op.Success)
                            {
                                RefreshTests();
                                test = SearchTest(testName);
                                if (test != null)
                                {
                                    Gtk.Application.Invoke(delegate {
                                        // RunTest must run in the gui thread
                                        retOper.TrackOperation(RunTest(test, context, false), true);
                                    });
                                }
                                else
                                {
                                    retOper.SetCompleted(false);
                                }
                            }
                        });
                    };

                    return(retOper);
                }
            }

            if (checkCurrentRunOperation && !IdeApp.ProjectOperations.ConfirmExecutionOperation())
            {
                return(NullProcessAsyncOperation.Failure);
            }

            Pad resultsPad = IdeApp.Workbench.GetPad <TestResultsPad>();

            if (resultsPad == null)
            {
                resultsPad = IdeApp.Workbench.ShowPad(new TestResultsPad(), "MonoDevelop.NUnit.TestResultsPad", GettextCatalog.GetString("Test results"), "Bottom", "md-solution");
            }

            // Make the pad sticky while the tests are runnig, so the results pad is always visible (even if minimized)
            // That's required since when running in debug mode, the layout is automatically switched to debug.

            resultsPad.Sticky = true;
            resultsPad.BringToFront();

            TestSession session = new TestSession(test, context, (TestResultsPad)resultsPad.Content);

            session.Completed += delegate {
                Gtk.Application.Invoke(delegate {
                    resultsPad.Sticky = false;
                });
            };

            OnTestSessionStarting(new TestSessionEventArgs {
                Session = session, Test = test
            });

            session.Start();

            if (checkCurrentRunOperation)
            {
                IdeApp.ProjectOperations.CurrentRunOperation = session;
            }

            return(session);
        }