[svn] r6738: vs-plugin/trunk/Nemerle.VsIntegration: Nemerle.VsIntegration.csproj NemerleConstants.cs Nemer...

Nuald svnadmin at nemerle.org
Sat Sep 30 05:56:00 CEST 2006


Log:
Add stub (NemerleDependentFileNode) and image for further Windows Forms support.

Author: Nuald
Date: Sat Sep 30 05:54:02 2006
New Revision: 6738

Added:
   vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleDependentFileNode.cs
Modified:
   vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VsIntegration.csproj
   vs-plugin/trunk/Nemerle.VsIntegration/NemerleConstants.cs
   vs-plugin/trunk/Nemerle.VsIntegration/NemerlePackage.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleAssemblyReference.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleEditorFactory.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleFileNode.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleProjectNode.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Resources/NemerleImageList.bmp

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VsIntegration.csproj
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VsIntegration.csproj	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VsIntegration.csproj	Sat Sep 30 05:54:02 2006
@@ -130,6 +130,7 @@
     <Compile Include="NemerlePackage.cs" />
     <Compile Include="Project\NemerleAssemblyReference.cs" />
     <Compile Include="Project\NemerleAssemblyReferenceNode.cs" />
+    <Compile Include="Project\NemerleDependentFileNode.cs" />
     <Compile Include="Project\NemerleOAFileItem.cs" />
     <Compile Include="Project\HierarchyEventArgs.cs" />
     <Compile Include="Project\INemerleLibraryManager.cs" />

Modified: vs-plugin/trunk/Nemerle.VsIntegration/NemerleConstants.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/NemerleConstants.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/NemerleConstants.cs	Sat Sep 30 05:54:02 2006
@@ -48,6 +48,7 @@
 		{
 			NemerleSource  = 0,
 			NemerleProject = 1,
+			NemerleForm = 2
 		}
 	}
 }

Modified: vs-plugin/trunk/Nemerle.VsIntegration/NemerlePackage.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/NemerlePackage.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/NemerlePackage.cs	Sat Sep 30 05:54:02 2006
@@ -46,8 +46,8 @@
 	[ProvideMenuResource   (1000, 1)]
 	[ProvideObject           (typeof(GeneralPropertyPage))]
 	[ProvideObject           (typeof(NemerleBuildPropertyPage))]
-	[ProvideEditorExtension  (typeof(NemerlEditorFactory), ".n", 32)]
-	[ProvideEditorLogicalView(typeof(NemerlEditorFactory), NemerleConstants.EditorLogicalViewGuidString)]
+	[ProvideEditorExtension  (typeof(NemerleEditorFactory), ".n", 32)]
+	[ProvideEditorLogicalView(typeof(NemerleEditorFactory), NemerleConstants.EditorLogicalViewGuidString)]
 	//LOGVIEWID_Designer
 	//[ProvideEditorLogicalView(typeof(NP.EditorFactory),
 	//  "{7651a701-06e5-11d1-8ebd-00a0c90f26ea}")
@@ -108,7 +108,7 @@
 			base.Initialize();
 
 			RegisterProjectFactory(new NemerleProjectFactory(this));
-			RegisterEditorFactory (new NemerlEditorFactory  (this));
+			RegisterEditorFactory (new NemerleEditorFactory  (this));
 
 			//Microsoft.VisualStudio.Shell.Interop.IVsRegisterEditors registerEditors = 
 			//  GetService(typeof(Microsoft.VisualStudio.Shell.Interop.SVsRegisterEditors))

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleAssemblyReference.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleAssemblyReference.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleAssemblyReference.cs	Sat Sep 30 05:54:02 2006
@@ -10,13 +10,26 @@
 {
 	public class NemerleAssemblyReference : Microsoft.VisualStudio.Package.Automation.OAAssemblyReference
 	{
+		string _publicKeyToken = String.Empty;
+
 		public NemerleAssemblyReference(AssemblyReferenceNode assemblyReference)
-			: base(assemblyReference) { }
+			: base(assemblyReference) 
+		{
+			byte[] token = assemblyReference.AssemblyName.GetPublicKeyToken();
+			if (token == null)
+				token = assemblyReference.ResolvedAssembly.GetPublicKeyToken();
+			if (token != null)
+			{
+				StringBuilder builder = new StringBuilder();
+				foreach (byte number in token)
+					builder.AppendFormat("{0:x2}", number);
+				_publicKeyToken = builder.ToString();
+			}
+		}
 
 		public override string PublicKeyToken
 		{
-			//VladD2: Ďî÷ĺěó íĺ ďîďűňŕňüń˙ ďîëó÷čňü ýňî äĺëî ó ńáîđęč?
-			get { return String.Empty; }
+			get { return _publicKeyToken; }
 		}
 	}
 }

