[PATCH] FileMask with multi file support & Double click on output pads path open the file

View: New views
3 Messages — Rating Filter:   Alert me  

[PATCH] FileMask with multi file support & Double click on output pads path open the file

by olivier dufour :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Here are 2 small modifications :
 MonoDevelop.Ide.FindInFiles.FilterOptions.cs: FilterMask multi file support
 MonoDevelop.Ide.Gui.Pads.DefaultMonitorPad : double click on output pad path load the file.

The first one is really useful to search for reference in more than one file mask.
The second one is based on todo list. It may be optimum by using BuildErrorFromOuputString from each language binding to get the exact location but it mean add an event on DefaultMonitorPad which forward to textView buttonPressed... and modify all language Compile system.

cheers

Olivier Dufour

[FileMaskMultiFileAndDoubleClickOnOutputPadsPathLoadFile.patch]

Index: MonoDevelop.Ide.FindInFiles/FilterOptions.cs
===================================================================
--- MonoDevelop.Ide.FindInFiles/FilterOptions.cs (révision 144689)
+++ MonoDevelop.Ide.FindInFiles/FilterOptions.cs (copie de travail)
@@ -56,7 +56,11 @@
  {
  if (string.IsNullOrEmpty (FileMask) || FileMask == "*")
  return true;
- return new PatternMatcher (FileMask).Match (name);
+ foreach(string mask in FileMask.Split(new char[] {';'}, StringSplitOptions.RemoveEmptyEntries)) {
+ if (new PatternMatcher (mask.Trim()).Match (name))
+ return true;
+ }
+ return false;
  }
 
  public static bool IsWordSeparator (char ch)
Index: ChangeLog
===================================================================
--- ChangeLog (révision 144689)
+++ ChangeLog (copie de travail)
@@ -1,3 +1,8 @@
+2009-10-20  Olivier Dufour  <olivier.duff@...>
+
+ * MonoDevelop.Ide.FindInFiles.FilterOptions.cs: FilterMask multi file support
+ * MonoDevelop.Ide.Gui.Pads.DefaultMonitorPad : double click on output pad path load the file
+  
 2009-10-22  Mike Krüger  <mkrueger@...>
 
  * MonoDevelop.Ide.Gui.Content/CompletionTextEditorExtension.cs:
Index: MonoDevelop.Ide.Gui.Pads/DefaultMonitorPad.cs
===================================================================
--- MonoDevelop.Ide.Gui.Pads/DefaultMonitorPad.cs (révision 144689)
+++ MonoDevelop.Ide.Gui.Pads/DefaultMonitorPad.cs (copie de travail)
@@ -39,6 +39,8 @@
 
 using Gtk;
 using Pango;
+using MonoDevelop.Ide.Tasks;
+using System.Text.RegularExpressions;
 
 namespace MonoDevelop.Ide.Gui.Pads
 {
@@ -87,6 +89,9 @@
  buffer = new Gtk.TextBuffer (new Gtk.TextTagTable ());
  textEditorControl = new Gtk.TextView (buffer);
  textEditorControl.Editable = false;
+ textEditorControl.ButtonPressEvent += OnButtonPressEvent;
+            
+            
  scroller = new Gtk.ScrolledWindow ();
  scroller.ShadowType = ShadowType.None;
  scroller.Add (textEditorControl);
@@ -143,7 +148,41 @@
 
  outputDispatcher = new GLib.TimeoutHandler (outputDispatchHandler);
  }
+
+ [GLib.ConnectBefore]
+ void OnButtonPressEvent (object o, ButtonPressEventArgs args)
+ {
+ if (args.Event.Button == 1 && args.Event.Type == Gdk.EventType.TwoButtonPress)
+ {
+ TextIter iter, start;
+ int linetop;
+ int x = -1, y = -1;
+ textEditorControl.WindowToBufferCoords (Gtk.TextWindowType.Text, (int)args.Event.X, (int)args.Event.Y, out x, out y);
+ textEditorControl.GetLineAtY (out iter, y, out linetop);
+ start = iter.Copy ();
+
+ iter.ForwardToLineEnd ();
+ string line = start.GetText (iter);
+ ParseLineAndJump (line);
+ }
+ }
+ //linux path only
+ static Regex regexPath = new Regex (@"(?<file>(/[^/]+)*\.[^/ \(]+)", RegexOptions.Compiled | RegexOptions.ExplicitCapture);
 
