Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez Gual <lluis@xamarin.com>2015-04-22 22:00:36 +0300
committerLluis Sanchez Gual <lluis@xamarin.com>2015-04-22 22:00:36 +0300
commitc47bd9005efca0a0ed3362250f541f8aaabac4ba (patch)
tree4993dbd39bebebd433e2e0bd5b1a74645c44e935 /main/src/core/MonoDevelop.Core/MonoDevelop.Projects/WorkspaceObject.cs
parenta4443477006772ca7399e6beb25540c09a0fb1c6 (diff)
[Core] Project model fixes
Don't automatically mark projects and solutions as shared after loading or creating. Instead, SetShared() has to be called explicitly. The Ide calls SetShared() on solutions opened in the workspace, so the result is more or less the same. Also added support for programatically attaching/detaching custom extensions on projects and solutions.
Diffstat (limited to 'main/src/core/MonoDevelop.Core/MonoDevelop.Projects/WorkspaceObject.cs')
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/WorkspaceObject.cs32
1 files changed, 31 insertions, 1 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/WorkspaceObject.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/WorkspaceObject.cs
index 2060a57b8d..53a974ac55 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/WorkspaceObject.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/WorkspaceObject.cs
@@ -78,7 +78,24 @@ namespace MonoDevelop.Projects
Runtime.AssertMainThread ();
}
- protected virtual void SetShared ()
+ /// <summary>
+ /// Gets a value indicating whether this instance is shared.
+ /// </summary>
+ /// <remarks>Shared objects can only be modified in the main thread</remarks>
+ public bool IsShared {
+ get { return isShared; }
+ }
+
+ /// <summary>
+ /// Sets this object as shared, which means that it is accessible from several threads for reading,
+ /// but it can only be modified in the main thread
+ /// </summary>
+ public void SetShared ()
+ {
+ OnSetShared ();
+ }
+
+ protected virtual void OnSetShared ()
{
isShared = true;
ItemExtension.NotifyShared ();
@@ -267,6 +284,19 @@ namespace MonoDevelop.Projects
}
}
+ public void AttachExtension (WorkspaceObjectExtension ext)
+ {
+ AssertMainThread ();
+ ExtensionChain.AddExtension (ext);
+ ext.Init (this);
+ }
+
+ public void DetachExtension (WorkspaceObjectExtension ext)
+ {
+ AssertMainThread ();
+ ExtensionChain.RemoveExtension (ext);
+ }
+
void InitializeExtensionChain ()
{
// Create an initial empty extension chain. This avoid crashes in case a call to SupportsObject ends