Skip to content

Commit 59edd83

Browse files
authored
Merge pull request #4920 from MDoerner/ShowTemplateAfterInsert
Show components added through the AddComponentService
2 parents 7a21154 + 70caa83 commit 59edd83

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Rubberduck.VBEEditor/Utility/AddComponentService.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,34 @@ public void AddComponent(IComponentSourceCodeHandler sourceCodeHandler, string p
4545
using (var loadedComponent = sourceCodeHandler.SubstituteCode(newComponent, code))
4646
{
4747
AddPrefix(loadedComponent, prefixInModule);
48+
ShowComponent(loadedComponent);
4849
}
4950
}
5051
else
5152
{
5253
AddPrefix(newComponent, prefixInModule);
54+
ShowComponent(newComponent);
55+
}
56+
}
57+
}
58+
59+
private static void ShowComponent(IVBComponent component)
60+
{
61+
if (component == null)
62+
{
63+
return;
64+
}
65+
66+
using (var codeModule = component.CodeModule)
67+
{
68+
if (codeModule == null)
69+
{
70+
return;
71+
}
72+
73+
using (var codePane = codeModule.CodePane)
74+
{
75+
codePane.Show();
5376
}
5477
}
5578
}

0 commit comments

Comments
 (0)