[Monodevelop-patches-list] r2203 - in trunk/MonoDevelop/Core/src/MonoDevelop.Base: . Gui/Components Gui/Pads Internal/Codons Internal/Conditions Internal/ProgressMonitoring Internal/Project/Combine Internal/Project/Project Services/MenuService Services/ParserService Services/Project
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Mon Jan 31 14:35:45 EST 2005
Author: lluis
Date: 2005-01-31 14:35:45 -0500 (Mon, 31 Jan 2005)
New Revision: 2203
Added:
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/FileFormatCodon.cs
Modified:
trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Components/SdMenuCommand.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Components/SdMenuSeparator.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/DefaultMonitorPad.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/OpenTaskView.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Conditions/ProjectActiveCondition.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/LogTextWriter.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/Project.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/ProjectFile.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Makefile.am
trunk/MonoDevelop/Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/MenuService/MenuService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ParserService/CodeCompletionDatabase.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ParserService/DefaultParserService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ParserService/ProjectCodeCompletionDatabase.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/DefaultProjectService.cs
Log:
2005-01-31 Lluis Sanchez Gual <lluis at novell.com>
* Services/Project/DefaultProjectService.cs: In BuildActiveCombine(),
show the output window even if compilation is not needed.
Register file formats defined in the configuration file.
* Services/ParserService/CodeCompletionDatabase.cs:
* Services/ParserService/ProjectCodeCompletionDatabase.cs: Use project
events to detect when project files are modified/added/removed.
* Services/ParserService/DefaultParserService.cs: Remove subscription
to projectService.FileAddedToProject. This is now handled in the
ProjectCodeCompletionDatabase.
* Gui/Components/SdMenuSeparator.cs: Separators are visible by default.
* Gui/Components/SdMenuCommand.cs: If the command is not visible,
avoid the ShowAll() call at the end.
* Services/MenuService/MenuService.cs: Don't use ShowAll() to show
the menu since it will also show hidden menu items.
* Gui/Pads/OpenTaskView.cs: The Description, Path and File columns
are now resizable.
* Gui/Pads/DefaultMonitorPad.cs: Only reposition the cursor when a line
of text is complete.
* Makefile.am: Added new file format codon.
* Internal/Project/Project/ProjectFile.cs: Removed the
FileSystemWatcher from ProjectFile. File changes are now detected at
project level. This saves lots of resources for big projects.
* Internal/Project/Project/Project.cs: Properly detect when a project
needs to be built.
* Internal/Project/Combine/CombineEntry.cs:
* Internal/Project/Combine/Combine.cs: Removed GetOutputFileName()
method. It does not make sense in Combine.
* Internal/ProgressMonitoring/LogTextWriter.cs: Added method for
chaining several text writers.
* MonoDevelopCore.addin.xml: Defined extension path for custom
file formats.
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-01-31 19:26:19 UTC (rev 2202)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-01-31 19:35:45 UTC (rev 2203)
@@ -1,3 +1,47 @@
+2005-01-31 Lluis Sanchez Gual <lluis at novell.com>
+
+ * Services/Project/DefaultProjectService.cs: In BuildActiveCombine(),
+ show the output window even if compilation is not needed.
+ Register file formats defined in the configuration file.
+
+ * Services/ParserService/CodeCompletionDatabase.cs:
+ * Services/ParserService/ProjectCodeCompletionDatabase.cs: Use project
+ events to detect when project files are modified/added/removed.
+ * Services/ParserService/DefaultParserService.cs: Remove subscription
+ to projectService.FileAddedToProject. This is now handled in the
+ ProjectCodeCompletionDatabase.
+
+ * Gui/Components/SdMenuSeparator.cs: Separators are visible by default.
+ * Gui/Components/SdMenuCommand.cs: If the command is not visible,
+ avoid the ShowAll() call at the end.
+ * Services/MenuService/MenuService.cs: Don't use ShowAll() to show
+ the menu since it will also show hidden menu items.
+
+ * Gui/Pads/OpenTaskView.cs: The Description, Path and File columns
+ are now resizable.
+
+ * Gui/Pads/DefaultMonitorPad.cs: Only reposition the cursor when a line
+ of text is complete.
+
+ * Makefile.am: Added new file format codon.
+
+ * Internal/Project/Project/ProjectFile.cs: Removed the
+ FileSystemWatcher from ProjectFile. File changes are now detected at
+ project level. This saves lots of resources for big projects.
+
+ * Internal/Project/Project/Project.cs: Properly detect when a project
+ needs to be built.
+
+ * Internal/Project/Combine/CombineEntry.cs:
+ * Internal/Project/Combine/Combine.cs: Removed GetOutputFileName()
+ method. It does not make sense in Combine.
+
+ * Internal/ProgressMonitoring/LogTextWriter.cs: Added method for
+ chaining several text writers.
+
+ * MonoDevelopCore.addin.xml: Defined extension path for custom
+ file formats.
+
2005-01-31 John Luke <john.luke at gmail.com>
* Gui/Components/SdToolbarCommand.cs:
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Components/SdMenuCommand.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Components/SdMenuCommand.cs 2005-01-31 19:26:19 UTC (rev 2202)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Components/SdMenuCommand.cs 2005-01-31 19:35:45 UTC (rev 2203)
@@ -133,6 +133,7 @@
ConditionFailedAction failedAction = conditionCollection.GetCurrentConditionFailedAction(caller);
this.Sensitive = failedAction != ConditionFailedAction.Disable;
this.Visible = failedAction != ConditionFailedAction.Exclude;
+ if (!this.Visible) return;
}
if (menuCommand != null && menuCommand is IMenuCommand) {
Sensitive = ((IMenuCommand)menuCommand).IsEnabled;
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Components/SdMenuSeparator.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Components/SdMenuSeparator.cs 2005-01-31 19:26:19 UTC (rev 2202)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Components/SdMenuSeparator.cs 2005-01-31 19:35:45 UTC (rev 2203)
@@ -23,12 +23,14 @@
public SdMenuSeparator()
{
+ ShowAll ();
}
public SdMenuSeparator(ConditionCollection conditionCollection, object caller)
{
this.caller = caller;
this.conditionCollection = conditionCollection;
+ ShowAll ();
}
public virtual void UpdateStatus()
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/DefaultMonitorPad.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/DefaultMonitorPad.cs 2005-01-31 19:26:19 UTC (rev 2202)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/DefaultMonitorPad.cs 2005-01-31 19:35:45 UTC (rev 2203)
@@ -87,7 +87,8 @@
{
AddText (text);
// buffer.MoveMark (buffer.InsertMark, buffer.EndIter);
- textEditorControl.ScrollMarkOnscreen (buffer.InsertMark);
+ if (text.EndsWith ("\n"))
+ textEditorControl.ScrollMarkOnscreen (buffer.InsertMark);
}
public Gtk.Widget Control {
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/OpenTaskView.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/OpenTaskView.cs 2005-01-31 19:26:19 UTC (rev 2202)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/OpenTaskView.cs 2005-01-31 19:35:45 UTC (rev 2203)
@@ -144,12 +144,16 @@
Gtk.CellRendererText line = new Gtk.CellRendererText (), desc = new Gtk.CellRendererText () , path = new Gtk.CellRendererText (),
file = new Gtk.CellRendererText ();
+ TreeViewColumn col;
view.AppendColumn ("!" , iconRender , "pixbuf", COL_TYPE);
view.AppendColumn ("" , toggleRender , "active" , COL_MARKED, "activatable", COL_READ);
view.AppendColumn (GettextCatalog.GetString ("Line") , line , "text" , COL_LINE, "weight", COL_READ_WEIGHT);
- view.AppendColumn (GettextCatalog.GetString ("Description") , desc , "text" , COL_DESC, "weight", COL_READ_WEIGHT, "strikethrough", COL_MARKED);
- view.AppendColumn (GettextCatalog.GetString ("Path") , path , "text" , COL_PATH, "weight", COL_READ_WEIGHT);
- view.AppendColumn (GettextCatalog.GetString ("File") , file , "text" , COL_FILE, "weight", COL_READ_WEIGHT);
+ col = view.AppendColumn (GettextCatalog.GetString ("Description") , desc , "text" , COL_DESC, "weight", COL_READ_WEIGHT, "strikethrough", COL_MARKED);
+ col.Resizable = true;
+ col = view.AppendColumn (GettextCatalog.GetString ("Path") , path , "text" , COL_PATH, "weight", COL_READ_WEIGHT);
+ col.Resizable = true;
+ col = view.AppendColumn (GettextCatalog.GetString ("File") , file , "text" , COL_FILE, "weight", COL_READ_WEIGHT);
+ col.Resizable = true;
}
void OnCombineOpen(object sender, CombineEventArgs e)
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/FileFormatCodon.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/FileFormatCodon.cs 2005-01-31 19:26:19 UTC (rev 2202)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/FileFormatCodon.cs 2005-01-31 19:35:45 UTC (rev 2203)
@@ -0,0 +1,55 @@
+//
+// FileFormatCodon.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+
+using System;
+using System.Collections;
+
+using MonoDevelop.Core.AddIns.Conditions;
+using MonoDevelop.Internal.Project;
+
+namespace MonoDevelop.Core.AddIns.Codons
+{
+ [CodonNameAttribute ("FileFormat")]
+ public class FileFormatCodon : AbstractCodon
+ {
+ IFileFormat fileFormat;
+
+ public IFileFormat FileFormat {
+ get { return fileFormat; }
+ }
+
+ public override object BuildItem (object owner, ArrayList subItems, ConditionCollection conditions)
+ {
+ fileFormat = (IFileFormat) AddIn.CreateObject (Class);
+ return this;
+ }
+ }
+}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Conditions/ProjectActiveCondition.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Conditions/ProjectActiveCondition.cs 2005-01-31 19:26:19 UTC (rev 2202)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Conditions/ProjectActiveCondition.cs 2005-01-31 19:35:45 UTC (rev 2203)
@@ -37,7 +37,6 @@
public override bool IsValid(object owner)
{
Project project = Runtime.ProjectService.CurrentSelectedProject;
-
if (activeproject == "*") {
return project != null;
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/LogTextWriter.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/LogTextWriter.cs 2005-01-31 19:26:19 UTC (rev 2202)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/LogTextWriter.cs 2005-01-31 19:35:45 UTC (rev 2203)
@@ -30,13 +30,31 @@
using System;
using System.IO;
using System.Text;
+using System.Collections;
namespace MonoDevelop.Services
{
public delegate void LogTextEventHandler (string writtenText);
- internal class LogTextWriter: TextWriter
+ public class LogTextWriter: TextWriter
{
+ ArrayList chainedWriters;
+
+ public void ChainWriter (TextWriter writer)
+ {
+ if (chainedWriters == null) chainedWriters = new ArrayList ();
+ chainedWriters.Add (writer);
+ }
+
+ public void UnchainWriter (TextWriter writer)
+ {
+ if (chainedWriters != null) {
+ chainedWriters.Remove (writer);
+ if (chainedWriters.Count == 0)
+ chainedWriters = null;
+ }
+ }
+
public override Encoding Encoding {
get { return Encoding.Default; }
}
@@ -51,12 +69,18 @@
{
if (TextWritten != null)
TextWritten (value.ToString ());
+ if (chainedWriters != null)
+ foreach (TextWriter cw in chainedWriters)
+ cw.Write (value);
}
public override void Write (string value)
{
if (TextWritten != null)
TextWritten (value);
+ if (chainedWriters != null)
+ foreach (TextWriter cw in chainedWriters)
+ cw.Write (value);
}
public event LogTextEventHandler TextWritten;
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs 2005-01-31 19:26:19 UTC (rev 2202)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs 2005-01-31 19:35:45 UTC (rev 2203)
@@ -401,11 +401,6 @@
}
}
- public override string GetOutputFileName ()
- {
- return String.Empty;
- }
-
public void GenerateMakefiles ()
{
GenerateMakefiles (null);
@@ -476,7 +471,7 @@
stream.WriteLine ("\t at echo `run'ning multiple startup projects is not yet support");
} else {
if (SingleStartProjectName != null && Entries [SingleStartProjectName] != null)
- stream.WriteLine ("\tcd $(OUTPUTDIR) && $(RUNTIME) {0}", Entries [SingleStartProjectName].GetOutputFileName ());
+ stream.WriteLine ("\tcd $(OUTPUTDIR) && $(RUNTIME) {0}", ((Project)Entries [SingleStartProjectName]).GetOutputFileName ());
else
stream.WriteLine ("\t at echo No startup project defined");
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs 2005-01-31 19:26:19 UTC (rev 2202)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs 2005-01-31 19:35:45 UTC (rev 2203)
@@ -186,7 +186,6 @@
public abstract ICompilerResult Build (IProgressMonitor monitor);
public abstract void Execute (IProgressMonitor monitor);
public abstract void Debug (IProgressMonitor monitor);
- public abstract string GetOutputFileName ();
public abstract bool NeedsBuilding { get; set; }
public virtual void GenerateMakefiles (Combine parentCombine)
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/Project.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/Project.cs 2005-01-31 19:26:19 UTC (rev 2202)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/Project.cs 2005-01-31 19:35:45 UTC (rev 2203)
@@ -60,12 +60,18 @@
[ItemProperty ("DeploymentInformation")]
protected DeployInformation deployInformation = new DeployInformation();
- bool isDirty = true;
+ bool isDirty = false;
+ bool filesChecked;
+ private FileSystemWatcher projectFileWatcher;
+
public Project ()
{
Name = "New Project";
projectReferences.SetProject (this);
+
+ projectFileWatcher = new FileSystemWatcher();
+ projectFileWatcher.Changed += new FileSystemEventHandler (OnFileChanged);
}
[LocalizedProperty("${res:MonoDevelop.Internal.Project.ProjectClass.Description}",
@@ -135,13 +141,17 @@
public bool IsFileInProject(string filename)
{
- if (filename == null) return false;
+ return GetProjectFile (filename) != null;
+ }
+
+ public ProjectFile GetProjectFile (string fileName)
+ {
+ if (fileName == null) return null;
foreach (ProjectFile file in ProjectFiles) {
- if (file.Name == filename) {
- return true;
- }
+ if (file.Name == fileName)
+ return file;
}
- return false;
+ return null;
}
public virtual bool IsCompileable (string fileName)
@@ -263,6 +273,7 @@
public override void Dispose()
{
base.Dispose ();
+ projectFileWatcher.Dispose ();
foreach (ProjectFile file in ProjectFiles) {
file.Dispose ();
}
@@ -299,11 +310,14 @@
public override void Clean ()
{
isDirty = true;
+ string file = GetOutputFileName ();
+ if (file != null && File.Exists (file))
+ File.Delete (file);
}
public override ICompilerResult Build (IProgressMonitor monitor)
{
- if (!isDirty) return new DefaultCompilerResult (new CompilerResults (null), "");
+ if (!NeedsBuilding) return new DefaultCompilerResult (new CompilerResults (null), "");
try {
monitor.BeginTask (String.Format (GettextCatalog.GetString ("Building Project: {0} Configuration: {1}"), Name, ActiveConfiguration.Name), 3);
@@ -400,20 +414,82 @@
}
}
-
protected virtual void DoExecute (IProgressMonitor monitor)
{
}
+ public virtual string GetOutputFileName ()
+ {
+ return null;
+ }
+
public override bool NeedsBuilding {
get {
+ if (!isDirty) CheckNeedsBuild ();
return isDirty;
}
set {
isDirty = value;
}
}
+
+ public override string FileName {
+ get {
+ return base.FileName;
+ }
+ set {
+ base.FileName = value;
+ if (value != null)
+ UpdateFileWatch ();
+ }
+ }
+
+ protected virtual void CheckNeedsBuild ()
+ {
+ DateTime tim = GetLastBuildTime ();
+ if (tim == DateTime.MinValue) {
+ isDirty = true;
+ return;
+ }
+
+ if (filesChecked) return;
+
+ foreach (ProjectFile file in ProjectFiles) {
+ if (file.BuildAction == BuildAction.Exclude) continue;
+ FileInfo finfo = new FileInfo (file.FilePath);
+ if (finfo.Exists && finfo.LastWriteTime > tim) {
+ isDirty = true;
+ return;
+ }
+ }
+ filesChecked = true;
+ }
+
+ protected virtual DateTime GetLastBuildTime ()
+ {
+ string file = GetOutputFileName ();
+ FileInfo finfo = new FileInfo (file);
+ if (!finfo.Exists) return DateTime.MinValue;
+ else return finfo.LastWriteTime;
+ }
+
+ private void UpdateFileWatch()
+ {
+ projectFileWatcher.EnableRaisingEvents = false;
+ projectFileWatcher.Path = BaseDirectory;
+ projectFileWatcher.EnableRaisingEvents = true;
+ }
+
+ void OnFileChanged (object source, FileSystemEventArgs e)
+ {
+ ProjectFile file = GetProjectFile (e.FullPath);
+ if (file != null) {
+ isDirty = true;
+ NotifyFileChangedInProject (file);
+ }
+ }
+
internal void NotifyFileChangedInProject (ProjectFile file)
{
OnFileChangedInProject (new ProjectFileEventArgs (this, file));
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/ProjectFile.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/ProjectFile.cs 2005-01-31 19:26:19 UTC (rev 2202)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/ProjectFile.cs 2005-01-31 19:35:45 UTC (rev 2203)
@@ -56,11 +56,8 @@
Project project;
- private FileSystemWatcher ProjectFileWatcher;
-
public ProjectFile()
{
- AddFileWatch();
}
public ProjectFile(string filename)
@@ -68,7 +65,6 @@
this.filename = filename;
subtype = Subtype.Code;
buildaction = BuildAction.Compile;
- AddFileWatch();
}
public ProjectFile(string filename, BuildAction buildAction)
@@ -76,47 +72,11 @@
this.filename = filename;
subtype = Subtype.Code;
buildaction = buildAction;
- AddFileWatch();
}
- private void AddFileWatch()
- {
- ProjectFileWatcher = new FileSystemWatcher();
-
- ProjectFileWatcher.Changed += new FileSystemEventHandler(OnChanged);
-
- if (this.filename != null)
- UpdateFileWatch();
-
- }
-
- private void UpdateFileWatch()
- {
-
- if ((this.filename == null) || (this.filename.Length == 0))
- return;
-
- try {
- ProjectFileWatcher.EnableRaisingEvents = false;
- ProjectFileWatcher.Path = Path.GetDirectoryName(filename);
- ProjectFileWatcher.Filter = Path.GetFileName(filename);
- ProjectFileWatcher.EnableRaisingEvents = true;
- } catch {
- Console.WriteLine ("NOT WATCHING " + filename);
- }
-
- }
-
- private void OnChanged(object source, FileSystemEventArgs e)
- {
- if (project != null)
- project.NotifyFileChangedInProject(this);
- }
-
internal void SetProject (Project prj)
{
project = prj;
- UpdateFileWatch();
}
[LocalizedProperty("${res:MonoDevelop.Internal.Project.ProjectFile.Name}",
@@ -130,7 +90,6 @@
Debug.Assert (value != null && value.Length > 0, "name == null || name.Length == 0");
if (project != null) project.NotifyFileRemovedFromProject (this);
filename = value;
- UpdateFileWatch();
if (project != null) project.NotifyFileAddedToProject (this);
}
}
@@ -198,7 +157,6 @@
public virtual void Dispose ()
{
- ProjectFileWatcher.Dispose ();
}
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Makefile.am
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Makefile.am 2005-01-31 19:26:19 UTC (rev 2202)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Makefile.am 2005-01-31 19:35:45 UTC (rev 2203)
@@ -266,6 +266,7 @@
Internal/Codons/IDialogPanel.cs \
Internal/Codons/DialogPanelCodon.cs \
Internal/Codons/IDialogPanelDescriptor.cs \
+Internal/Codons/FileFormatCodon.cs \
Internal/Codons/MenuItems/AbstractCheckableMenuCommand.cs \
Internal/Codons/MenuItems/ISubmenuBuilder.cs \
Internal/Codons/MenuItems/IMenuCommand.cs \
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml 2005-01-31 19:26:19 UTC (rev 2202)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml 2005-01-31 19:35:45 UTC (rev 2203)
@@ -69,6 +69,9 @@
class = "MonoDevelop.Internal.Project.DotNetProjectBinding" />
</Extension>
+ <Extension path = "/SharpDevelop/Workbench/ProjectFileFormats">
+ </Extension>
+
<Extension path = "/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id = "Browser"
supportedformats = "Web Pages"
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/MenuService/MenuService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/MenuService/MenuService.cs 2005-01-31 19:26:19 UTC (rev 2202)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/MenuService/MenuService.cs 2005-01-31 19:35:45 UTC (rev 2203)
@@ -52,7 +52,7 @@
//contextMenu.Items.AddRange(submenuBuilder.BuildSubmenu(null, owner));
}
}
- contextMenu.ShowAll();
+ contextMenu.Show();
return contextMenu;
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ParserService/CodeCompletionDatabase.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ParserService/CodeCompletionDatabase.cs 2005-01-31 19:26:19 UTC (rev 2202)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ParserService/CodeCompletionDatabase.cs 2005-01-31 19:35:45 UTC (rev 2203)
@@ -263,6 +263,11 @@
protected virtual void DeserializeData (Queue dataQueue)
{
}
+
+ protected FileEntry GetFile (string name)
+ {
+ return files [name] as FileEntry;
+ }
void Flush ()
{
@@ -370,7 +375,7 @@
return ce.Class;
}
- public void CheckModifiedFiles ()
+ public virtual void CheckModifiedFiles ()
{
lock (rwlock)
{
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ParserService/DefaultParserService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ParserService/DefaultParserService.cs 2005-01-31 19:26:19 UTC (rev 2202)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ParserService/DefaultParserService.cs 2005-01-31 19:35:45 UTC (rev 2203)
@@ -255,8 +255,6 @@
IProjectService projectService = Runtime.ProjectService;
projectService.CombineOpened += new CombineEventHandler(OnCombineOpened);
projectService.CombineClosed += new CombineEventHandler(OnCombineClosed);
- projectService.FileRemovedFromProject += new ProjectFileEventHandler (OnProjectFilesChanged);
- projectService.FileAddedToProject += new ProjectFileEventHandler (OnProjectFilesChanged);
projectService.ReferenceAddedToProject += new ProjectReferenceEventHandler (OnProjectReferencesChanged);
projectService.ReferenceRemovedFromProject += new ProjectReferenceEventHandler (OnProjectReferencesChanged);
}
@@ -478,12 +476,6 @@
CleanUnusedDatabases ();
}
- void OnProjectFilesChanged (object sender, ProjectFileEventArgs args)
- {
- ProjectCodeCompletionDatabase db = GetProjectDatabase (args.Project);
- if (db != null) db.UpdateFromProject ();
- }
-
void OnProjectReferencesChanged (object sender, ProjectReferenceEventArgs args)
{
ProjectCodeCompletionDatabase db = GetProjectDatabase (args.Project);
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ParserService/ProjectCodeCompletionDatabase.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ParserService/ProjectCodeCompletionDatabase.cs 2005-01-31 19:26:19 UTC (rev 2202)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ParserService/ProjectCodeCompletionDatabase.cs 2005-01-31 19:35:45 UTC (rev 2203)
@@ -39,26 +39,67 @@
internal class ProjectCodeCompletionDatabase: CodeCompletionDatabase
{
Project project;
+ bool initialFileCheck;
public ProjectCodeCompletionDatabase (Project project, DefaultParserService parserService)
: base (parserService)
{
+ initialFileCheck = true;
+
SetLocation (project.BaseDirectory, project.Name);
this.project = project;
Read ();
UpdateFromProject ();
+
+ project.FileChangedInProject += new ProjectFileEventHandler (OnFileChanged);
+ project.FileAddedToProject += new ProjectFileEventHandler (OnFileAdded);
+ project.FileRemovedFromProject += new ProjectFileEventHandler (OnFileRemoved);
}
+ public override void Dispose ()
+ {
+ project.FileChangedInProject -= new ProjectFileEventHandler (OnFileChanged);
+ project.FileAddedToProject -= new ProjectFileEventHandler (OnFileAdded);
+ project.FileRemovedFromProject -= new ProjectFileEventHandler (OnFileRemoved);
+ }
+
+ public override void CheckModifiedFiles ()
+ {
+ // Once the first modification check is done, change detection
+ // is done through project events
+
+ if (initialFileCheck) {
+ base.CheckModifiedFiles ();
+ initialFileCheck = false;
+ }
+ }
+
+ void OnFileChanged (object sender, ProjectFileEventArgs args)
+ {
+ FileEntry file = GetFile (args.ProjectFile.Name);
+ if (file != null) QueueParseJob (file);
+ }
+
+ void OnFileAdded (object sender, ProjectFileEventArgs args)
+ {
+ if (args.ProjectFile.BuildAction == BuildAction.Compile)
+ AddFile (args.ProjectFile.Name);
+ }
+
+ void OnFileRemoved (object sender, ProjectFileEventArgs args)
+ {
+ RemoveFile (args.ProjectFile.Name);
+ }
+
public void UpdateFromProject ()
{
Hashtable fs = new Hashtable ();
foreach (ProjectFile file in project.ProjectFiles)
{
if (file.BuildAction != BuildAction.Compile) continue;
- FileEntry fe = files[file.Name] as FileEntry;
- if (fe == null) AddFile (file.Name);
+ if (GetFile (file.Name) == null) AddFile (file.Name);
fs [file.Name] = null;
}
@@ -73,12 +114,7 @@
fs.Clear ();
foreach (ProjectReference pr in project.ProjectReferences)
{
- string refId = pr.ReferenceType == ReferenceType.Project ? "Project" : "Assembly";
- refId += ":" + pr.Reference;
-
- if (pr.ReferenceType == ReferenceType.Gac && refId.ToLower().EndsWith (".dll"))
- refId = refId.Substring (0, refId.Length - 4);
-
+ string refId = GetReferenceKey (pr);
fs[refId] = null;
if (!HasReference (refId))
AddReference (refId);
@@ -93,6 +129,16 @@
}
}
+ string GetReferenceKey (ProjectReference pr)
+ {
+ string refId = pr.ReferenceType == ReferenceType.Project ? "Project" : "Assembly";
+ refId += ":" + pr.Reference;
+
+ if (pr.ReferenceType == ReferenceType.Gac && refId.ToLower().EndsWith (".dll"))
+ refId = refId.Substring (0, refId.Length - 4);
+ return refId;
+ }
+
protected override void ParseFile (string fileName, IProgressMonitor monitor)
{
if (monitor != null) monitor.BeginTask ("Parsing file: " + Path.GetFileName (fileName), 1);
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/DefaultProjectService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/DefaultProjectService.cs 2005-01-31 19:26:19 UTC (rev 2202)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/DefaultProjectService.cs 2005-01-31 19:35:45 UTC (rev 2203)
@@ -377,7 +377,7 @@
public IAsyncOperation BuildActiveCombine ()
{
- if (openCombine == null || !openCombine.NeedsBuilding) return NullAsyncOperation.Success;
+ if (openCombine == null) return NullAsyncOperation.Success;
if (currentBuildOperation != null && !currentBuildOperation.IsCompleted) return currentBuildOperation;
DoBeforeCompileAction();
@@ -426,10 +426,8 @@
public IAsyncOperation BuildProject (Project project)
{
- if (!project.NeedsBuilding) return NullAsyncOperation.Success;
-
BeforeCompile (project);
- IProgressMonitor monitor = new NullProgressMonitor ();
+ IProgressMonitor monitor = Runtime.TaskService.GetBuildProgressMonitor ();
Runtime.DispatchService.ThreadDispatch (new StatefulMessageHandler (BuildProjectAsync), new object[] {project, monitor});
return monitor.AsyncOperation;
}
@@ -633,6 +631,10 @@
formatManager.RegisterFileFormat (defaultProjectFormat);
formatManager.RegisterFileFormat (defaultCombineFormat);
+ FileFormatCodon[] formatCodons = (FileFormatCodon[])(AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Workbench/ProjectFileFormats").BuildChildItems(null)).ToArray(typeof(FileFormatCodon));
+ foreach (FileFormatCodon codon in formatCodons)
+ formatManager.RegisterFileFormat (codon.FileFormat);
+
DataContext.IncludeType (typeof(Combine));
DataContext.IncludeType (typeof(Project));
DataContext.IncludeType (typeof(DotNetProject));
More information about the Monodevelop-patches-list
mailing list