Skip to content

Commit

Permalink
Merge pull request #28 from retailcoder/next
Browse files Browse the repository at this point in the history
sync with merged PR's in main repo
  • Loading branch information
retailcoder committed Feb 10, 2016
2 parents e9af00f + 9b0f4ca commit 9eeae14
Show file tree
Hide file tree
Showing 25 changed files with 1,163 additions and 47 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,9 @@ For more information, please see the EULAs in the [./Resources/Microsoft/ direct

* [Visual Studio 2013 Image Library EULA](https://github.com/retailcoder/Rubberduck/blob/master/RetailCoder.VBE/Resources/Microsoft/Visual%20Studio%202013%20Image%20Library%20EULA.rtf)
* [Visual Studio 2012 Image Library EULA](https://github.com/retailcoder/Rubberduck/blob/master/RetailCoder.VBE/Resources/Microsoft/Visual%20Studio%202012%20Image%20Library%20EULA.rtf)

###[WPF Localization Using RESX Files](http://www.codeproject.com/Articles/35159/WPF-Localization-Using-RESX-Files)

This library makes localizing WPF applications at runtime using resx files a breeze. Thank you [Grant Frisken](http://www.codeproject.com/script/Membership/View.aspx?mid=1079060)!

> Licensed under [The Code Project Open License](http://www.codeproject.com/info/cpol10.aspx).
3 changes: 2 additions & 1 deletion RetailCoder.VBE/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Rubberduck.UI.Command.MenuItems;
using Rubberduck.UI.ParserErrors;
using Rubberduck.VBEditor.Extensions;
using Infralution.Localization.Wpf;

namespace Rubberduck
{
Expand Down Expand Up @@ -189,7 +190,7 @@ private void LoadConfig()
var currentCulture = RubberduckUI.Culture;
try
{
RubberduckUI.Culture = CultureInfo.GetCultureInfo(_config.UserSettings.LanguageSetting.Code);
CultureManager.UICulture = CultureInfo.GetCultureInfo(_config.UserSettings.LanguageSetting.Code);
_appMenus.Localize();
}
catch (CultureNotFoundException exception)
Expand Down
17 changes: 17 additions & 0 deletions RetailCoder.VBE/Extension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using Ninject.Extensions.Factory;
using Rubberduck.Root;
using Rubberduck.UI;
using System.Reflection;
using System.IO;

namespace Rubberduck
{
Expand Down Expand Up @@ -36,6 +38,9 @@ public void OnConnection(object Application, ext_ConnectMode ConnectMode, object
{
try
{
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.AssemblyResolve += LoadFromSameFolder;

_kernel.Load(new RubberduckModule(_kernel, (VBE)Application, (AddIn)AddInInst));
_kernel.Load(new UI.SourceControl.SourceControlBindings());
_kernel.Load(new CommandBarsModule(_kernel));
Expand All @@ -49,6 +54,18 @@ public void OnConnection(object Application, ext_ConnectMode ConnectMode, object
}
}

Assembly LoadFromSameFolder(object sender, ResolveEventArgs args)
{
string folderPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string assemblyPath = Path.Combine(folderPath, new AssemblyName(args.Name).Name + ".dll");
if (!File.Exists(assemblyPath))
{
return null;
}
Assembly assembly = Assembly.LoadFrom(assemblyPath);
return assembly;
}

public void OnStartupComplete(ref Array custom)
{
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using Rubberduck.Parsing.VBA;
using Rubberduck.Parsing.Symbols;

namespace Rubberduck.Inspections
{
Expand All @@ -18,7 +19,7 @@ public SelfAssignedDeclarationInspection(RubberduckParserState state)
public override IEnumerable<CodeInspectionResultBase> GetInspectionResults()
{
return UserDeclarations
.Where(declaration => declaration.IsSelfAssigned)
.Where(declaration => declaration.IsSelfAssigned && declaration.DeclarationType == DeclarationType.Variable)
.Select(issue => new SelfAssignedDeclarationInspectionResult(this, issue));
}
}
Expand Down
3 changes: 3 additions & 0 deletions RetailCoder.VBE/Rubberduck.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@
<Reference Include="extensibility, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Infralution.Localization.Wpf">
<HintPath>..\libs\Infralution.Localization.Wpf.dll</HintPath>
</Reference>
<Reference Include="Ninject.Extensions.Conventions">
<HintPath>..\packages\ninject.extensions.conventions.3.2.0.0\lib\net45-full\Ninject.Extensions.Conventions.dll</HintPath>
</Reference>
Expand Down
6 changes: 4 additions & 2 deletions RetailCoder.VBE/UI/CodeExplorer/CodeExplorerControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
xmlns:codeExplorer="clr-namespace:Rubberduck.Navigation.CodeExplorer"
ResxExtension.DefaultResxName="Rubberduck.UI.RubberduckUI"
Language="{UICulture}"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance codeExplorer:CodeExplorerViewModel}">
<UserControl.Resources>
Expand Down Expand Up @@ -185,11 +187,11 @@
<Button Style="{StaticResource LinkButton}" Margin="4"
Visibility="{Binding CanExecuteRefactorRename, Converter={StaticResource BoolToVisibility}}"
Command="{Binding RefactorRenameCommand}"
Content="{x:Static resx:RubberduckUI.RefactorMenu_Rename}" />
Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=RefactorMenu_Rename}" />
<Button Style="{StaticResource LinkButton}" Margin="4"
Visibility="{Binding CanExecuteFindAllReferences, Converter={StaticResource BoolToVisibility}}"
Command="{Binding FindAllReferencesCommand}"
Content="{x:Static resx:RubberduckUI.ContextMenu_FindAllReferences}" />-->
Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=ContextMenu_FindAllReferences}" />-->
</WrapPanel>
</Grid>
</Border>
Expand Down
10 changes: 6 additions & 4 deletions RetailCoder.VBE/UI/CodeInspections/InspectionResultsControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:codeInspections="clr-namespace:Rubberduck.UI.CodeInspections"
xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
ResxExtension.DefaultResxName="Rubberduck.UI.RubberduckUI"
Language="{UICulture}"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance codeInspections:InspectionResultsViewModel}">
<UserControl.Resources>
Expand Down Expand Up @@ -204,7 +206,7 @@
<Separator />
<Menu>
<MenuItem VerticalAlignment="Center"
Header="{x:Static resx:RubberduckUI.Fix}"
Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=Fix}"
ItemsSource="{Binding SelectedItem.QuickFixes}">
<MenuItem.Icon>
<Image Height="16" Source="../../Resources/tick.png" />
Expand Down Expand Up @@ -263,15 +265,15 @@
<Button Style="{StaticResource LinkButton}" Margin="4"
Visibility="{Binding CanExecuteQuickFixInModule, Converter={StaticResource BoolToVisibility}}"
Command="{Binding QuickFixInModuleCommand}"
Content="{x:Static resx:RubberduckUI.QuickFix_ThisModule}" />
Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=QuickFix_ThisModule}" />
<Button Style="{StaticResource LinkButton}" Margin="4"
Visibility="{Binding CanExecuteQuickFixInProject, Converter={StaticResource BoolToVisibility}}"
Command="{Binding QuickFixInProjectCommand}"
Content="{x:Static resx:RubberduckUI.QuickFix_ThisProject}" />
Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=QuickFix_ThisProject}" />
<Button Style="{StaticResource LinkButton}" Margin="4"
Visibility="{Binding CanDisableInspection, Converter={StaticResource BoolToVisibility}}"
Command="{Binding DisableInspectionCommand}"
Content="{x:Static resx:RubberduckUI.DisableThisInspection}" />
Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=DisableThisInspection}" />
</WrapPanel>
</StackPanel>
</Border>
Expand Down
32 changes: 16 additions & 16 deletions RetailCoder.VBE/UI/ToDoItems/ToDoExplorerControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:resx="clr-namespace:Rubberduck.UI"
xmlns:toDoItems="clr-namespace:Rubberduck.UI.ToDoItems"
xmlns:themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2"
xmlns:groupingGrid="clr-namespace:Rubberduck.UI.Controls.GroupingGrid"
x:Class="Rubberduck.UI.ToDoItems.ToDoExplorerControl"
xmlns:controls="clr-namespace:Rubberduck.Controls"
xmlns:themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2" x:Class="Rubberduck.UI.ToDoItems.ToDoExplorerControl"
Language="{UICulture}"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance {x:Type toDoItems:ToDoExplorerViewModel}, IsDesignTimeCreatable=False}">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVisibility"/>

<BitmapImage x:Key="RefreshImage" UriSource="../../Resources/arrow-circle-double.png" />
<BitmapImage x:Key="DeleteImage" UriSource="../../Resources/cross-script.png" />

Expand Down Expand Up @@ -241,11 +241,11 @@
<DockPanel LastChildFill="True">
<ToolBarTray DockPanel.Dock="Top" IsLocked="True">
<ToolBar Style="{DynamicResource ToolBarWithOverflowOnlyShowingWhenNeededStyle}">
<Button ToolTip="{x:Static resx:RubberduckUI.Refresh}" Command="{Binding RefreshCommand, Mode=OneWay}" BorderThickness="0" Background="Transparent">
<Button ToolTip="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=Refresh}" Command="{Binding RefreshCommand, Mode=OneWay}" BorderThickness="0" Background="Transparent">
<Image Source="{StaticResource RefreshImage}" />
</Button>
<Separator />
<Button ToolTip="{x:Static resx:RubberduckUI.Remove}" Command="{Binding Remove}" BorderThickness="0" Background="Transparent">
<Button ToolTip="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=Remove}" Command="{Binding Remove}" BorderThickness="0" Background="Transparent">
<Image Source="{StaticResource DeleteImage}" />
</Button>
</ToolBar>
Expand All @@ -262,14 +262,14 @@
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
</Style>
</groupingGrid:GroupingGrid.CellStyle>
<groupingGrid:GroupingGrid.Columns>
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.Priority}" Binding="{Binding Priority}" />
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.TodoExplorer_Description}" Binding="{Binding Description}" Width="*"/>
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.ProjectName}" Binding="{Binding ProjectName}" />
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.ModuleName}" Binding="{Binding ModuleName}" />
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.TodoExplorer_LineNumber}" Binding="{Binding LineNumber}" />
</groupingGrid:GroupingGrid.Columns>
</groupingGrid:GroupingGrid>
</controls:GroupingGrid.CellStyle>
<controls:GroupingGrid.Columns>
<DataGridTextColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=Priority}" Binding="{Binding Priority}" />
<DataGridTextColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TodoExplorer_Description}" Binding="{Binding Description}" Width="*"/>
<DataGridTextColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=ProjectName}" Binding="{Binding ProjectName}" />
<DataGridTextColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=ModuleName}" Binding="{Binding ModuleName}" />
<DataGridTextColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TodoExplorer_LineNumber}" Binding="{Binding LineNumber}" />
</controls:GroupingGrid.Columns>
</controls:GroupingGrid>
</DockPanel>
</UserControl>
</UserControl>
23 changes: 12 additions & 11 deletions RetailCoder.VBE/UI/UnitTesting/TestExplorerControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
xmlns:unitTesting="clr-namespace:Rubberduck.UnitTesting"
xmlns:resx="clr-namespace:Rubberduck.UI"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
Language="{UICulture}"
mc:Ignorable="d"
d:DesignHeight="255" d:DesignWidth="255"
MinWidth="255" MinHeight="255" d:DataContext="{d:DesignInstance local:TestExplorerViewModel}">
Expand Down Expand Up @@ -119,52 +120,52 @@
<Separator />

