Author: lluis
Date: 2006-07-25 07:43:17 -0400 (Tue, 25 Jul 2006)
New Revision: 62950

Modified:
   trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/ChangeLog
   
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Completion/CodeCompletionDataProvider.cs
   
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Completion/CompletionListWindow.cs
   
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Completion/ICompletionDataProvider.cs
   
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Completion/ListWindow.cs
   
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Deployment/FileDeployTargetEditor.cs
   
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.mdp
Log:
2006-07-25 Lluis Sanchez Gual  <[EMAIL PROTECTED]>

        * MonoDevelop.Projects.Gui.Deployment/FileDeployTargetEditor.cs:
          Fix incorrect type check.
        
        * MonoDevelop.Projects.Gui.Completion/ICompletionDataProvider.cs:
        * MonoDevelop.Projects.Gui.Completion/CodeCompletionDataProvider.cs:
        * MonoDevelop.Projects.Gui.Completion/ListWindow.cs:
        * MonoDevelop.Projects.Gui.Completion/CompletionListWindow.cs:
          When the code completion window is shown and the parser database
          is still being generated, the completion window will now show a 
message
          saying that class information is being gathered.



Modified: trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/ChangeLog
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/ChangeLog       
2006-07-25 11:37:47 UTC (rev 62949)
+++ trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/ChangeLog       
2006-07-25 11:43:17 UTC (rev 62950)
@@ -1,3 +1,16 @@
+2006-07-25 Lluis Sanchez Gual  <[EMAIL PROTECTED]>
+
+       * MonoDevelop.Projects.Gui.Deployment/FileDeployTargetEditor.cs:
+         Fix incorrect type check.
+       
+       * MonoDevelop.Projects.Gui.Completion/ICompletionDataProvider.cs:
+       * MonoDevelop.Projects.Gui.Completion/CodeCompletionDataProvider.cs:
+       * MonoDevelop.Projects.Gui.Completion/ListWindow.cs:
+       * MonoDevelop.Projects.Gui.Completion/CompletionListWindow.cs:
+         When the code completion window is shown and the parser database
+         is still being generated, the completion window will now show a 
message
+         saying that class information is being gathered.
+
 2006-07-17 Lluis Sanchez Gual  <[EMAIL PROTECTED]>
 
        * Makefile.am: Removed unused file.

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Completion/CodeCompletionDataProvider.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Completion/CodeCompletionDataProvider.cs
       2006-07-25 11:37:47 UTC (rev 62949)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Completion/CodeCompletionDataProvider.cs
       2006-07-25 11:43:17 UTC (rev 62950)
@@ -27,7 +27,7 @@
        /// <summary>
        /// Data provider for code completion.
        /// </summary>
-       public class CodeCompletionDataProvider : ICompletionDataProvider
+       public class CodeCompletionDataProvider : 
IMutableCompletionDataProvider, IDisposable
        {
 //             static AmbienceService          ambienceService = 
(AmbienceService)ServiceManager.Services.GetService(typeof(AmbienceService));
                Hashtable insertedClasses = new Hashtable ();
@@ -40,7 +40,11 @@
                bool ctrlspace;
                IParserContext parserContext;
                string fileName;
+               EventHandler onStartedParsing;
+               EventHandler onFinishedParsing;
 
+               ArrayList completionData = null;
+               
                public CodeCompletionDataProvider (IParserContext 
parserContext, string fileName) : this (parserContext, fileName, false)
                {
                }
@@ -50,13 +54,27 @@
                        this.fileName = fileName;
                        this.parserContext = parserContext;
                        this.ctrlspace = ctrl;
+                       
+                       onStartedParsing = (EventHandler) 
Services.DispatchService.GuiDispatch (new EventHandler (OnStartedParsing));
+                       onFinishedParsing = (EventHandler) 
Services.DispatchService.GuiDispatch (new EventHandler (OnFinishedParsing));
+                       
+                       parserContext.ParserDatabase.ParseOperationStarted += 
onStartedParsing;
+                       parserContext.ParserDatabase.ParseOperationFinished += 
onFinishedParsing;
                }
                
-               ArrayList completionData = null;
+               public virtual void Dispose ()
+               {
+                       parserContext.ParserDatabase.ParseOperationStarted -= 
onStartedParsing;
+                       parserContext.ParserDatabase.ParseOperationFinished -= 
onFinishedParsing;
+               }
                
                public ICompletionData[] GenerateCompletionData 
