Skip to content

Commit 35c0ce9

Browse files
authored
Merge branch 'next' into next
2 parents 279e608 + aab1475 commit 35c0ce9

File tree

3 files changed

+40
-16
lines changed

3 files changed

+40
-16
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

RetailCoder.VBE/UI/CodeExplorer/CodeExplorerControl.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -740,8 +740,8 @@
740740

741741
<Border Grid.Row="3" BorderThickness="0,1,0,0" BorderBrush="DimGray">
742742

743-
<ScrollViewer Background="WhiteSmoke" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
744-
<StackPanel Orientation="Vertical" MinHeight="48" Background="WhiteSmoke">
743+
<ScrollViewer Background="WhiteSmoke" VerticalScrollBarVisibility="Auto">
744+
<WrapPanel Orientation="Vertical" MinHeight="48" Background="WhiteSmoke">
745745

746746
<Grid Margin="4" HorizontalAlignment="Stretch">
747747
<Grid.ColumnDefinitions>
@@ -776,7 +776,7 @@
776776
CommandParameter="{Binding SelectedItem}"
777777
Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=CodeExplorer_FindAllReferencesText}" />
778778
</WrapPanel>
779-
</StackPanel>
779+
</WrapPanel>
780780
</ScrollViewer>
781781
</Border>
782782
</Grid>

RetailCoder.VBE/UI/Command/MenuItems/RubberduckCommandBar.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void SetSelectionText(Declaration declaration)
5151
if (selection.HasValue) { SetSelectionText(selection.Value); }
5252
_selectionButton.TooltipText = _selectionButton.Caption;
5353
}
54-
else if (declaration != null)
54+
else if (declaration != null && !declaration.IsBuiltIn && declaration.DeclarationType != DeclarationType.ClassModule && declaration.DeclarationType != DeclarationType.ProceduralModule)
5555
{
5656
var typeName = declaration.HasTypeHint
5757
? Declaration.TypeHintToTypeName[declaration.TypeHint]
@@ -63,6 +63,28 @@ public void SetSelectionText(Declaration declaration)
6363
declaration.IdentifierName,
6464
RubberduckUI.ResourceManager.GetString("DeclarationType_" + declaration.DeclarationType, UI.Settings.Settings.Culture),
6565
string.IsNullOrEmpty(declaration.AsTypeName) ? string.Empty : ": " + typeName);
66+
67+
_selectionButton.TooltipText = string.IsNullOrEmpty(declaration.DescriptionString)
68+
? _selectionButton.Caption
69+
: declaration.DescriptionString;
70+
}
71+
else if (declaration != null)
72+
{
73+
// todo: confirm this is what we want, and then refator
74+
var selection = _vbe.ActiveCodePane.GetQualifiedSelection();
75+
if (selection.HasValue)
76+
{
77+
var typeName = declaration.HasTypeHint
78+
? Declaration.TypeHintToTypeName[declaration.TypeHint]
79+
: declaration.AsTypeName;
80+
81+
_selectionButton.Caption = string.Format("{0}|{1}: {2} ({3}{4})",
82+
selection.Value.Selection,
83+
declaration.QualifiedName.QualifiedModuleName,
84+
declaration.IdentifierName,
85+
RubberduckUI.ResourceManager.GetString("DeclarationType_" + declaration.DeclarationType, UI.Settings.Settings.Culture),
86+
string.IsNullOrEmpty(declaration.AsTypeName) ? string.Empty : ": " + typeName);
87+
}
6688
_selectionButton.TooltipText = string.IsNullOrEmpty(declaration.DescriptionString)
6789
? _selectionButton.Caption
6890
: declaration.DescriptionString;

0 commit comments

Comments
 (0)