forked from killswitch1111/powerguivsx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPowerShellFileNode.cs
More file actions
82 lines (74 loc) · 2.88 KB
/
Copy pathPowerShellFileNode.cs
File metadata and controls
82 lines (74 loc) · 2.88 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
using System;
using System.IO;
using Microsoft.VisualStudio;
using Microsoft.VisualStudioTools.Project;
namespace PowerShellTools.Project
{
internal class PowerShellFileNode : CommonFileNode
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="PowerShellFileNode"/> class.
/// </summary>
/// <param name="root">The project node.</param>
/// <param name="e">The project element node.</param>
internal PowerShellFileNode(CommonProjectNode root, ProjectElement e)
: base(root, e)
{
}
#endregion
protected override NodeProperties CreatePropertiesObject()
{
return new PowerShellFileNodeProperties(this);
}
public override int ImageIndex
{
get
{
if (ItemNode.IsExcluded)
{
return (int)ProjectNode.ImageName.ExcludedFile;
}
else if (!File.Exists(Url))
{
return (int)ProjectNode.ImageName.MissingFile;
}
else if (IsFormSubType)
{
return (int)ProjectNode.ImageName.WindowsForm;
}
else if (this.ProjectMgr.IsCodeFile(FileName))
{
ImageListIndex index = ImageListIndex.Script;
if (FileName.EndsWith(PowerShellConstants.PSM1File, StringComparison.OrdinalIgnoreCase))
{
index = ImageListIndex.Module;
}
else if (FileName.EndsWith(PowerShellConstants.PSD1File, StringComparison.OrdinalIgnoreCase))
{
index = ImageListIndex.DataFile;
}
else if (FileName.EndsWith(PowerShellConstants.Test, StringComparison.OrdinalIgnoreCase))
{
index = ImageListIndex.Test;
}
return CommonProjectNode.ImageOffset + (int)index;
}
return base.ImageIndex;
}
}
internal override int QueryStatusOnNode(Guid guidCmdGroup, uint cmd, IntPtr pCmdText, ref QueryStatusResult result)
{
if (guidCmdGroup == VsMenus.guidStandardCommandSet97 && IsFormSubType)
{
switch ((VSConstants.VSStd97CmdID)cmd)
{
case VSConstants.VSStd97CmdID.ViewForm:
result |= QueryStatusResult.SUPPORTED | QueryStatusResult.ENABLED;
return VSConstants.S_OK;
}
}
return base.QueryStatusOnNode(guidCmdGroup, cmd, pCmdText, ref result);
}
}
}