Skip to content

Commit

Permalink
fixed various broken code explorer icons
Browse files Browse the repository at this point in the history
  • Loading branch information
retailcoder committed Aug 17, 2020
1 parent 6ef7326 commit 49db96c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ public CodeExplorerComponentViewModel(ICodeExplorerNode parent, Declaration decl
Declaration.IsUserDefined &&
Declaration.DeclarationType == DeclarationType.ClassModule &&
Declaration.QualifiedName.QualifiedModuleName.ComponentType != ComponentType.Document &&
Declaration.QualifiedName.QualifiedModuleName.ComponentType != ComponentType.UserForm &&
Declaration.Attributes.HasPredeclaredIdAttribute(out _);

public bool IsTestModule => Declaration.DeclarationType == DeclarationType.ProceduralModule
&& Declaration.Annotations.Any(annotation => annotation is TestModuleAnnotation);
&& Declaration.Annotations.Any(annotation => annotation.Annotation is TestModuleAnnotation);

public override void Synchronize(ref List<Declaration> updated)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class CodeExplorerNodeToIconConverter : ImageSourceConverter, IMultiValue

public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if ((value as ICodeExplorerNode )?.Declaration is null)
if ((value as ICodeExplorerNode)?.Declaration is null)
{
return NullIcon;
}
Expand Down Expand Up @@ -93,7 +93,7 @@ public override object Convert(object value, Type targetType, object parameter,
}

if (component.Declaration is ClassModuleDeclaration classModule &&
(classModule.IsInterface || classModule.Annotations.Any(annotation => annotation is InterfaceAnnotation)))
(classModule.IsInterface || classModule.Annotations.Any(annotation => annotation.Annotation is InterfaceAnnotation)))
{
return InterfaceIcon;
}
Expand All @@ -105,7 +105,7 @@ public override object Convert(object value, Type targetType, object parameter,
return value is ICodeExplorerNode node &&
node.Declaration != null &&
DeclarationIcons.ContainsKey(node.Declaration.DeclarationType)
? node.Declaration.Annotations.Any(a => a is TestMethodAnnotation)
? node.Declaration.Annotations.Any(a => a.Annotation is TestMethodAnnotation)
? TestMethodIcon
: DeclarationIcons[node.Declaration.DeclarationType]
: ExceptionIcon;
Expand Down
5 changes: 3 additions & 2 deletions Rubberduck.Parsing/Symbols/ClassModuleDeclaration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ public class ClassModuleDeclaration : ModuleDeclaration
bool isWithEvents = false,
bool hasDefaultInstanceVariable = false,
bool isControl = false,
bool isDocument = false)
bool isDocument = false,
bool isUserForm = false)
: base(
qualifiedName,
projectDeclaration,
name,
isDocument ? DeclarationType.Document : DeclarationType.ClassModule,
isDocument ? DeclarationType.Document : isUserForm ? DeclarationType.UserForm : DeclarationType.ClassModule,
isUserDefined,
annotations,
attributes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,14 @@ protected void ResolveDeclarations(QualifiedModuleName module, IParseTree tree,
true,
moduleAnnotations,
moduleAttributes);
case ComponentType.UserForm:
return new ClassModuleDeclaration(
qualifiedModuleName.QualifyMemberName(qualifiedModuleName.ComponentName),
projectDeclaration,
qualifiedModuleName.ComponentName,
true,
moduleAnnotations,
moduleAttributes, isUserForm:true);
case ComponentType.Document:
return new DocumentModuleDeclaration(
qualifiedModuleName.QualifyMemberName(qualifiedModuleName.ComponentName),
Expand Down

0 comments on commit 49db96c

Please sign in to comment.