Added: vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleDependentFileNode.cs
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleDependentFileNode.cs	Sat Sep 30 05:54:02 2006
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Microsoft.VisualStudio.Package;
+using Microsoft.VisualStudio.Shell;
+
+namespace Nemerle.VisualStudio.Project
+{
+	class NemerleDependentFileNode : DependentFileNode
+	{
+		#region ctor
+		/// <summary>
+		/// Constructor for the NemerleDependentFileNode
+		/// </summary>
+		/// <param name="root">Root of the hierarchy</param>
+		/// <param name="e">Associated project element</param>
+		public NemerleDependentFileNode(ProjectNode root, ProjectElement e)
+			: base(root, e) {}
+		#endregion
+
+		// Called since the FileNode.ImageIndex returns -1 by default.
+		//
+		public override object GetIconHandle(bool open)
+		{
+			if (FileName.EndsWith(NemerleConstants.FileExtension, StringComparison.InvariantCultureIgnoreCase))
+				return PackageUtilities.GetIntPointerFromImage(
+					NemerleProjectNode.NemerleImageList.Images[(int)NemerleConstants.ImageListIndex.NemerleSource]);
+
+			return base.GetIconHandle(open);
+		}
+
+
+	}
+}

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleEditorFactory.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleEditorFactory.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleEditorFactory.cs	Sat Sep 30 05:54:02 2006
@@ -14,11 +14,11 @@
 namespace Nemerle.VisualStudio.Project
 {
 	[Guid(NemerleConstants.EditorFactoryGuidString)]
-	public class NemerlEditorFactory : IVsEditorFactory
+	public class NemerleEditorFactory : IVsEditorFactory
 	{
 		#region ctors
 
-		public NemerlEditorFactory(NemerlePackage package)
+		public NemerleEditorFactory(NemerlePackage package)
 		{
 			_package = package;
 		}

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleFileNode.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleFileNode.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleFileNode.cs	Sat Sep 30 05:54:02 2006
@@ -106,8 +106,12 @@
 		public override object GetIconHandle(bool open)
 		{
 			if (FileName.EndsWith(NemerleConstants.FileExtension, StringComparison.InvariantCultureIgnoreCase))
-				return PackageUtilities.GetIntPointerFromImage(
-					NemerleProjectNode.NemerleImageList.Images[(int)NemerleConstants.ImageListIndex.NemerleSource]);
+			{
+				int imageIndex = IsFormSubType ? (int)NemerleConstants.ImageListIndex.NemerleForm :
+					(int)NemerleConstants.ImageListIndex.NemerleSource;
+				return 
+					PackageUtilities.GetIntPointerFromImage(NemerleProjectNode.NemerleImageList.Images[imageIndex]);
+			}
 
 			return base.GetIconHandle(open);
 		}

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleProjectNode.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleProjectNode.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleProjectNode.cs	Sat Sep 30 05:54:02 2006
@@ -22,7 +22,7 @@
 	public class NemerleProjectNode : ProjectNode, IVsProjectSpecificEditorMap2
 	{
 		NemerlePackage _package;
-		static ImageList _nemerleImageList = LoadProjectImajeList();
+		static ImageList _nemerleImageList = LoadProjectImageList();
 		
 		#region ctor
 
@@ -39,7 +39,7 @@
 			InitializeCATIDs();
 		}
 
-		private static ImageList LoadProjectImajeList()
+		private static ImageList LoadProjectImageList()
 		{
 			// Make the name of resource bitmap.
 			// It's bitmap used in project ImageList.
@@ -351,6 +351,30 @@
 		}
 
 		/// <summary>
+		/// Create dependent file node based on an msbuild item
+		/// </summary>
+		/// <param name="item">msbuild item</param>
+		/// <returns>dependent file node</returns>
+		public override DependentFileNode CreateDependentFileNode(ProjectElement item)
+		{
+			if (item == null)
+				throw new ArgumentNullException("item");
+
+			NemerleDependentFileNode newNode = new NemerleDependentFileNode(this, item);
+
+			string include = item.GetMetadata(ProjectFileConstants.Include);
+			newNode.OleServiceProvider.AddService(typeof(EnvDTE.Project), ProjectMgr.GetAutomationObject(), false);
+			newNode.OleServiceProvider.AddService(typeof(EnvDTE.ProjectItem), newNode.GetAutomationObject(), false);
+			newNode.OleServiceProvider.AddService(typeof(VSLangProj.VSProject), this.VSProject, false);
+
+			if (IsCodeFile(include) && item.ItemName == "Compile")
+				newNode.OleServiceProvider.AddService(typeof(SVSMDCodeDomProvider), this.CodeDomProvider, false);
+
+			return newNode;
+		}
+
+
+		/// <summary>
 		/// Creates the format list for the open file dialog
 		/// </summary>
 		/// <param name="formatlist">The formatlist to return</param>
@@ -522,7 +546,7 @@
 			// Nemerle only makes usage of one Editor Factory and therefore 
 			// we will return that guid.
 			//
-			guidEditorType = NemerlEditorFactory.EditorFactoryGuid;
+			guidEditorType = NemerleEditorFactory.EditorFactoryGuid;
 			return VSConstants.S_OK;
 		}
 

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Resources/NemerleImageList.bmp
==============================================================================
Binary files. No diff available.



More information about the svn mailing list