Skip to content

Commit ad194a0

Browse files
committed
Add SolidityProject type custom icon.
1 parent c530d27 commit ad194a0

7 files changed

+107
-2
lines changed
Loading
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!-- This file was generated by the AiToXaml tool.-->
2+
<!-- Tool Version: 14.0.22307.0 -->
3+
<Viewbox Width="16" Height="16" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
4+
<Rectangle Width="16" Height="16">
5+
<Rectangle.Fill>
6+
<DrawingBrush>
7+
<DrawingBrush.Drawing>
8+
<DrawingGroup>
9+
<DrawingGroup.Children>
10+
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
11+
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M0,15L16,15 16,1 0,1z" />
12+
<GeometryDrawing Brush="#FF424242" Geometry="F1M14,13L2,13 2,5 14,5z M1,14L15,14 15,2 1,2z" />
13+
<GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M14,13L2,13 2,5 14,5z" />
14+
</DrawingGroup.Children>
15+
</DrawingGroup>
16+
</DrawingBrush.Drawing>
17+
</DrawingBrush>
18+
</Rectangle.Fill>
19+
</Rectangle>
20+
</Viewbox>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ImageManifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
4+
xmlns="http://schemas.microsoft.com/VisualStudio/ImageManifestSchema/2014">
5+
<Symbols>
6+
<String Name="Resources" Value="/Stratis.VS.StratisEVM;Component/" />
7+
<Guid Name="SolidityProjectGuid" Value="293347bb-f054-408c-8ad9-cbabe93176fc" />
8+
<ID Name="ProjectIcon" Value="0" />
9+
</Symbols>
10+
<Images>
11+
<Image Guid="$(SolidityProjectGuid)" ID="$(ProjectIcon)">
12+
<Source Uri="$(Resources)/Images/SolidityProjectProjectIcon.xaml" />
13+
<Source Uri="$(Resources)/Images/SolidityProjectProjectIcon.png" >
14+
<Size Value="16" />
15+
</Source>
16+
</Image>
17+
</Images>
18+
<ImageLists />
19+
</ImageManifest>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using Microsoft.VisualStudio.Imaging.Interop;
2+
using System;
3+
4+
namespace Stratis.VS.StratisEVM
5+
{
6+
public static class SolidityProjectMonikers
7+
{
8+
private static readonly Guid ManifestGuid = new Guid("293347bb-f054-408c-8ad9-cbabe93176fc");
9+
10+
private const int ProjectIcon = 0;
11+
12+
public static ImageMoniker ProjectIconImageMoniker
13+
{
14+
get
15+
{
16+
return new ImageMoniker { Guid = ManifestGuid, Id = ProjectIcon };
17+
}
18+
}
19+
}
20+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using Microsoft.VisualStudio.Imaging;
2+
using Microsoft.VisualStudio.ProjectSystem;
3+
using System;
4+
using System.ComponentModel.Composition;
5+
6+
namespace Stratis.VS.StratisEVM
7+
{
8+
/// <summary>
9+
/// Updates nodes in the project tree by overriding property values calculated so far by lower priority providers.
10+
/// </summary>
11+
[Export(typeof(IProjectTreePropertiesProvider))]
12+
[AppliesTo(MyUnconfiguredProject.UniqueCapability)]
13+
// TODO: Consider removing the Order attribute as it typically should not be needed when creating a new project type. It may be needed when customizing an existing project type to override the default behavior (e.g. the default C# implementation).
14+
[Order(1000)]
15+
internal class SolidityProjectTreePropertiesProvider : IProjectTreePropertiesProvider
16+
{
17+
/// <summary>
18+
/// Calculates new property values for each node in the project tree.
19+
/// </summary>
20+
/// <param name="propertyContext">Context information that can be used for the calculation.</param>
21+
/// <param name="propertyValues">Values calculated so far for the current node by lower priority tree properties providers.</param>
22+
public void CalculatePropertyValues(
23+
IProjectTreeCustomizablePropertyContext propertyContext,
24+
IProjectTreeCustomizablePropertyValues propertyValues)
25+
{
26+
// Only set the icon for the root project node. We could choose to set different icons for nodes based
27+
// on various criteria, not just Capabilities, if we wished.
28+
if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot))
29+
{
30+
// TODO: Provide a moniker that represents the desired icon (you can use the "Custom Icons" item template to add a .imagemanifest to the project)
31+
propertyValues.Icon = KnownMonikers.JSProjectNode.ToProjectSystemType();
32+
}
33+
}
34+
}
35+
}

src/Stratis.VS.StratisEVM/SolidityProjectWizard.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public void RunStarted(object automationObject,
4848
Window1 window1 = new Window1();
4949
window1.ShowDialog();
5050
// Add custom parameters.
51-
replacementsDictionary.Add("$solidityconfigfile$", window1.SelectedConfigFile);
52-
replacementsDictionary.Add("$soliditycompilerversion$", window1.SelectedCompilerVersion);
51+
//replacementsDictionary.Add("$solidityconfigfile$", window1.SelectedConfigFile);
52+
//replacementsDictionary.Add("$soliditycompilerversion$", window1.SelectedCompilerVersion);
5353
// customMessage);
5454
}
5555
catch (Exception ex)

src/Stratis.VS.StratisEVM/Stratis.VS.StratisEVM.csproj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
<WarningLevel>4</WarningLevel>
4848
</PropertyGroup>
4949
<ItemGroup>
50+
<Compile Include="SolidityProjectMonikers.cs" />
51+
<Compile Include="SolidityProjectTreePropertiesProvider.cs" />
5052
<Compile Include="SolidityProjectWizard.cs" />
5153
<Compile Include="SolidityConfiguredProject.cs" />
5254
<Compile Include="SolidityUnconfiguredProject.cs" />
@@ -66,6 +68,7 @@
6668
<Compile Include="VSUtil.cs" />
6769
</ItemGroup>
6870
<ItemGroup>
71+
<Resource Include="Images\SolidityProjectProjectIcon.png" />
6972
<Content Include="LICENSE.txt">
7073
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
7174
<IncludeInVSIX>true</IncludeInVSIX>
@@ -89,6 +92,9 @@
8992
<IncludeInVSIX>true</IncludeInVSIX>
9093
</Content>
9194
<None Include="README.md" />
95+
<Content Include="SolidityProject.imagemanifest">
96+
<IncludeInVSIX>true</IncludeInVSIX>
97+
</Content>
9298
<None Include="source.extension.vsixmanifest">
9399
<SubType>Designer</SubType>
94100
</None>
@@ -97,6 +103,7 @@
97103
<Reference Include="PresentationCore" />
98104
<Reference Include="PresentationFramework" />
99105
<Reference Include="System" />
106+
<Reference Include="System.ComponentModel.Composition" />
100107
<Reference Include="System.Drawing" />
101108
<Reference Include="System.Xaml" />
102109
<Reference Include="WindowsBase" />
@@ -171,6 +178,10 @@
171178
</EmbeddedResource>
172179
</ItemGroup>
173180
<ItemGroup>
181+
<Resource Include="Images\SolidityProjectProjectIcon.xaml">
182+
<SubType>Designer</SubType>
183+
<Generator>MSBuild:Compile</Generator>
184+
</Resource>
174185
<Page Include="SolidityProjectWizardDialogWindow.xaml">
175186
<SubType>Designer</SubType>
176187
<Generator>MSBuild:Compile</Generator>

0 commit comments

Comments
 (0)