(ICompletionWidget widget, char charTyped)
                {
                        completionData = new ArrayList();
+                       insertedClasses.Clear ();
+                       insertedElements.Clear ();
+                       insertedPropertiesElements.Clear ();
+                       insertedEventElements.Clear ();
                        
                        // the parser works with 1 based coordinates
                        caretLineNumber      = widget.TriggerLine + 1;
@@ -67,7 +85,7 @@
                        IExpressionFinder expressionFinder = 
parserContext.GetExpressionFinder(fileName);
                        string expression    = expressionFinder == null ? 
TextUtilities.GetExpressionBeforeOffset(widget, widget.TriggerOffset) : 
expressionFinder.FindExpression(widget.GetText (0, widget.TriggerOffset), 
widget.TriggerOffset - 2).Expression;
                        if (expression == null) return null;
-                       Console.WriteLine ("Expr: |{0}|", expression);
+
                        //FIXME: This chartyped check is a fucking *HACK*
                        if (expression == "is" || expression == "as") {
                                string expr = expressionFinder == null ? 
TextUtilities.GetExpressionBeforeOffset (widget, widget.TriggerOffset - 3) : 
expressionFinder.FindExpression (widget.GetText (0, widget.TriggerOffset), 
widget.TriggerOffset - 5).Expression;
@@ -150,5 +168,24 @@
                                AddResolveResults(results.Members);
                        }
                }
+               
+               public bool IsChanging { 
+                       get { return parserContext.ParserDatabase.IsParsing; } 
+               }
+               
+               void OnStartedParsing (object s, EventArgs args)
+               {
+                       if (CompletionDataChanging != null)
+                               CompletionDataChanging (this, EventArgs.Empty);
+               }
+               
+               void OnFinishedParsing (object s, EventArgs args)
+               {
+                       if (CompletionDataChanged != null)
+                               CompletionDataChanged (this, EventArgs.Empty);
+               }
+               
+               public event EventHandler CompletionDataChanging;
+               public event EventHandler CompletionDataChanged;
        }
 }

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Completion/CompletionListWindow.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Completion/CompletionListWindow.cs
     2006-07-25 11:37:47 UTC (rev 62949)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Completion/CompletionListWindow.cs
     2006-07-25 11:43:17 UTC (rev 62950)
@@ -3,6 +3,7 @@
 
 using Gtk;
 using MonoDevelop.Projects;
+using MonoDevelop.Core;
 using MonoDevelop.Core.Gui;
 
 namespace MonoDevelop.Projects.Gui.Completion
@@ -13,7 +14,13 @@
                ICompletionData[] completionData;
                DeclarationViewWindow declarationviewwindow = new 
DeclarationViewWindow ();
                ICompletionData currentData;
+               ICompletionDataProvider provider;
+               IMutableCompletionDataProvider mutableProvider;
+               Widget parsingMessage;
+               char firstChar;
+               
                const int declarationWindowMargin = 3;
+               
                static DataComparer dataComparer = new DataComparer ();
                
                class DataComparer: IComparer
@@ -51,7 +58,7 @@
                                
                                wnd.PartialWord = text; 
                                //if there is only one matching result we take 
it by default
-                               if (wnd.IsUniqueMatch)
+                               if (wnd.IsUniqueMatch && !wnd.IsChanging)
                                {       
                                        wnd.UpdateWord ();
                                        wnd.Hide ();
@@ -64,15 +71,40 @@
                
                bool ShowListWindow (char firstChar, ICompletionDataProvider 
provider, ICompletionWidget completionWidget)
                {
+                       if (mutableProvider != null) {
+                               mutableProvider.CompletionDataChanging -= 
OnCompletionDataChanging;
+                               mutableProvider.CompletionDataChanged -= 
OnCompletionDataChanged;
+                       }
+                       
+                       this.provider = provider;
+                       mutableProvider = provider as 
IMutableCompletionDataProvider;
+                       
+                       if (mutableProvider != null) {
+                               mutableProvider.CompletionDataChanging += 
OnCompletionDataChanging;
+                               mutableProvider.CompletionDataChanged += 
OnCompletionDataChanged;
+                       
+                               if (mutableProvider.IsChanging)
+                                       OnCompletionDataChanging (null, null);
+                       }
+                       
                        this.completionWidget = completionWidget;
-                       
+                       this.firstChar = firstChar;
+
+                       return FillList ();
+               }
+               
+               bool FillList ()
+               {
                        completionData = provider.GenerateCompletionData 
(completionWidget, firstChar);
-
-                       if (completionData == null || completionData.Length == 
0) return false;
+                       if ((completionData == null || completionData.Length == 
0) && !IsChanging)
+                               return false;
                        
                        this.Style = completionWidget.GtkStyle;
                        
-                       Array.Sort (completionData, dataComparer);
+                       if (completionData == null)
+                               completionData = new ICompletionData [0];
+                       else
+                               Array.Sort (completionData, dataComparer);
                        
                        DataProvider = this;
 
@@ -254,5 +286,33 @@
                {
                        return RenderIcon (completionData[n].Image, 
Gtk.IconSize.Menu, "");
                }
+               
+               internal bool IsChanging {
+                       get { return mutableProvider != null && 
mutableProvider.IsChanging; }
+               }
+               
+               void OnCompletionDataChanging (object s, EventArgs args)
+               {
+                       if (parsingMessage == null) {
+                               VBox box = new VBox ();
+                               box.PackStart (new Gtk.HSeparator (), false, 
false, 0);
+                               HBox hbox = new HBox ();
+                               hbox.BorderWidth = 3;
+                               hbox.PackStart (new Gtk.Image 
(Gtk.Stock.DialogInfo, Gtk.IconSize.Menu), false, false, 0);
+                               Gtk.Label lab = new Gtk.Label 
(GettextCatalog.GetString ("Gathering class information..."));
+                               lab.Xalign = 0;
+                               hbox.PackStart (lab, true, true, 3);
+                               hbox.ShowAll ();
+                               parsingMessage = hbox;
+                       }
+                       wnd.ShowFooter (parsingMessage);
+               }
+               
+               void OnCompletionDataChanged (object s, EventArgs args)
+               {
+                       wnd.HideFooter ();
+                       Reset ();
+                       FillList ();
+               }
        }
 }

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Completion/ICompletionDataProvider.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Completion/ICompletionDataProvider.cs
  2006-07-25 11:37:47 UTC (rev 62949)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Completion/ICompletionDataProvider.cs
  2006-07-25 11:43:17 UTC (rev 62950)
