Skip to content

Commit 35afc8d

Browse files
committed
builds Predeclared Class Module Text
1 parent e09a69f commit 35afc8d

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Rubberduck.Navigation.CodeExplorer;
33
using Rubberduck.UI.Command;
44
using Rubberduck.VBEditor.SafeComWrappers;
5+
using System.IO;
56

67
namespace Rubberduck.UI.CodeExplorer.Commands
78
{
@@ -22,7 +23,25 @@ protected override bool EvaluateCanExecute(object parameter)
2223

2324
protected override void OnExecute(object parameter)
2425
{
25-
_addComponentCommand.AddComponent(parameter as CodeExplorerItemViewModel, ComponentType.ClassModule);
26+
string moduleText = CreatePreclaredClassModule();
27+
_addComponentCommand.AddComponent(parameter as CodeExplorerItemViewModel, moduleText);
28+
}
29+
30+
private string CreatePreclaredClassModule()
31+
{
32+
string moduleText = @"
33+
VERSION 1.0 CLASS
34+
BEGIN
35+
MultiUse = -1 'True
36+
END
37+
Attribute VB_GlobalNameSpace = False
38+
Attribute VB_Creatable = False
39+
Attribute VB_PredeclaredId = True
40+
Attribute VB_Exposed = False
41+
Attribute VB_Ext_KEY = ""Rubberduck"",""Predeclared Class Module""
42+
Option Explicit
43+
";
44+
return moduleText;
2645
}
2746
}
2847
}

0 commit comments

Comments
 (0)