public override void InformMouseHover (Mono.TextEditor.MonoTextEditor editor, Margin margin, MarginMouseEventArgs args)
		{
			if (!(margin is ActionMargin))
				return;
			string toolTip;
			if (unitTest.IsFixture) {
				if (isFailed) {
					toolTip = GettextCatalog.GetString ("NUnit Fixture failed (click to run)");
					if (!string.IsNullOrEmpty (failMessage))
						toolTip += Environment.NewLine + failMessage.TrimEnd ();
				} else {
					toolTip = GettextCatalog.GetString ("NUnit Fixture (click to run)");
				}
			} else {
				if (isFailed) {
					toolTip = GettextCatalog.GetString ("NUnit Test failed (click to run)");
					if (!string.IsNullOrEmpty (failMessage))
						toolTip += Environment.NewLine + failMessage.TrimEnd ();
					foreach (var id in unitTest.TestCases) {
						if (host.IsFailure (unitTest.UnitTestIdentifier, id)) {
							var msg = host.GetMessage (unitTest.UnitTestIdentifier, id);
							if (!string.IsNullOrEmpty (msg)) {
								toolTip += Environment.NewLine + "Test" + id + ":";
								toolTip += Environment.NewLine + msg.TrimEnd ();
							}
						}
					}
				} else {
					toolTip = GettextCatalog.GetString ("NUnit Test (click to run)");
				}

			}
			editor.TooltipText = toolTip;
		}
		public override void InformMouseHover (MonoTextEditor editor, Margin margin, MarginMouseEventArgs args)
		{
			base.InformMouseHover (editor, margin, args);
			if (!string.IsNullOrEmpty (Tooltip)) {
				if (CanDrawForeground (margin))
					// update tooltip during the next ui loop run,
					// otherwise Gtk will not update the position of the tooltip
					Gtk.Application.Invoke (delegate {
						args.Editor.TooltipText = Tooltip;
					});
				else if (args.Editor.TooltipText == Tooltip)
					args.Editor.TooltipText = null;
			}
		}
//		static Menu menu;

		public override void InformMousePress (Mono.TextEditor.MonoTextEditor editor, Margin margin, MarginMouseEventArgs args)
		{
			if (!(margin is ActionMargin))
				return;
			host.PopupContextMenu (unitTest, (int)(args.X + margin.XOffset), (int)args.Y);
			editor.TextArea.ResetMouseState (); 
		}
Beispiel #4
0
		public override bool CanDrawBackground (Margin margin)
		{
			return margin is TextViewMargin;
		}
		public override bool CanDrawForeground (Margin margin)
		{
			if (!IsVisible)
				return false;
			return margin is IconMargin;
		}
		public override bool CanDrawForeground (Margin margin)
		{
			return margin is IconMargin;
		}
Beispiel #7
0
		internal MarginDrawMetrics (Margin margin, Cairo.Rectangle area, DocumentLine lineSegment, long lineNumber, double x, double y, double height)
		{
			this.Margin = margin;
			this.Area = area;
			this.LineSegment = lineSegment;
			this.LineNumber = lineNumber;
			this.X = x;
			this.Y = y;
			this.Height = height;
		}
Beispiel #8
0
		internal bool CanDraw (Margin margin)
		{
			return CanDrawForeground (margin) || CanDrawBackground (margin);
		}
Beispiel #9
0
 public override bool CanDrawBackground(Margin margin)
 {
     return(false);
 }
Beispiel #10
0
 public override bool CanDrawBackground(Margin margin)
 {
     return(margin is GutterMargin);
 }
Beispiel #11
0
 public void RedrawMarginLine(Margin margin, int logicalLine)
 {
     textArea.RedrawMarginLine(margin, logicalLine);
 }
Beispiel #12
0
 internal void RedrawMargin(Margin margin)
 {
     textArea.RedrawMargin(margin);
 }
