Skip to content

Commit

Permalink
Added new feature: Indent code Alt+I
Browse files Browse the repository at this point in the history
  • Loading branch information
HichemDax committed Jan 13, 2018
1 parent 2f62c60 commit a59a2bc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 27 deletions.
34 changes: 16 additions & 18 deletions D365FONinjaDevTools/D365FoNinjaDevExtensionsPackage.vsct
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<Group guid="guidCommand1PackageCmdSet" id="MyMenuGroup1" priority="0x0100">
<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_ITEMNODE" />
</Group>
<Group guid="guidD365FoNinjaDevExtensionsPackageCmdSet" id="MyMenuGroup" priority="0x0600">
<Group guid="guidCommand1PackageCmdSet" id="MyMenuGroup2" priority="0x0100">
<Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_TOOLS" />
</Group>
</Groups>
Expand All @@ -40,19 +40,19 @@
<ButtonText>Extend...</ButtonText>
</Strings>
</Button>
<Button guid="guidD365FoNinjaDevExtensionsPackageCmdSet" id="cmdidCommand1" priority="0x0100" type="Button">
<Parent guid="guidD365FoNinjaDevExtensionsPackageCmdSet" id="MyMenuGroup" />
<Icon guid="guidImages1" id="bmpPic1" />

<Button guid="guidCommand1PackageCmdSet" id="cmdidCommand1" priority="0x0100" type="Button">
<Parent guid="guidCommand1PackageCmdSet" id="MyMenuGroup2" />
<Strings>
<ButtonText>Invoke Command1</ButtonText>
<ButtonText>Indent code</ButtonText>
</Strings>
</Button>
</Buttons>

<Bitmaps>
<Bitmap guid="guidImages" href="Resources\ToolBox.png" usedList="bmpPic1" />
<Bitmap guid="guidImages2" href="Resources\NewClass.png" />
<Bitmap guid="guidImages1" href="NewFolder1\Resources\Command1.png" usedList="bmpPic1, bmpPic2, bmpPicSearch, bmpPicX, bmpPicArrows, bmpPicStrikethrough" />

</Bitmaps>
</Commands>

Expand All @@ -61,6 +61,13 @@
editor="guidVSStd97"
key1="VK_ADD" mod1="Control">
</KeyBinding>

<KeyBinding guid="guidCommand1PackageCmdSet" id="cmdidCommand1"
editor="guidVSStd97"
key1="I" mod1="Alt"
>
</KeyBinding>

</KeyBindings>

<Symbols>
Expand All @@ -71,6 +78,8 @@
<IDSymbol name="cmdIdAddItemsToFolder" value="0x0100" />
<IDSymbol name="cmdExtendClass" value="0x0200" />
<IDSymbol name="MyMenuGroup1" value="0x1010" />
<IDSymbol name="MyMenuGroup2" value="300" />
<IDSymbol name="cmdidCommand1" value="1025" />
</GuidSymbol>

<GuidSymbol name="guidImages" value="{d7fde224-2a28-4562-9926-a6578a13cf0f}">
Expand All @@ -83,18 +92,7 @@
</GuidSymbol>


<GuidSymbol value="{2db687bb-05d6-4c38-94db-a56751bcf34b}" name="guidD365FoNinjaDevExtensionsPackageCmdSet">
<IDSymbol value="4128" name="MyMenuGroup" />
<IDSymbol value="256" name="cmdidCommand1" />
</GuidSymbol>

<GuidSymbol value="{388896f3-6fd9-42cd-8bd6-565725e6cd75}" name="guidImages1">
<IDSymbol name="bmpPic1" value="1" />
<IDSymbol name="bmpPic2" value="2" />
<IDSymbol name="bmpPicSearch" value="3" />
<IDSymbol name="bmpPicX" value="4" />
<IDSymbol name="bmpPicArrows" value="5" />
<IDSymbol name="bmpPicStrikethrough" value="6" />
</GuidSymbol>

</Symbols>
</CommandTable>
12 changes: 9 additions & 3 deletions D365FONinjaDevTools/NewFolder1/Command1.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel.Design;
using D365FONinjaDevTools.Kernel;
using Microsoft.VisualStudio.Shell;

namespace D365FONinjaDevTools.NewFolder1
Expand All @@ -12,12 +13,12 @@ internal sealed class Command1
/// <summary>
/// Command ID.
/// </summary>
public const int CommandId = 0x1025;
public const int CommandId = 1025;

/// <summary>
/// Command menu group (command set GUID).
/// </summary>
public static readonly Guid CommandSet = new Guid("2db687bb-05d6-4c38-94db-a56751bcf34b");
public static readonly Guid CommandSet = new Guid("5ed27ab2-7007-4c3d-a535-88720e97b49f");

/// <summary>
/// VS Package that provides this command, not null.
Expand All @@ -39,9 +40,12 @@ private Command1(Package package)
OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if (commandService != null)
{

var menuCommandID = new CommandID(CommandSet, CommandId);
var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID);
commandService.AddCommand(menuItem);

menuItem.Visible = true;
}
}

Expand Down Expand Up @@ -77,7 +81,9 @@ public static void Initialize(Package package)
/// <param name="e">Event args.</param>
private void MenuItemCallback(object sender, EventArgs e)
{

LocalUtils.MyDte.ExecuteCommand("Edit.SelectAll");
LocalUtils.MyDte.ExecuteCommand("Edit.Copy");
LocalUtils.MyDte.ExecuteCommand("Edit.Paste");
}
}
}
6 changes: 0 additions & 6 deletions D3FONinjaDevTools.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "D365FONinjaDevTools", "D365
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "D365FONinjaDevTools_Setup", "D365FONinjaDevToolsSetup\D365FONinjaDevTools_Setup.csproj", "{40EC3306-FD6A-4973-A9F5-6D50867D3ACE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfApplication1", "WpfApplication1\WpfApplication1.csproj", "{554AC5FB-4EC5-4188-AE38-6946BA6AC019}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -23,10 +21,6 @@ Global
{40EC3306-FD6A-4973-A9F5-6D50867D3ACE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{40EC3306-FD6A-4973-A9F5-6D50867D3ACE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{40EC3306-FD6A-4973-A9F5-6D50867D3ACE}.Release|Any CPU.Build.0 = Release|Any CPU
{554AC5FB-4EC5-4188-AE38-6946BA6AC019}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{554AC5FB-4EC5-4188-AE38-6946BA6AC019}.Debug|Any CPU.Build.0 = Debug|Any CPU
{554AC5FB-4EC5-4188-AE38-6946BA6AC019}.Release|Any CPU.ActiveCfg = Release|Any CPU
{554AC5FB-4EC5-4188-AE38-6946BA6AC019}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit a59a2bc

Please sign in to comment.