Skip to content

Commit eadcda1

Browse files
committed
Merge remote-tracking branch 'upstream/next' into rkapka-master
2 parents e40380f + ed38f4b commit eadcda1

File tree

93 files changed

+1226
-464
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1226
-464
lines changed

RetailCoder.VBE/Root/EnumerableCounterInterceptor.cs

Lines changed: 0 additions & 34 deletions
This file was deleted.

RetailCoder.VBE/Root/InterceptedException.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

RetailCoder.VBE/Root/InterceptorBase.cs

Lines changed: 0 additions & 36 deletions
This file was deleted.

RetailCoder.VBE/Root/RubberduckModule.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,12 @@ private void ApplyAbstractFactoryConvention(IEnumerable<Assembly> assemblies)
294294
private void BindCodeInspectionTypes(IEnumerable<Assembly> assemblies)
295295
{
296296
var inspections = assemblies
297-
.SelectMany(a => a.GetTypes().Where(type => type.IsClass && !type.IsAbstract && type.GetInterfaces().Contains(typeof(IInspection))))
298-
.ToList();
297+
.SelectMany(a => a.GetTypes()
298+
.Where(type => type.IsClass
299+
&& !type.IsAbstract
300+
&& type.GetInterfaces().Contains(typeof(IInspection))
301+
)
302+
);
299303

300304
// multibinding for IEnumerable<IInspection> dependency
301305
foreach(var inspection in inspections)
@@ -308,17 +312,12 @@ private void BindCodeInspectionTypes(IEnumerable<Assembly> assemblies)
308312
.InCallScope()
309313
.Named(inspection.FullName);
310314

311-
binding.Intercept().With<TimedCallLoggerInterceptor>();
312-
binding.Intercept().With<EnumerableCounterInterceptor<IInspectionResult>>();
313-
314315
var localInspection = inspection;
315316
Bind<IInspection>().ToMethod(c => (IInspection)c.Kernel.Get(iParseTreeInspection, localInspection.FullName));
316317
}
317318
else
318319
{
319320
var binding = Bind<IInspection>().To(inspection).InCallScope();
320-
binding.Intercept().With<TimedCallLoggerInterceptor>();
321-
binding.Intercept().With<EnumerableCounterInterceptor<IInspectionResult>>();
322321
}
323322
}
324323
}
@@ -509,6 +508,7 @@ private IEnumerable<IMenuItem> GetRubberduckMenuItems()
509508
{
510509
return new[]
511510
{
511+
KernelInstance.Get<RefreshCommandMenuItem>(),
512512
KernelInstance.Get<AboutCommandMenuItem>(),
513513
KernelInstance.Get<SettingsCommandMenuItem>(),
514514
KernelInstance.Get<InspectionResultsCommandMenuItem>(),

RetailCoder.VBE/Root/TimedCallLoggerInterceptor.cs

Lines changed: 0 additions & 41 deletions
This file was deleted.

RetailCoder.VBE/Rubberduck.csproj

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,6 @@
373373
<Compile Include="Refactorings\ExtractMethod\IExtractMethodProc.cs" />
374374
<Compile Include="Refactorings\ExtractMethod\IExtractMethodRule.cs" />
375375
<Compile Include="Refactorings\ExtractMethod\IExtractMethodSelectionValidation.cs" />
376-
<Compile Include="Root\EnumerableCounterInterceptor.cs" />
377-
<Compile Include="Root\InterceptedException.cs" />
378-
<Compile Include="Root\InterceptorBase.cs" />
379-
<Compile Include="Root\TimedCallLoggerInterceptor.cs" />
380376
<Compile Include="RubberduckGuid.cs" />
381377
<Compile Include="RubberduckProgId.cs" />
382378
<Compile Include="Settings\CodeInspectionConfigProvider.cs" />
@@ -426,9 +422,11 @@
426422
<Compile Include="UI\Command\FormDesignerFindAllReferencesCommand.cs" />
427423
<Compile Include="UI\Command\IndentCurrentProjectCommand.cs" />
428424
<Compile Include="UI\Command\MenuItems\CommandBars\ContextDescriptionLabelMenuItem.cs" />
425+
<Compile Include="UI\Command\MenuItems\RefreshCommandMenuItem.cs" />
429426
<Compile Include="UI\Command\MenuItems\FormDesignerFindAllReferencesCommandMenuItem.cs" />
430427
<Compile Include="UI\Command\MenuItems\IndentCurrentProjectCommandMenuItem.cs" />
431428
<Compile Include="UI\Command\MenuItems\ExportAllCommandMenuItem.cs" />
429+
<Compile Include="UI\Command\RefreshCommand .cs" />
432430
<Compile Include="UI\Controls\EmptyUIRefresh.xaml.cs">
433431
<DependentUpon>EmptyUIRefresh.xaml</DependentUpon>
434432
</Compile>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public FormDesignerRefactorRenameCommandMenuItem(CommandBase command)
1515

1616
public override bool EvaluateCanExecute(RubberduckParserState state)
1717
{
18-
return state.Status == ParserState.Ready && Command.CanExecute(null);
18+
return state != null && state.Status == ParserState.Ready && Command.CanExecute(null);
1919
}
2020
}
2121
}

RetailCoder.VBE/UI/Command/MenuItems/ParentMenus/ParentMenuItemBase.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,16 @@ public void EvaluateCanExecute(RubberduckParserState state)
124124
var commandItem = kvp.Key as ICommandMenuItem;
125125
if (commandItem != null && kvp.Value != null)
126126
{
127-
kvp.Value.IsEnabled = commandItem.EvaluateCanExecute(state);
127+
try
128+
{
129+
kvp.Value.IsEnabled = commandItem.EvaluateCanExecute(state);
130+
}
131+
catch (Exception exception)
132+
{
133+
kvp.Value.IsEnabled = false;
134+
Logger.Error(exception, "Could not evaluate availability of commmand menu item {0}.", kvp.Value.Tag ?? "{Unknown}");
135+
}
136+
128137
}
129138
}
130139
}

RetailCoder.VBE/UI/Command/MenuItems/ParentMenus/RubberduckParentMenu.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public RubberduckParentMenu(IEnumerable<IMenuItem> items, int beforeIndex)
1212

1313
public enum RubberduckMenuItemDisplayOrder
1414
{
15+
Refresh,
1516
UnitTesting,
1617
Refactorings,
1718
Navigate,
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using Rubberduck.UI.Command.MenuItems.ParentMenus;
2+
3+
namespace Rubberduck.UI.Command.MenuItems
4+
{
5+
public class RefreshCommandMenuItem : CommandMenuItemBase
6+
{
7+
public RefreshCommandMenuItem(CommandBase command) : base(command)
8+
{
9+
}
10+
public override string Key => "RubberduckMenu_Refresh";
11+
public override int DisplayOrder => (int)RubberduckMenuItemDisplayOrder.Refresh;
12+
}
13+
}

0 commit comments

Comments
 (0)