+ void ParseLineAndJump (string line)
+ {
+ Match match = regexPath.Match(line);
+ if (!match.Success)
+ return;
+            
+ BuildError error = new BuildError ();
+ error.FileName = match.Result ("${file}") ?? "";
+ error.Line = 1;
+ error.Column = 1;
+ Task task = new Task (error);
+ task.JumpToPosition();
+ }
+
  //mechanism to to batch copy text when large amounts are being dumped
  bool outputDispatchHandler ()
  {


_______________________________________________
Monodevelop-list mailing list
Monodevelop-list@...
http://lists.ximian.com/mailman/listinfo/monodevelop-list

Re: [PATCH] FileMask with multi file support & Double click on output pads path open the file

by Lluis Sanchez Gual :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the patch!

Just a couple of comments:
      * It would be nice to support windows paths too.
      * To jump to a file, you can use
        IdeApp.Workbench.OpenDocument(file,line,column)

Lluis.

El dj 22 de 10 de 2009 a les 23:40 +0200, en/na olivier dufour va
escriure:

> Hi,
>
> Here are 2 small modifications :
>  MonoDevelop.Ide.FindInFiles.FilterOptions.cs: FilterMask multi file
> support
>  MonoDevelop.Ide.Gui.Pads.DefaultMonitorPad : double click on output
> pad path load the file.
>
> The first one is really useful to search for reference in more than
> one file mask.
> The second one is based on todo list. It may be optimum by using
> BuildErrorFromOuputString from each language binding to get the exact
> location but it mean add an event on DefaultMonitorPad which forward
> to textView buttonPressed... and modify all language Compile system.
>
> cheers
>
> Olivier Dufour
> _______________________________________________
> Monodevelop-list mailing list
> Monodevelop-list@...
> http://lists.ximian.com/mailman/listinfo/monodevelop-list

_______________________________________________
Monodevelop-list mailing list
Monodevelop-list@...
http://lists.ximian.com/mailman/listinfo/monodevelop-list

Re: [PATCH] FileMask with multi file support & Double click on output pads path open the file

by olivier dufour :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Here is new patch with 2 remarks include.

cheers,
Olivier Dufour


On Mon, Oct 26, 2009 at 10:19 AM, Lluis Sanchez Gual <lluis@...> wrote:
Thanks for the patch!

Just a couple of comments:
     * It would be nice to support windows paths too.
     * To jump to a file, you can use
       IdeApp.Workbench.OpenDocument(file,line,column)

Lluis.

El dj 22 de 10 de 2009 a les 23:40 +0200, en/na olivier dufour va
escriure:
> Hi,
>
> Here are 2 small modifications :
>  MonoDevelop.Ide.FindInFiles.FilterOptions.cs: FilterMask multi file
> support
>  MonoDevelop.Ide.Gui.Pads.DefaultMonitorPad : double click on output
> pad path load the file.
>
> The first one is really useful to search for reference in more than
> one file mask.
> The second one is based on todo list. It may be optimum by using
> BuildErrorFromOuputString from each language binding to get the exact
> location but it mean add an event on DefaultMonitorPad which forward
> to textView buttonPressed... and modify all language Compile system.
>
> cheers
>
> Olivier Dufour
> _______________________________________________
> Monodevelop-list mailing list
> Monodevelop-list@...



_______________________________________________
Monodevelop-list mailing list
Monodevelop-list@...
http://lists.ximian.com/mailman/listinfo/monodevelop-list

FileMaskMultiFileAndDoubleClickOnOutputPadsPathLoadFile.patch2 (5K) Download Attachment