<Menu>
<MenuItem VerticalAlignment="Center" Header="{x:Static resx:RubberduckUI.Run}">
<MenuItem VerticalAlignment="Center" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=RubberduckUI.Run}">
<MenuItem.Icon>
<Image Height="16" Source="../../Resources/control.png" />
</MenuItem.Icon>
<MenuItem Command="{Binding RunAllTestsCommand}" Header="{x:Static resx:RubberduckUI.TestExplorer_RunAllTests}">
<MenuItem Command="{Binding RunAllTestsCommand}" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_RunAllTests}">
<MenuItem.Icon>
<Image Height="16" Source="../../Resources/flask--arrow.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Command="{Binding RunNotExecutedTestsCommand}" Header="{x:Static resx:RubberduckUI.TestExplorer_RunNotRunTests}" >
<MenuItem Command="{Binding RunNotExecutedTestsCommand}" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_RunNotRunTests}" >
<MenuItem.Icon>
<Image Height="16" Source="../../Resources/question-white.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="{Binding RunPassedTestsCommand}" Header="{x:Static resx:RubberduckUI.TestExplorer_RunPassedTests}" >
<MenuItem Command="{Binding RunPassedTestsCommand}" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_RunPassedTests}" >
<MenuItem.Icon>
<Image Height="16" Source="../../Resources/tick-circle.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="{Binding RunFailedTestsCommand}" Header="{x:Static resx:RubberduckUI.TestExplorer_RunFailedTests}">
<MenuItem Command="{Binding RunFailedTestsCommand}" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_RunFailedTests}">
<MenuItem.Icon>
<Image Height="16" Source="../../Resources/cross-circle.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Command="{Binding RepeatLastRunCommand}" Header="{x:Static resx:RubberduckUI.TestExplorer_RunLastRunTests}">
<MenuItem Command="{Binding RepeatLastRunCommand}" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_RunLastRunTests}">
<MenuItem.Icon>
<Image Height="16" Source="../../Resources/arrow-repeat.png" />
</MenuItem.Icon>
</MenuItem>

