Skip to content

Commit 38b1be5

Browse files
authored
Merge pull request #1988 from Hosch250/Issue1974
Specify type of selected function/property in bottom panel of CE
2 parents 2347142 + fe7026d commit 38b1be5

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
@@ -189,25 +189,27 @@ public string PanelTitle
189189
return string.Empty;
190190
}
191191

192-
if (SelectedItem is CodeExplorerProjectViewModel)
192+
if (!(SelectedItem is ICodeExplorerDeclarationViewModel))
193193
{
194-
var node = (CodeExplorerProjectViewModel)SelectedItem;
195-
return node.Declaration.IdentifierName + string.Format(" - ({0})", node.Declaration.DeclarationType);
194+
return SelectedItem.Name;
196195
}
197196

198-
if (SelectedItem is CodeExplorerComponentViewModel)
199-
{
200-
var node = (CodeExplorerComponentViewModel)SelectedItem;
201-
return node.Declaration.IdentifierName + string.Format(" - ({0})", node.Declaration.DeclarationType);
202-
}
197+
var declaration = SelectedItem.GetSelectedDeclaration();
198+
199+
var nameWithDeclarationType = declaration.IdentifierName +
200+
string.Format(" - ({0})", RubberduckUI.ResourceManager.GetString(
201+
"DeclarationType_" + declaration.DeclarationType, UI.Settings.Settings.Culture));
203202

204-
if (SelectedItem is CodeExplorerMemberViewModel)
203+
if (string.IsNullOrEmpty(declaration.AsTypeName))
205204
{
206-
var node = (CodeExplorerMemberViewModel)SelectedItem;
207-
return node.Declaration.IdentifierName + string.Format(" - ({0})", node.Declaration.DeclarationType);
205+
return nameWithDeclarationType;
208206
}
209207

210-
return SelectedItem.Name;
208+
var typeName = declaration.HasTypeHint
209+
? Declaration.TypeHintToTypeName[declaration.TypeHint]
210+
: declaration.AsTypeName;
211+
212+
return nameWithDeclarationType + ": " + typeName;
211213
}
212214
}
213215

0 commit comments

Comments
 (0)