Beispiel #13
0
 /// <summary>
 /// Informs the margin marker of a mouse hover event.
 /// </summary>
 /// <param name="editor">The text editor in which the event press occured.</param>
 /// <param name="margin">The margin in which the event occured.</param>
 /// <param name="args">The event arguments.</param>
 public virtual void InformMouseHover(MonoTextEditor editor, Margin margin, MarginMouseEventArgs args)
 {
 }
Beispiel #14
0
 internal bool CanDraw(Margin margin)
 {
     return(CanDrawForeground(margin) || CanDrawBackground(margin));
 }
Beispiel #15
0
 /// <summary>
 /// Determines whether this margin marker can draw the foreground of the specified margin.
 /// </summary>
 public virtual bool CanDrawForeground(Margin margin)
 {
     return(false);
 }
		public override bool CanDrawBackground (Margin margin)
		{
			return margin is FoldMarkerMargin || margin is GutterMargin || margin is IconMargin || margin is ActionMargin;
		}
Beispiel #17
0
		/// <summary>
		/// Determines whether this margin marker can draw the foreground of the specified margin.
		/// </summary>
		public virtual bool CanDrawForeground (Margin margin)
		{
			return false;
		}
Beispiel #18
0
 public override bool CanDrawForeground(Margin margin)
 {
     return(margin is IconMargin);
 }