</MenuItem>
<MenuItem VerticalAlignment="Center" Header="{x:Static resx:RubberduckUI.Add}">
<MenuItem VerticalAlignment="Center" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=Add}">
<MenuItem.Icon>
<Image Height="16" Source="../../Resources/flask--plus.png" />
</MenuItem.Icon>
<MenuItem Command="{Binding AddTestModuleCommand}" Header="{x:Static resx:RubberduckUI.TestExplorer_AddTestModule}">
<MenuItem Command="{Binding AddTestModuleCommand}" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_AddTestModule}">
</MenuItem>
<Separator />
<MenuItem Command="{Binding AddTestMethodCommand}" Header="{x:Static resx:RubberduckUI.TestExplorer_AddTestMethod}">
<MenuItem Command="{Binding AddTestMethodCommand}" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_AddTestMethod}">
<MenuItem.Icon>
<Image Height="16" Source="../../Resources/flask.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="{Binding AddErrorTestMethodCommand}" Header="{x:Static resx:RubberduckUI.TestExplorer_AddExpectedErrorTestMethod}">
<MenuItem Command="{Binding AddErrorTestMethodCommand}" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_AddExpectedErrorTestMethod}">
<MenuItem.Icon>
<Image Height="16" Source="../../Resources/flask--exclamation.png" />
</MenuItem.Icon>
Expand Down Expand Up @@ -209,7 +210,7 @@
<TreeView.ContextMenu>
<ContextMenu>
<MenuItem VerticalAlignment="Center"
Header="{x:Static resx:RubberduckUI.Run}"
Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=Run}"
Command="{Binding RunSelectedTestCommand}"
IsEnabled="{Binding Model.IsReady, Mode=OneWay}">
<MenuItem.Icon>
Expand Down
2 changes: 0 additions & 2 deletions RetailCoder.VBE/UnitTesting/ProjectTestExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public static void RunMethodsWithAttribute<TAttribute>(this VBComponent componen

public static IEnumerable<TestMethod> TestMethods(this VBProject project)
{
var hostApp = project.VBE.HostApplication();

var result = project.VBComponents
.Cast<VBComponent>()
Expand All @@ -50,7 +49,6 @@ public static IEnumerable<TestMethod> TestMethods(this VBProject project)

public static IEnumerable<TestMethod> TestMethods(this VBComponent component)
{
var hostApp = component.VBE.HostApplication();

if (component.Type == vbext_ComponentType.vbext_ct_StdModule
&& component.CodeModule.HasAttribute<TestModuleAttribute>())
Expand Down
1 change: 1 addition & 0 deletions Rubberduck.Parsing/VBA/RubberduckParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ private void ParseParallel()
try
{
var components = _vbe.VBProjects.Cast<VBProject>()
.Where(project => project.Protection == vbext_ProjectProtection.vbext_pp_none)
.SelectMany(project => project.VBComponents.Cast<VBComponent>())
.ToList();

Expand Down

0 comments on commit 9eeae14

Please sign in to comment.