diff options
author | Karsten Heimrich <karsten.heimrich@qt.io> | 2023-08-31 21:39:23 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@qt.io> | 2023-09-01 18:23:46 +0000 |
commit | efb33c7f294cc0bfe3f5d8871a30ab4ccf029a76 (patch) | |
tree | 986f3a271ec747fc33a8986ff25888ff071b1e5d /QtVsTools.Wizards/ItemWizard/Translation | |
parent | f0541a0555f5af32db7209c72d17816637535ad5 (diff) |
Fix wizard adding new .cpp and .h files under wrong section
We need to open the .cpp manualy, cause the OpenInEditor thingy
has already happened in ProjectItemFinishedGenerating(), leading
to an VS error message dialog that the item is now in a zombie
state.
Fixes: QTVSADDINBUG-1093
Change-Id: I6d9217122af0aa0b3dfa53051453206513bfa568
Reviewed-by: Miguel Costa <miguel.costa@qt.io>
Diffstat (limited to 'QtVsTools.Wizards/ItemWizard/Translation')
-rw-r--r-- | QtVsTools.Wizards/ItemWizard/Translation/TranslationWizard.cs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/QtVsTools.Wizards/ItemWizard/Translation/TranslationWizard.cs b/QtVsTools.Wizards/ItemWizard/Translation/TranslationWizard.cs index 31338de2..b4f1b1f6 100644 --- a/QtVsTools.Wizards/ItemWizard/Translation/TranslationWizard.cs +++ b/QtVsTools.Wizards/ItemWizard/Translation/TranslationWizard.cs @@ -13,8 +13,10 @@ using Microsoft.VisualStudio.Shell; namespace QtVsTools.Wizards.ItemWizard { using Common; + using Microsoft.VisualStudio.VCProjectEngine; using ProjectWizard; using QtVsTools.Common; + using QtVsTools.Core; using Util; using static QtVsTools.Common.EnumExt; @@ -91,7 +93,15 @@ namespace QtVsTools.Wizards.ItemWizard public override void ProjectItemFinishedGenerating(ProjectItem projectItem) { ThreadHelper.ThrowIfNotOnUIThread(); - TextAndWhitespace.Adjust(Dte, projectItem.Properties.Item("FullPath").Value.ToString()); + + if (projectItem.Object is not VCFile vcFile) + return; + + var fullPath = vcFile.FullPath; + TextAndWhitespace.Adjust(Dte, fullPath); + + if (HelperFunctions.IsTranslationFile(fullPath)) + vcFile.MoveToFilter(FakeFilter.TranslationFiles()); } } } |