forked from vsClojure/vsClojure
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClojureProjectFileNode.cs
More file actions
82 lines (71 loc) · 2.21 KB
/
Copy pathClojureProjectFileNode.cs
File metadata and controls
82 lines (71 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/***************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
This code is licensed under the Visual Studio SDK license terms.
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
***************************************************************************/
using System;
using System.Drawing;
using ClojureExtension.Project;
using Microsoft.VisualStudio.Project;
using Microsoft.VisualStudio.Project.Automation;
namespace Microsoft.ClojureExtension.Project
{
/// <summary>
/// This class extends the FileNode in order to represent a file
/// within the hierarchy.
/// </summary>
public class ClojureProjectFileNode : FileNode
{
#region Fields
private OAClojureProjectFileItem automationObject;
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="ClojureProjectFileNode"/> class.
/// </summary>
/// <param name="root">The project node.</param>
/// <param name="e">The project element node.</param>
internal ClojureProjectFileNode(ProjectNode root, ProjectElement e)
: base(root, e)
{
}
#endregion
#region Overriden implementation
/// <summary>
/// Gets the automation object for the file node.
/// </summary>
/// <returns></returns>
public override object GetAutomationObject()
{
if(automationObject == null)
{
automationObject = new OAClojureProjectFileItem(this.ProjectMgr.GetAutomationObject() as OAProject, this);
}
return automationObject;
}
public override object GetIconHandle(bool open)
{
Bitmap image = (Bitmap) ClojureProjectNode.ImageList.Images[1];
return image.GetHicon();
}
#endregion
#region Private implementation
internal OleServiceProvider.ServiceCreatorCallback ServiceCreator
{
get { return new OleServiceProvider.ServiceCreatorCallback(this.CreateServices); }
}
private object CreateServices(Type serviceType)
{
object service = null;
if(typeof(EnvDTE.ProjectItem) == serviceType)
{
service = GetAutomationObject();
}
return service;
}
#endregion
}
}