File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Rubberduck.Core/UI/CodeExplorer/Commands Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ namespace Rubberduck.UI.CodeExplorer.Commands
99 public class AddComponentCommand
1010 {
1111 private readonly IVBE _vbe ;
12- private const string DefaultFolder = "VBAProject" ;
1312
1413 public AddComponentCommand ( IVBE vbe )
1514 {
@@ -69,16 +68,22 @@ private Declaration GetDeclaration(CodeExplorerItemViewModel node)
6968
7069 return ( node as ICodeExplorerDeclarationViewModel ) ? . Declaration ;
7170 }
72-
71+ private string GetActiveProjectName ( )
72+ {
73+ using ( var activeProject = _vbe . ActiveVBProject )
74+ {
75+ return activeProject . Name ;
76+ }
77+ }
7378 private string GetFolder ( CodeExplorerItemViewModel node )
7479 {
7580 switch ( node )
7681 {
7782 case null :
78- return DefaultFolder ;
83+ return GetActiveProjectName ( ) ;
7984 case ICodeExplorerDeclarationViewModel declarationNode :
8085 return string . IsNullOrEmpty ( declarationNode . Declaration . CustomFolder )
81- ? DefaultFolder
86+ ? GetActiveProjectName ( )
8287 : declarationNode . Declaration . CustomFolder . Replace ( "\" " , string . Empty ) ;
8388 default :
8489 return ( ( CodeExplorerCustomFolderViewModel ) node ) . FullPath ;
You can’t perform that action at this time.
0 commit comments