@@ -15,4 +15,11 @@
        {
                ICompletionData[] GenerateCompletionData (ICompletionWidget 
widget, char charTyped);
        }
+       
+       public interface IMutableCompletionDataProvider: ICompletionDataProvider
+       {
+               bool IsChanging { get; }
+               event EventHandler CompletionDataChanging;
+               event EventHandler CompletionDataChanged;
+       }
 }

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Completion/ListWindow.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Completion/ListWindow.cs
       2006-07-25 11:37:47 UTC (rev 62949)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Completion/ListWindow.cs
       2006-07-25 11:43:17 UTC (rev 62950)
@@ -11,6 +11,8 @@
                VScrollbar scrollbar;
                ListWidget list;
                IListDataProvider provider;
+               Widget footer;
+               VBox vbox;
                
                StringBuilder word;
                int curPos;
@@ -20,8 +22,9 @@
 
                public ListWindow (): base (Gtk.WindowType.Popup)
                {
+                       vbox = new VBox ();
+                       
                        HBox box = new HBox ();
-                       
                        list = new ListWidget (this);
                        list.SelectionChanged += new EventHandler 
(OnSelectionChanged);
                        list.ScrollEvent += new ScrollEventHandler (OnScrolled);
@@ -32,7 +35,9 @@
                        scrollbar.ValueChanged += new EventHandler 
(OnScrollChanged); 
                        box.PackStart (scrollbar, false, false, 0);
                        
-                       Add (box);
+                       vbox.PackStart (box, true, true, 0);
+                       Add (vbox);
+                       
                        this.TypeHint = WindowTypeHint.Menu;
                }
                
@@ -42,6 +47,21 @@
                        Reset ();
                }
                
+               public void ShowFooter (Widget w)
+               {
+                       HideFooter ();
+                       vbox.PackStart (w, false, false, 0);
+                       footer = w;
+               }
+               
+               public void HideFooter ()
+               {
+                       if (footer != null) {
+                               vbox.Remove (footer);
+                               footer = null;
+                       }
+               }
+               
                public void Reset ()
                {
                        word = new StringBuilder ();

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Deployment/FileDeployTargetEditor.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Deployment/FileDeployTargetEditor.cs
   2006-07-25 11:37:47 UTC (rev 62949)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Deployment/FileDeployTargetEditor.cs
   2006-07-25 11:43:17 UTC (rev 62950)
@@ -25,12 +25,12 @@
                        string label;
                        Gtk.FileChooserAction action;
                        
-                       if (target is FileDeployTarget) {
+                       if (target is DirectoryDeployTarget) {
+                               label = GettextCatalog.GetString ("Deploy 
directory");
+                               action = Gtk.FileChooserAction.SelectFolder;
+                       } else {
                                label = GettextCatalog.GetString ("Deploy 
file");
                                action = Gtk.FileChooserAction.Save;
-                       } else {
-                               label = GettextCatalog.GetString ("Deploy 
directory");
-                               action = Gtk.FileChooserAction.SelectFolder;
                        }
                        
                        Gtk.Label lab = new Gtk.Label (label + ":");

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.mdp
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.mdp
    2006-07-25 11:37:47 UTC (rev 62949)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.mdp
    2006-07-25 11:43:17 UTC (rev 62950)
@@ -14,9 +14,6 @@
     </Configuration>
   </Configurations>
   <DeployTargets />
-  <DeploymentInformation strategy="File">
-    <excludeFiles />
-  </DeploymentInformation>
   <Contents>
     <File name="./Base.glade" subtype="Code" buildaction="EmbedAsResource" />
     <File name="./AssemblyInfo.cs" subtype="Code" buildaction="Compile" />
@@ -67,4 +64,7 @@
     <ProjectReference type="Gac" localcopy="True" refto="System, 
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
     <ProjectReference type="Gac" localcopy="True" refto="System.Xml, 
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
   </References>
+  <DeploymentInformation strategy="File">
+    <excludeFiles />
+  </DeploymentInformation>
 </Project>
\ No newline at end of file

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to