Skip to content

Commit 7909cf7

Browse files
committed
Re-evaluate icon after parser is ready, respect interface annotation for icon selection. Closes #4759
1 parent 647bb8a commit 7909cf7

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Rubberduck.Core/Navigation/CodeExplorer/CodeExplorerViewModel.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,15 @@ public double? FontSize
214214
}
215215
}
216216

217+
// This is just a binding hack to force the icon binding to re-evaluate. It has no other functionality and should
218+
// not be used for anything else.
219+
public bool ParserReady
220+
{
221+
get => true;
222+
// ReSharper disable once ValueParameterNotUsed
223+
set => OnPropertyChanged();
224+
}
225+
217226
private void HandleStateChanged(object sender, ParserStateEventArgs e)
218227
{
219228
Unparsed = false;
@@ -232,6 +241,7 @@ private void HandleStateChanged(object sender, ParserStateEventArgs e)
232241

233242
Unparsed = !Projects.Any();
234243
IsBusy = false;
244+
ParserReady = true;
235245
});
236246
return;
237247
}

Rubberduck.Core/UI/CodeExplorer/CodeExplorerControl.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,7 @@
595595
<Binding RelativeSource="{RelativeSource Self}" Path="DataContext"/>
596596
<Binding Path="Declaration" />
597597
<Binding Path="IsExpanded" />
598+
<Binding ElementName="CodeExplorer" Path="DataContext.ParserReady" />
598599
</MultiBinding.Bindings>
599600
</MultiBinding>
600601
</Image.Source>

Rubberduck.Core/UI/Converters/CodeExplorerNodeToIconConverter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ public override object Convert(object value, Type targetType, object parameter,
9292
return ExceptionIcon;
9393
}
9494

95-
if (component.Declaration is ClassModuleDeclaration classModule && classModule.IsInterface)
95+
if (component.Declaration is ClassModuleDeclaration classModule &&
96+
(classModule.IsInterface || classModule.Annotations.Any(annotation => annotation is InterfaceAnnotation)))
9697
{
9798
return InterfaceIcon;
9899
}

0 commit comments

Comments
 (0)