Beispiel #19
0
		/// <summary>
		/// Informs the margin marker of a mouse hover event.
		/// </summary>
		/// <param name="editor">The text editor in which the event press occured.</param>
		/// <param name="margin">The margin in which the event occured.</param>
		/// <param name="args">The event arguments.</param>
		public virtual void InformMouseHover (TextEditor editor, Margin margin, MarginMouseEventArgs args)
		{
		}
			public override void InformMousePress (TextEditor editor, Margin margin, MarginMouseEventArgs args)
			{
				if (!(margin is ActionMargin))
					return;

				var debugModeSet = Runtime.ProcessService.GetDebugExecutionMode ();

				var menu = new ContextMenu ();
				if (unitTest.IsFixture) {
					var menuItem = new ContextMenuItem ("_Run All");
					menuItem.Clicked += new TestRunner (doc, unitTest.UnitTestIdentifier, false).Run;
					menu.Items.Add (menuItem);

					if (debugModeSet != null) {
						menuItem = new ContextMenuItem ("_Debug All");
						menuItem.Clicked += new TestRunner (doc, unitTest.UnitTestIdentifier, true).Run;
						menu.Items.Add (menuItem);
					}

					menuItem = new ContextMenuItem ("_Select in Test Pad");
					menuItem.Clicked += new TestRunner (doc, unitTest.UnitTestIdentifier, true).Select;
					menu.Items.Add (menuItem);
				} else {
					if (unitTest.TestCases.Count == 0) {
						var menuItem = new ContextMenuItem ("_Run");
						menuItem.Clicked += new TestRunner (doc, unitTest.UnitTestIdentifier, false).Run;
						menu.Items.Add (menuItem);
						if (debugModeSet != null) {
							menuItem = new ContextMenuItem ("_Debug");
							menuItem.Clicked += new TestRunner (doc, unitTest.UnitTestIdentifier, true).Run;
							menu.Items.Add (menuItem);
						}
						menuItem = new ContextMenuItem ("_Select in Test Pad");
						menuItem.Clicked += new TestRunner (doc, unitTest.UnitTestIdentifier, true).Select;
						menu.Items.Add (menuItem);
					} else {
						var menuItem = new ContextMenuItem ("_Run All");
						menuItem.Clicked += new TestRunner (doc, unitTest.UnitTestIdentifier, false).Run;
						menu.Items.Add (menuItem);
						if (debugModeSet != null) {
							menuItem = new ContextMenuItem ("_Debug All");
							menuItem.Clicked += new TestRunner (doc, unitTest.UnitTestIdentifier, true).Run;
							menu.Items.Add (menuItem);
						}
						menu.Items.Add (new SeparatorContextMenuItem ());
						foreach (var id in unitTest.TestCases) {
							var submenu = new ContextMenu ();
							menuItem = new ContextMenuItem ("_Run");
							menuItem.Clicked += new TestRunner (doc, unitTest.UnitTestIdentifier + id, false).Run;
							submenu.Items.Add (menuItem);
							if (debugModeSet != null) {
								menuItem = new ContextMenuItem ("_Debug");
								menuItem.Clicked += new TestRunner (doc, unitTest.UnitTestIdentifier + id, true).Run;
								submenu.Items.Add (menuItem);
							}

							var label = "Test" + id;
							string tooltip = null;
							var test = NUnitService.Instance.SearchTestById (unitTest.UnitTestIdentifier + id);
							if (test != null) {
								var result = test.GetLastResult ();
								if (result != null && result.IsFailure) {
									tooltip = result.Message;
									label += "!";
								}
							}

							menuItem = new ContextMenuItem ("_Select in Test Pad");
							menuItem.Clicked += new TestRunner (doc, unitTest.UnitTestIdentifier + id, true).Select;
							submenu.Items.Add (menuItem);

							var subMenuItem = new ContextMenuItem (label);
							//if (!string.IsNullOrEmpty (tooltip))
							//	subMenuItem.TooltipText = tooltip;

							subMenuItem.SubMenu = submenu;
							menu.Items.Add (subMenuItem);
						}
					}
				}

				menu.Show (editor, (int)(args.X + margin.XOffset), (int)args.Y);
			}
		public override bool CanDrawBackground (Margin margin)
		{
			return false;
		}
			public override void InformMouseHover (TextEditor editor, Margin margin, MarginMouseEventArgs args)
			{
				string toolTip;
				if (unitTest.IsFixture) {
					if (isFailed) {
						toolTip = GettextCatalog.GetString ("NUnit Fixture failed (click to run)");
						if (!string.IsNullOrEmpty (failMessage))
							toolTip += Environment.NewLine + failMessage.TrimEnd ();
					} else {
						toolTip = GettextCatalog.GetString ("NUnit Fixture (click to run)");
					}
				} else {
					if (isFailed) {
						toolTip = GettextCatalog.GetString ("NUnit Test failed (click to run)");
						if (!string.IsNullOrEmpty (failMessage))
							toolTip += Environment.NewLine + failMessage.TrimEnd ();
						foreach (var id in unitTest.TestCases) {
							var test = NUnitService.Instance.SearchTestById (unitTest.UnitTestIdentifier + id);
							if (test != null) {
								var result = test.GetLastResult ();
								if (result != null && result.IsFailure) {
									if (!string.IsNullOrEmpty (result.Message)) {
										toolTip += Environment.NewLine + "Test" + id +":";
										toolTip += Environment.NewLine + result.Message.TrimEnd ();
									}
								}
							}

						}
					} else {
						toolTip = GettextCatalog.GetString ("NUnit Test (click to run)");
					}

				}
				editor.TooltipText = toolTip;
			}
		public override bool CanDrawBackground (Margin margin)
		{
			if (!IsVisible)
				return false;
			return margin is FoldMarkerMargin || margin is GutterMargin || margin is IconMargin || margin is ActionMargin;
		}
			public override void InformMousePress (TextEditor editor, Margin margin, MarginMouseEventArgs args)
			{
				if (menu != null) {
					menu.Destroy ();
				}
				var debugModeSet = Runtime.ProcessService.GetDebugExecutionMode ();

				menu = new Menu ();
				if (unitTest.IsFixture) {
					var menuItem = new MenuItem ("_Run All");
					menuItem.Activated += new TestRunner (doc, unitTest.UnitTestIdentifier, false).Run;
					menu.Add (menuItem);
					if (debugModeSet != null) {
						menuItem = new MenuItem ("_Debug All");
						menuItem.Activated += new TestRunner (doc, unitTest.UnitTestIdentifier, true).Run;
						menu.Add (menuItem);
					}
					menuItem = new MenuItem ("_Select in Test Pad");
					menuItem.Activated += new TestRunner (doc, unitTest.UnitTestIdentifier, true).Select;
					menu.Add (menuItem);
				} else {
					if (unitTest.TestCases.Count == 0) {
						var menuItem = new MenuItem ("_Run");
						menuItem.Activated += new TestRunner (doc, unitTest.UnitTestIdentifier, false).Run;
						menu.Add (menuItem);
						if (debugModeSet != null) {
							menuItem = new MenuItem ("_Debug");
							menuItem.Activated += new TestRunner (doc, unitTest.UnitTestIdentifier, true).Run;
							menu.Add (menuItem);
						}
						menuItem = new MenuItem ("_Select in Test Pad");
						menuItem.Activated += new TestRunner (doc, unitTest.UnitTestIdentifier, true).Select;
						menu.Add (menuItem);
					} else {
						var menuItem = new MenuItem ("_Run All");
						menuItem.Activated += new TestRunner (doc, unitTest.UnitTestIdentifier, false).Run;
						menu.Add (menuItem);
						if (debugModeSet != null) {
							menuItem = new MenuItem ("_Debug All");
							menuItem.Activated += new TestRunner (doc, unitTest.UnitTestIdentifier, true).Run;
							menu.Add (menuItem);
						}
						menu.Add (new SeparatorMenuItem ());
						foreach (var id in unitTest.TestCases) {
							var submenu = new Menu ();
							menuItem = new MenuItem ("_Run");
							menuItem.Activated += new TestRunner (doc, unitTest.UnitTestIdentifier + id, false).Run;
							submenu.Add (menuItem);
							if (debugModeSet != null) {
								menuItem = new MenuItem ("_Debug");
								menuItem.Activated += new TestRunner (doc, unitTest.UnitTestIdentifier + id, true).Run;
								submenu.Add (menuItem);
							}

							var label = "Test" + id;
							string tooltip = null;
							var test = NUnitService.Instance.SearchTestById (unitTest.UnitTestIdentifier + id);
							if (test != null) {
								var result = test.GetLastResult ();
								if (result != null && result.IsFailure) {
									tooltip = result.Message;
									label += "!";
								}
							}

							menuItem = new MenuItem ("_Select in Test Pad");
							menuItem.Activated += new TestRunner (doc, unitTest.UnitTestIdentifier + id, true).Select;
							submenu.Add (menuItem);


							var subMenuItem = new MenuItem (label);
							if (!string.IsNullOrEmpty (tooltip))
								subMenuItem.TooltipText = tooltip;
							subMenuItem.Submenu = submenu;
							menu.Add (subMenuItem);
						}
					}
				}
				menu.ShowAll ();
				editor.TextArea.ResetMouseState (); 
				GtkWorkarounds.ShowContextMenu (menu, editor, new Gdk.Rectangle ((int)args.X, (int)args.Y, 1, 1));
			}
		bool DrawMarginBackground (TextEditor e, Margin margin, Cairo.Context cr, Cairo.Rectangle area, DocumentLine documentLine, long line, double x, double y, double lineHeight)
		{
			if (cache.CurrentSelectedTextMarker != null && cache.CurrentSelectedTextMarker != this)
				return false;
			cr.Rectangle (x, y, margin.Width, lineHeight);
			cr.SetSourceColor (LineColor.Color);
			cr.Fill ();
			return true;
		}
		/// <summary>
		/// Informs the margin marker of a mouse release event.
		/// </summary>
		/// <param name="editor">The text editor in which the event press occured.</param>
		/// <param name="margin">The margin in which the event occured.</param>
		/// <param name="args">The event arguments.</param>
		public virtual void InformMouseRelease (MonoTextEditor editor, Margin margin, MarginMouseEventArgs args)
		{
		}