Skip to content

Commit dd41026

Browse files
committed
Refines Declaration inserttions
1 parent d2aecfa commit dd41026

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Rubberduck.Core/UI/CodeExplorer/Commands/AddComponentCommand.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public void AddComponent(CodeExplorerItemViewModel node, string moduleText)
6464
string optionCompare = string.Empty;
6565
using (IHostApplication hostApp = _vbe.HostApplication())
6666
{
67-
optionCompare = hostApp.ApplicationName == "Microsoft Access" ? "Option Compare Database" :
67+
optionCompare = hostApp.ApplicationName == "Access" ? "Option Compare Database" :
6868
string.Empty;
6969
}
7070

@@ -79,10 +79,19 @@ public void AddComponent(CodeExplorerItemViewModel node, string moduleText)
7979
{
8080
using (var codeModule = newComponent.CodeModule)
8181
{
82-
var delarationLines = string.Concat(folderAnnotation, optionCompare);
83-
codeModule.InsertLines(1, delarationLines);
82+
var delarationLines = string.Concat(folderAnnotation, optionCompare);
83+
if (optionCompare.Length > 0)
84+
{
85+
codeModule.InsertLines(1, optionCompare);
86+
}
87+
if (folderAnnotation.Length > 0)
88+
{
89+
codeModule.InsertLines(1, folderAnnotation);
90+
}
91+
codeModule.CodePane.Show();
8492
}
8593
}
94+
File.Delete(fileName);
8695
}
8796
}
8897

0 commit comments

Comments
 (0)