File tree Expand file tree Collapse file tree 4 files changed +97
-1
lines changed Expand file tree Collapse file tree 4 files changed +97
-1
lines changed Original file line number Diff line number Diff line change 347
347
<Compile Include =" UI\CodeExplorer\CodeExplorerControl.xaml.cs" >
348
348
<DependentUpon >CodeExplorerControl.xaml</DependentUpon >
349
349
</Compile >
350
+ <Compile Include =" UI\CodeExplorer\CodeExplorerViewModel.cs" />
351
+ <Compile Include =" UI\CodeExplorer\CodeExplorerViewModelBuilder.cs" />
350
352
<Compile Include =" UI\CodeInspections\InspectionDescriptionConverter.cs" />
351
353
<Compile Include =" UI\CodeInspections\InspectionImageSourceConverter.cs" />
352
354
<Compile Include =" UI\CodeInspections\InspectionResultsControl.xaml.cs" >
Original file line number Diff line number Diff line change 184
184
<Button Command =" {Binding ToggleNamespaces}"
185
185
IsEnabled =" {Binding CanRefresh}"
186
186
ToolTip =" Toggle namespace folders" >
187
- <Image Height =" 16" Source =" ../../Resources/blue-folder-horizontal-open .png" />
187
+ <Image Height =" 16" Source =" ../../Resources/blue-folder-horizontal.png" />
188
188
</Button >
189
189
190
190
<Button Command =" {Binding ToggleFolders}"
Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using System . Collections . ObjectModel ;
3
+ using System . Text ;
4
+ using System . Threading . Tasks ;
5
+ using Rubberduck . Parsing . Symbols ;
6
+ using Rubberduck . Parsing . VBA ;
7
+
8
+ namespace Rubberduck . UI . CodeExplorer
9
+ {
10
+ public class CodeExplorerViewModel : ViewModelBase
11
+ {
12
+ private readonly RubberduckParserState _state ;
13
+ private readonly ObservableCollection < ExplorerItemViewModel > _children ;
14
+
15
+ public CodeExplorerViewModel ( RubberduckParserState state , ObservableCollection < ExplorerItemViewModel > children )
16
+ {
17
+ _state = state ;
18
+ _children = children ;
19
+ }
20
+
21
+ private bool _isBusy ;
22
+ public bool IsBusy { get { return _isBusy ; } set { _isBusy = value ; OnPropertyChanged ( ) ; } }
23
+
24
+
25
+ }
26
+
27
+ public class ExplorerItemViewModel : ViewModelBase
28
+ {
29
+ private readonly Declaration _declaration ;
30
+ private readonly ObservableCollection < ExplorerItemViewModel > _children = new ObservableCollection < ExplorerItemViewModel > ( ) ;
31
+
32
+ public ExplorerItemViewModel ( Declaration declaration )
33
+ {
34
+ _declaration = declaration ;
35
+ }
36
+
37
+ public void AddChild ( ExplorerItemViewModel declaration )
38
+ {
39
+ _children . Add ( declaration ) ;
40
+ }
41
+
42
+ public void Clear ( )
43
+ {
44
+ _children . Clear ( ) ;
45
+ }
46
+
47
+ public Declaration Declaration { get { return _declaration ; } }
48
+ }
49
+ }
Original file line number Diff line number Diff line change
1
+ using System . Collections . Generic ;
2
+ using System . Linq ;
3
+ using Rubberduck . Parsing . Symbols ;
4
+ using Rubberduck . Parsing . VBA ;
5
+
6
+ namespace Rubberduck . UI . CodeExplorer
7
+ {
8
+ public class CodeExplorerViewModelBuilder
9
+ {
10
+ private readonly RubberduckParserState _state ;
11
+
12
+ public CodeExplorerViewModelBuilder ( RubberduckParserState state )
13
+ {
14
+ _state = state ;
15
+ }
16
+
17
+ public IEnumerable < ExplorerItemViewModel > Build ( )
18
+ {
19
+ var userDeclarations = _state . AllDeclarations . Where ( d => ! d . IsBuiltIn ) . ToList ( ) ;
20
+ foreach ( var projectDeclaration in userDeclarations . Where ( d => d . DeclarationType == DeclarationType . Project ) )
21
+ {
22
+ var project = projectDeclaration ;
23
+ var projectItem = new ExplorerItemViewModel ( project ) ;
24
+ foreach ( var componentDeclaration in userDeclarations . Where ( d => ReferenceEquals ( d . ParentDeclaration , project ) ) )
25
+ {
26
+ var component = componentDeclaration ;
27
+ yield return new ExplorerItemViewModel ( component ) ;
28
+ foreach ( var member in userDeclarations . Where ( d => ReferenceEquals ( d . ParentDeclaration , component ) ) )
29
+ {
30
+ yield return new ExplorerItemViewModel ( member ) ;
31
+ if ( member . DeclarationType == DeclarationType . UserDefinedType )
32
+ {
33
+
34
+ }
35
+
36
+ if ( member . DeclarationType == DeclarationType . Enumeration )
37
+ {
38
+
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
You can’t perform that action at this time.
0 commit comments