7
7
using Rubberduck . UI . Command . MenuItems . ParentMenus ;
8
8
using Rubberduck . VBEditor ;
9
9
using ParserState = Rubberduck . Parsing . VBA . ParserState ;
10
- using NLog ;
11
10
12
11
namespace Rubberduck . UI . Command . MenuItems
13
12
{
@@ -31,7 +30,7 @@ public RubberduckCommandBar(RubberduckParserState state, VBE vbe, IShowParserErr
31
30
Initialize ( ) ;
32
31
}
33
32
34
- private void _statusButton_Click ( CommandBarButton Ctrl , ref bool CancelDefault )
33
+ private void _statusButton_Click ( CommandBarButton ctrl , ref bool cancelDefault )
35
34
{
36
35
if ( _state . Status == ParserState . Error )
37
36
{
@@ -53,31 +52,21 @@ public void SetSelectionText(Declaration declaration)
53
52
if ( selection . HasValue ) { SetSelectionText ( selection . Value ) ; }
54
53
_selectionButton . TooltipText = _selectionButton . Caption ;
55
54
}
56
- else if ( declaration != null && ! declaration . IsBuiltIn && declaration . DeclarationType != DeclarationType . ClassModule && declaration . DeclarationType != DeclarationType . ProceduralModule )
55
+ else if ( declaration != null )
57
56
{
57
+ var typeName = declaration . HasTypeHint
58
+ ? Declaration . TypeHintToTypeName [ declaration . TypeHint ]
59
+ : declaration . AsTypeName ;
60
+
58
61
_selectionButton . Caption = string . Format ( "{0}|{1}: {2} ({3}{4})" ,
59
62
declaration . QualifiedSelection . Selection ,
60
63
declaration . QualifiedName . QualifiedModuleName ,
61
64
declaration . IdentifierName ,
62
65
RubberduckUI . ResourceManager . GetString ( "DeclarationType_" + declaration . DeclarationType ) ,
63
- string . IsNullOrEmpty ( declaration . AsTypeName ) ? string . Empty : ": " + declaration . AsTypeName ) ;
64
- _selectionButton . TooltipText = string . IsNullOrEmpty ( declaration . DescriptionString )
65
- ? _selectionButton . Caption
66
- : declaration . DescriptionString ;
67
- }
68
- else if ( declaration != null )
69
- {
70
- // todo: confirm this is what we want, and then refator
71
- var selection = _vbe . ActiveCodePane . GetQualifiedSelection ( ) ;
72
- if ( selection . HasValue )
73
- {
74
- _selectionButton . Caption = string . Format ( "{0}|{1}: {2} ({3}{4})" ,
75
- selection . Value . Selection ,
76
- declaration . QualifiedName . QualifiedModuleName ,
77
- declaration . IdentifierName ,
78
- RubberduckUI . ResourceManager . GetString ( "DeclarationType_" + declaration . DeclarationType ) ,
79
- string . IsNullOrEmpty ( declaration . AsTypeName ) ? string . Empty : ": " + declaration . AsTypeName ) ;
80
- }
66
+ string . IsNullOrEmpty ( declaration . AsTypeName )
67
+ ? string . Empty
68
+ : ": " + typeName ) ;
69
+
81
70
_selectionButton . TooltipText = string . IsNullOrEmpty ( declaration . DescriptionString )
82
71
? _selectionButton . Caption
83
72
: declaration . DescriptionString ;
@@ -108,15 +97,15 @@ private void OnRefresh()
108
97
}
109
98
}
110
99
111
- public void Initialize ( )
100
+ private void Initialize ( )
112
101
{
113
102
_commandbar = _vbe . CommandBars . Add ( "Rubberduck" , MsoBarPosition . msoBarTop , false , true ) ;
114
103
115
104
_refreshButton = ( CommandBarButton ) _commandbar . Controls . Add ( MsoControlType . msoControlButton ) ;
116
105
ParentMenuItemBase . SetButtonImage ( _refreshButton , Resources . arrow_circle_double , Resources . arrow_circle_double_mask ) ;
117
106
_refreshButton . Style = MsoButtonStyle . msoButtonIcon ;
118
107
_refreshButton . Tag = "Refresh" ;
119
- _refreshButton . TooltipText = RubberduckUI . RubberduckCommandbarRefreshButtonTooltip ;
108
+ _refreshButton . TooltipText = RubberduckUI . RubberduckCommandbarRefreshButtonTooltip ;
120
109
_refreshButton . Click += refreshButton_Click ;
121
110
122
111
_statusButton = ( CommandBarButton ) _commandbar . Controls . Add ( MsoControlType . msoControlButton ) ;
@@ -132,7 +121,7 @@ public void Initialize()
132
121
_commandbar . Visible = true ;
133
122
}
134
123
135
- private void refreshButton_Click ( CommandBarButton Ctrl , ref bool CancelDefault )
124
+ private void refreshButton_Click ( CommandBarButton ctrl , ref bool cancelDefault )
136
125
{
137
126
OnRefresh ( ) ;
138
127
}
0 commit comments