Skip to content

Commit db0b33f

Browse files
committed
Fixed error message and added settings shortcut
1 parent c6e2660 commit db0b33f

9 files changed

+42
-6
lines changed

src/Commands/OpenSettingsCommand.cs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using GitHubActionsVS.ToolWindows;
2+
3+
namespace GitHubActionsVS;
4+
5+
[Command(PackageIds.OpenSettingsCommand)]
6+
internal sealed class OpenSettingsCommand : BaseCommand<OpenSettingsCommand>
7+
{
8+
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
9+
{
10+
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
11+
ThreadHelper.JoinableTaskFactory.RunAsync(async () =>
12+
{
13+
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
14+
ToolWindowMessenger messenger = await Package.GetServiceAsync<ToolWindowMessenger, ToolWindowMessenger>();
15+
messenger.Send(new(MessageCommand.OpenSettings));
16+
}).FireAndForget();
17+
}
18+
}

src/Converters/ConclusionColorConverter.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using Newtonsoft.Json.Linq;
2-
using System.Globalization;
3-
using System.Windows;
1+
using System.Globalization;
42
using System.Windows.Data;
53
using System.Windows.Media;
64

src/GitHubActionsVS.csproj

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
</PropertyGroup>
4747
<ItemGroup>
4848
<Compile Include="Commands\GotoRepoCommand.cs" />
49+
<Compile Include="Commands\OpenSettingsCommand.cs" />
4950
<Compile Include="Commands\RefreshRepoCommand.cs" />
5051
<Compile Include="Converters\ConclusionColorConverter.cs" />
5152
<Compile Include="Converters\ConclusionIconConverter.cs" />
@@ -184,6 +185,7 @@
184185
<EmbeddedResource Include="Resources\UIStrings.resx">
185186
<Generator>PublicResXFileCodeGenerator</Generator>
186187
<LastGenOutput>UIStrings.Designer.cs</LastGenOutput>
188+
<SubType>Designer</SubType>
187189
</EmbeddedResource>
188190
</ItemGroup>
189191
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

src/Resources/UIStrings.Designer.cs

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Resources/UIStrings.resx

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@
154154
<comment>Menu for editing a secret</comment>
155155
</data>
156156
<data name="GIT_NOT_GITHUB" xml:space="preserve">
157-
<value>Repo found, but not a github.com</value>
157+
<value>Repository found, but not identified as a GitHub repo. Please open a folder that contains a GitHub repository.</value>
158158
<comment>For when the git repo is not github.com</comment>
159159
</data>
160160
<data name="HEADER_CURRENT_BRANCH" xml:space="preserve">

src/ToolWindows/GHActionsToolWindow.xaml.cs

+6
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,18 @@ private void OnMessageReceived(object sender, MessagePayload payload)
4848
{
4949
MessageCommand.Refresh => GetRepoInfoAsync(),
5050
MessageCommand.GotoRepo => GotoRepoAsync(),
51+
MessageCommand.OpenSettings => OpenSettingsAsync(),
5152

5253
_ => Task.CompletedTask
5354
});
5455
}).FireAndForget();
5556
}
5657

58+
private async Task OpenSettingsAsync()
59+
{
60+
await VS.Settings.OpenAsync(typeof(OptionsProvider.ExtensionOptionsOptions));
61+
}
62+
5763
private Task GotoRepoAsync()
5864
{
5965
if (_repoInfo is { RepoUrl.Length: > 0 })

src/ToolWindows/MessageCommand.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
public enum MessageCommand
44
{
55
GotoRepo,
6-
Refresh
6+
Refresh,
7+
OpenSettings
78
}

src/VSCommandTable.cs

+1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ internal sealed partial class PackageIds
2626
public const int TWindowToolbarGroup = 0x1050;
2727
public const int RefreshRepoCommand = 0x0111;
2828
public const int GotoRepoCommand = 0x0112;
29+
public const int OpenSettingsCommand = 0x0113;
2930
}
3031
}

src/VSCommandTable.vsct

+10
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@
6363
<LocCanonicalName>.View.GotoRepo</LocCanonicalName>
6464
</Strings>
6565
</Button>
66+
<Button guid="GitHubActionsVS" id="OpenSettingsCommand" priority="0x0003" type="Button">
67+
<Parent guid="GitHubActionsVS" id="TWindowToolbarGroup"/>
68+
<Icon guid="ImageCatalogGuid" id="Settings"/>
69+
<CommandFlag>IconIsMoniker</CommandFlag>
70+
<Strings>
71+
<ButtonText>Open Settings</ButtonText>
72+
<LocCanonicalName>.View.OpenSettings</LocCanonicalName>
73+
</Strings>
74+
</Button>
6675
</Buttons>
6776
</Commands>
6877

@@ -74,6 +83,7 @@
7483
<IDSymbol name="TWindowToolbarGroup" value="0x1050" />
7584
<IDSymbol name="RefreshRepoCommand" value="0x0111" />
7685
<IDSymbol name="GotoRepoCommand" value="0x0112" />
86+
<IDSymbol name="OpenSettingsCommand" value="0x0113" />
7787
</GuidSymbol>
7888
</Symbols>
7989
</CommandTable>

0 commit comments

Comments
 (0)