Skip to content

Commit c1e5314

Browse files
authored
Merge branch 'next' into cacheBugs
2 parents f8821bf + 38b1be5 commit c1e5314

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

RetailCoder.VBE/Navigation/CodeExplorer/CodeExplorerViewModel.cs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -177,25 +177,27 @@ public string PanelTitle
177177
return string.Empty;
178178
}
179179

180-
if (SelectedItem is CodeExplorerProjectViewModel)
180+
if (!(SelectedItem is ICodeExplorerDeclarationViewModel))
181181
{
182-
var node = (CodeExplorerProjectViewModel)SelectedItem;
183-
return node.Declaration.IdentifierName + string.Format(" - ({0})", node.Declaration.DeclarationType);
182+
return SelectedItem.Name;
184183
}
185184

186-
if (SelectedItem is CodeExplorerComponentViewModel)
187-
{
188-
var node = (CodeExplorerComponentViewModel)SelectedItem;
189-
return node.Declaration.IdentifierName + string.Format(" - ({0})", node.Declaration.DeclarationType);
190-
}
185+
var declaration = SelectedItem.GetSelectedDeclaration();
186+
187+
var nameWithDeclarationType = declaration.IdentifierName +
188+
string.Format(" - ({0})", RubberduckUI.ResourceManager.GetString(
189+
"DeclarationType_" + declaration.DeclarationType, UI.Settings.Settings.Culture));
191190

192-
if (SelectedItem is CodeExplorerMemberViewModel)
191+
if (string.IsNullOrEmpty(declaration.AsTypeName))
193192
{
194-
var node = (CodeExplorerMemberViewModel)SelectedItem;
195-
return node.Declaration.IdentifierName + string.Format(" - ({0})", node.Declaration.DeclarationType);
193+
return nameWithDeclarationType;
196194
}
197195

198-
return SelectedItem.Name;
196+
var typeName = declaration.HasTypeHint
197+
? Declaration.TypeHintToTypeName[declaration.TypeHint]
198+
: declaration.AsTypeName;
199+
200+
return nameWithDeclarationType + ": " + typeName;
199201
}
200202
}
201203

0 commit comments

Comments
 (0)