Skip to content

Commit 49db96c

Browse files
committed
fixed various broken code explorer icons
1 parent 6ef7326 commit 49db96c

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

Rubberduck.Core/Navigation/CodeExplorer/CodeExplorerComponentViewModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@ public CodeExplorerComponentViewModel(ICodeExplorerNode parent, Declaration decl
4949
Declaration.IsUserDefined &&
5050
Declaration.DeclarationType == DeclarationType.ClassModule &&
5151
Declaration.QualifiedName.QualifiedModuleName.ComponentType != ComponentType.Document &&
52+
Declaration.QualifiedName.QualifiedModuleName.ComponentType != ComponentType.UserForm &&
5253
Declaration.Attributes.HasPredeclaredIdAttribute(out _);
5354

5455
public bool IsTestModule => Declaration.DeclarationType == DeclarationType.ProceduralModule
55-
&& Declaration.Annotations.Any(annotation => annotation is TestModuleAnnotation);
56+
&& Declaration.Annotations.Any(annotation => annotation.Annotation is TestModuleAnnotation);
5657

5758
public override void Synchronize(ref List<Declaration> updated)
5859
{

Rubberduck.Core/UI/Converters/CodeExplorerNodeToIconConverter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class CodeExplorerNodeToIconConverter : ImageSourceConverter, IMultiValue
6262

6363
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
6464
{
65-
if ((value as ICodeExplorerNode )?.Declaration is null)
65+
if ((value as ICodeExplorerNode)?.Declaration is null)
6666
{
6767
return NullIcon;
6868
}
@@ -93,7 +93,7 @@ public override object Convert(object value, Type targetType, object parameter,
9393
}
9494

9595
if (component.Declaration is ClassModuleDeclaration classModule &&
96-
(classModule.IsInterface || classModule.Annotations.Any(annotation => annotation is InterfaceAnnotation)))
96+
(classModule.IsInterface || classModule.Annotations.Any(annotation => annotation.Annotation is InterfaceAnnotation)))
9797
{
9898
return InterfaceIcon;
9999
}
@@ -105,7 +105,7 @@ public override object Convert(object value, Type targetType, object parameter,
105105
return value is ICodeExplorerNode node &&
106106
node.Declaration != null &&
107107
DeclarationIcons.ContainsKey(node.Declaration.DeclarationType)
108-
? node.Declaration.Annotations.Any(a => a is TestMethodAnnotation)
108+
? node.Declaration.Annotations.Any(a => a.Annotation is TestMethodAnnotation)
109109
? TestMethodIcon
110110
: DeclarationIcons[node.Declaration.DeclarationType]
111111
: ExceptionIcon;

Rubberduck.Parsing/Symbols/ClassModuleDeclaration.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ public ClassModuleDeclaration(
2929
bool isWithEvents = false,
3030
bool hasDefaultInstanceVariable = false,
3131
bool isControl = false,
32-
bool isDocument = false)
32+
bool isDocument = false,
33+
bool isUserForm = false)
3334
: base(
3435
qualifiedName,
3536
projectDeclaration,
3637
name,
37-
isDocument ? DeclarationType.Document : DeclarationType.ClassModule,
38+
isDocument ? DeclarationType.Document : isUserForm ? DeclarationType.UserForm : DeclarationType.ClassModule,
3839
isUserDefined,
3940
annotations,
4041
attributes,

Rubberduck.Parsing/VBA/DeclarationResolving/DeclarationResolveRunnerBase.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,14 @@ private ModuleDeclaration NewModuleDeclaration(
199199
true,
200200
moduleAnnotations,
201201
moduleAttributes);
202+
case ComponentType.UserForm:
203+
return new ClassModuleDeclaration(
204+
qualifiedModuleName.QualifyMemberName(qualifiedModuleName.ComponentName),
205+
projectDeclaration,
206+
qualifiedModuleName.ComponentName,
207+
true,
208+
moduleAnnotations,
209+
moduleAttributes, isUserForm:true);
202210
case ComponentType.Document:
203211
return new DocumentModuleDeclaration(
204212
qualifiedModuleName.QualifyMemberName(qualifiedModuleName.ComponentName),

0 commit comments

Comments
 (0)