OLD | NEW |
| (Empty) |
1 using System; | |
2 using System.Collections.Generic; | |
3 using System.Linq; | |
4 using System.Text; | |
5 using Microsoft.VisualStudio.Project; | |
6 using GuidAttribute=System.Runtime.InteropServices.GuidAttribute; | |
7 using System.Drawing; | |
8 using System.Windows.Forms; | |
9 | |
10 namespace Google.NaClVsx.ProjectSupport | |
11 { | |
12 [Guid("71BA2B25-4F44-4D94-91E9-7DC5FCF793AA")] | |
13 class NaClProjectNode : ProjectNode | |
14 { | |
15 private static ImageList imageList; | |
16 internal static int imageIndex; | |
17 | |
18 public override int ImageIndex | |
19 { | |
20 get { return imageIndex + 0; } | |
21 } | |
22 | |
23 public NaClProjectNode() { | |
24 imageList = | |
25 Utilities.GetImageList( | |
26 typeof(NaClProjectNode).Assembly.GetManifestResourceStream( | |
27 "Google.NaClProject.Templates.ProjectItems.NaClClass.NaClIcon.ic
o")); | |
28 | |
29 } | |
30 | |
31 public NaClProjectNode(NaClPackage package) { | |
32 imageIndex = this.ImageHandler.ImageList.Images.Count; | |
33 foreach (Image img in imageList.Images) | |
34 { | |
35 this.ImageHandler.AddImage(img); | |
36 } | |
37 } | |
38 | |
39 #region Overrides of ProjectNode | |
40 | |
41 /// <summary> | |
42 /// This Guid must match the Guid you registered under | |
43 /// HKLM\Software\Microsoft\VisualStudio\%version%\Projects. | |
44 /// Among other things, the Project framework uses this | |
45 /// guid to find your project and item templates. | |
46 /// </summary> | |
47 public override Guid ProjectGuid { | |
48 get { return typeof (NaClProjectFactory).GUID; } | |
49 } | |
50 | |
51 /// <summary> | |
52 /// Returns a caption for VSHPROPID_TypeName. | |
53 /// </summary> | |
54 /// <returns></returns> | |
55 public override string ProjectType { | |
56 get { return "NaCl Project"; } | |
57 } | |
58 | |
59 protected override ConfigProvider CreateConfigProvider() | |
60 { | |
61 return new NaClConfigProvider(this); | |
62 } | |
63 | |
64 public override MSBuildResult Build(uint vsopts, string config, Microsoft.Vi
sualStudio.Shell.Interop.IVsOutputWindowPane output, string target) | |
65 { | |
66 return base.Build(vsopts, config, output, target); | |
67 } | |
68 | |
69 protected override Guid[] GetConfigurationIndependentPropertyPages() | |
70 { | |
71 var result = new Guid[] { | |
72 typeof (GeneralProperties).GUID, | |
73 typeof (DebugProperties).GUID, | |
74 }; | |
75 return result; | |
76 } | |
77 | |
78 public override void AddFileFromTemplate( | |
79 string source, string target) | |
80 { | |
81 this.FileTemplateProcessor.UntokenFile(source, target); | |
82 this.FileTemplateProcessor.Reset(); | |
83 } | |
84 | |
85 /// <summary> | |
86 /// Create a file node based on an msbuild item. | |
87 /// </summary> | |
88 /// <param name="item">msbuild item</param> | |
89 /// <returns>FileNode added</returns> | |
90 public override FileNode CreateFileNode(ProjectElement item) | |
91 { | |
92 FileNode newNode = new FileNode(this, item); | |
93 return newNode; | |
94 } | |
95 | |
96 /// <summary> | |
97 /// Create a file node based on a string. | |
98 /// </summary> | |
99 /// <param name="file">filename of the new filenode</param> | |
100 /// <returns>File node added</returns> | |
101 public override FileNode CreateFileNode(string file) | |
102 { | |
103 ProjectElement item = this.AddFileToMsBuild(file); | |
104 FileNode newNode = this.CreateFileNode(item); | |
105 if (file.EndsWith(".cc") || file.EndsWith(".cpp") || | |
106 file.EndsWith(".c")) { | |
107 // We added the file to the MsBuild (a few lines above), now change | |
108 // it's ItemName to "Compile" instead of "Content" so it gets compiled. | |
109 newNode.ItemNode.ItemName = "Compile"; | |
110 } | |
111 return newNode; | |
112 } | |
113 | |
114 #endregion | |
115 } | |
116 } | |
OLD | NEW |