/snippets/VS2010/ProjectBase/Automation/VSProject/OAVSProjectItem.cs

http://github.com/saidai-no/nemerle · C# · 80 lines · 53 code · 11 blank · 16 comment · 0 complexity · ecb6e7966dd5d84a0d08008c2d0856ea MD5 · raw file

  1. /***************************************************************************
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. This code is licensed under the Visual Studio SDK license terms.
  4. THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
  5. ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
  6. IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
  7. PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
  8. ***************************************************************************/
  9. using System;
  10. using System.Diagnostics.CodeAnalysis;
  11. using System.Runtime.InteropServices;
  12. using EnvDTE;
  13. using VSLangProj;
  14. namespace Microsoft.VisualStudio.Project.Automation
  15. {
  16. /// <summary>
  17. /// Represents a language-specific project item
  18. /// </summary>
  19. [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "OAVS")]
  20. [ComVisible(true), CLSCompliant(false)]
  21. public class OAVSProjectItem : VSProjectItem
  22. {
  23. #region fields
  24. private FileNode fileNode;
  25. #endregion
  26. #region ctors
  27. public OAVSProjectItem(FileNode fileNode)
  28. {
  29. this.FileNode = fileNode;
  30. }
  31. #endregion
  32. #region VSProjectItem Members
  33. public virtual EnvDTE.Project ContainingProject
  34. {
  35. get { return fileNode.ProjectMgr.GetAutomationObject() as EnvDTE.Project; }
  36. }
  37. public virtual ProjectItem ProjectItem
  38. {
  39. get { return fileNode.GetAutomationObject() as ProjectItem; }
  40. }
  41. public virtual DTE DTE
  42. {
  43. get { return (DTE)this.fileNode.ProjectMgr.Site.GetService(typeof(DTE)); }
  44. }
  45. public virtual void RunCustomTool()
  46. {
  47. this.FileNode.RunGenerator();
  48. }
  49. #endregion
  50. #region public properties
  51. /// <summary>
  52. /// File Node property
  53. /// </summary>
  54. public FileNode FileNode
  55. {
  56. get
  57. {
  58. return fileNode;
  59. }
  60. set
  61. {
  62. fileNode = value;
  63. }
  64. }
  65. #endregion
  66. }
  67. }