Skip to content

Commit ae392e0

Browse files
committed
Revert ninject commits per Mat's request.
1 parent f61e9ed commit ae392e0

File tree

16 files changed

+37
-97
lines changed

16 files changed

+37
-97
lines changed

RetailCoder.VBE/App.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ public class App : IDisposable
2020
private readonly VBE _vbe;
2121
private readonly AddIn _addIn;
2222
private Inspector _inspector;
23-
private IParserErrorsPresenter _parserErrorsPresenter;
24-
private readonly IConfigurationLoader _configService = new ConfigurationLoader();
25-
private readonly IActiveCodePaneEditor _editor;
23+
private ParserErrorsPresenter _parserErrorsPresenter;
24+
private readonly IGeneralConfigService _configService = new ConfigurationLoader();
25+
private readonly ActiveCodePaneEditor _editor;
2626
private readonly IRubberduckCodePaneFactory _factory;
27-
private readonly IRubberduckParser _parser;
27+
private IRubberduckParser _parser;
2828

2929
private Configuration _config;
3030
private RubberduckMenu _menu;
@@ -33,21 +33,16 @@ public class App : IDisposable
3333
private bool _displayToolbar = false;
3434
private Point _toolbarCoords = new Point(-1, -1);
3535

36-
public App(VBE vbe, AddIn addIn, IParserErrorsPresenter presenter, IRubberduckParser parser, IRubberduckCodePaneFactory factory, IActiveCodePaneEditor editor)
36+
public App(VBE vbe, AddIn addIn)
3737
{
3838
_vbe = vbe;
3939
_addIn = addIn;
40-
_factory = factory;
41-
_parser = parser;
40+
_factory = new RubberduckCodePaneFactory();
4241

43-
_parserErrorsPresenter = presenter;
42+
_parserErrorsPresenter = new ParserErrorsPresenter(vbe, addIn);
4443
_configService.SettingsChanged += _configService_SettingsChanged;
4544

46-
// todo: figure out why Ninject can't seem to resolve the VBE dependency to ActiveCodePaneEditor if it's in the VBEDitor assembly.
47-
// could it be that the VBE type in the two assemblies is actually different?
48-
// aren't the two assemblies using the exact same Microsoft.Vbe.Interop assemby?
49-
50-
_editor = editor; // */ new ActiveCodePaneEditor(vbe, _factory);
45+
_editor = new ActiveCodePaneEditor(vbe, _factory);
5146

5247
LoadConfig();
5348

@@ -84,7 +79,7 @@ private void LoadConfig()
8479

8580
private void Setup()
8681
{
87-
//_parser = new RubberduckParser(_factory);
82+
_parser = new RubberduckParser(_factory);
8883
_parser.ParseStarted += _parser_ParseStarted;
8984
_parser.ParserError += _parser_ParserError;
9085

@@ -155,6 +150,11 @@ private void CleanUp()
155150
_inspector.Dispose();
156151
}
157152

153+
if (_parserErrorsPresenter != null)
154+
{
155+
_parserErrorsPresenter.Dispose();
156+
}
157+
158158
if (_parser != null)
159159
{
160160
_parser.ParseStarted -= _parser_ParseStarted;

RetailCoder.VBE/Extension.cs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
using System;
22
using System.ComponentModel;
33
using System.Runtime.InteropServices;
4-
using System.Threading.Tasks;
54
using System.Windows.Forms;
65
using Extensibility;
76
using Microsoft.Vbe.Interop;
8-
using Ninject;
9-
using Rubberduck.Root;
107
using Rubberduck.UI;
8+
using Rubberduck.VBEditor.VBEInterfaces.RubberduckCodePane;
119

1210
namespace Rubberduck
1311
{
@@ -22,7 +20,6 @@ public class _Extension : IDTExtensibility2, IDisposable
2220
private const string ProgId = "Rubberduck.Extension";
2321

2422
private App _app;
25-
private IKernel _kernel;
2623

2724
public void OnAddInsUpdate(ref Array custom)
2825
{
@@ -36,23 +33,14 @@ public void OnConnection(object Application, ext_ConnectMode ConnectMode, object
3633
{
3734
try
3835
{
39-
_kernel = new StandardKernel();
40-
Compose((VBE) Application, (AddIn) AddInInst);
36+
_app = new App((VBE)Application, (AddIn)AddInInst);
4137
}
4238
catch (Exception exception)
4339
{
4440
MessageBox.Show(exception.Message, RubberduckUI.RubberduckLoadFailure, MessageBoxButtons.OK, MessageBoxIcon.Error);
4541
}
4642
}
4743

48-
private void Compose(VBE application, AddIn addin)
49-
{
50-
var conventions = new RubberduckConventions(_kernel);
51-
conventions.Apply(application, addin);
52-
53-
_app = _kernel.Get<App>();
54-
}
55-
5644
public void OnStartupComplete(ref Array custom)
5745
{
5846

@@ -70,9 +58,9 @@ public void Dispose()
7058

7159
protected virtual void Dispose(bool disposing)
7260
{
73-
if (disposing & _kernel != null)
61+
if (disposing & _app != null)
7462
{
75-
_kernel.Dispose();
63+
_app.Dispose();
7664
}
7765
}
7866
}

RetailCoder.VBE/Inspections/Inspector.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ namespace Rubberduck.Inspections
1313
public class Inspector : IInspector, IDisposable
1414
{
1515
private readonly IRubberduckParser _parser;
16-
private readonly IConfigurationLoader _configService;
16+
private readonly IGeneralConfigService _configService;
1717
private readonly IList<IInspection> _inspections;
1818

19-
public Inspector(IRubberduckParser parser, IConfigurationLoader configService)
19+
public Inspector(IRubberduckParser parser, IGeneralConfigService configService)
2020
{
2121
_parser = parser;
2222
_parser.ParseStarted += _parser_ParseStarted;

RetailCoder.VBE/Root/RubberduckConventions.cs

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

RetailCoder.VBE/Rubberduck.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,6 @@
214214
<HintPath>..\packages\Ninject.3.2.2.0\lib\net45-full\Ninject.dll</HintPath>
215215
<Private>True</Private>
216216
</Reference>
217-
<Reference Include="Ninject.Extensions.Conventions">
218-
<HintPath>..\packages\Ninject.Extensions.Conventions.3.2.0.0\lib\net45-full\Ninject.Extensions.Conventions.dll</HintPath>
219-
</Reference>
220217
<Reference Include="Office, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
221218
<SpecificVersion>False</SpecificVersion>
222219
<EmbedInteropTypes>True</EmbedInteropTypes>
@@ -252,7 +249,6 @@
252249
<Compile Include="Refactorings\ReorderParameters\ReorderParametersPresenter.cs" />
253250
<Compile Include="Refactorings\ReorderParameters\ReorderParametersPresenterFactory.cs" />
254251
<Compile Include="Refactorings\ReorderParameters\ReorderParametersRefactoring.cs" />
255-
<Compile Include="Root\RubberduckConventions.cs" />
256252
<Compile Include="Settings\DisplayLanguageSetting.cs" />
257253
<Compile Include="Settings\SourceControlConfiguration.cs" />
258254
<Compile Include="Settings\SourceControlConfigurationService.cs" />

RetailCoder.VBE/Settings/ConfigurationLoader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111

1212
namespace Rubberduck.Settings
1313
{
14-
public interface IConfigurationLoader : IConfigurationService<Configuration>
14+
public interface IGeneralConfigService : IConfigurationService<Configuration>
1515
{
1616
CodeInspectionSetting[] GetDefaultCodeInspections();
1717
Configuration GetDefaultConfiguration();
1818
ToDoMarker[] GetDefaultTodoMarkers();
1919
IList<IInspection> GetImplementedCodeInspections();
2020
}
2121

22-
public class ConfigurationLoader : XmlConfigurationServiceBase<Configuration>, IConfigurationLoader
22+
public class ConfigurationLoader : XmlConfigurationServiceBase<Configuration>, IGeneralConfigService
2323
{
2424
protected override string ConfigFile
2525
{

RetailCoder.VBE/UI/ParserErrors/ParserErrorsPresenter.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,7 @@ public override string ToString()
3535
}
3636
}
3737

38-
public interface IParserErrorsPresenter
39-
{
40-
void Show();
41-
void Clear();
42-
void AddError(ParseErrorEventArgs error);
43-
}
44-
45-
public class ParserErrorsPresenter : DockablePresenterBase, IParserErrorsPresenter
38+
public class ParserErrorsPresenter : DockablePresenterBase
4639
{
4740
public ParserErrorsPresenter(VBE vbe, AddIn addin)
4841
: base(vbe, addin, new SimpleListControl(RubberduckUI.ParseErrors_Caption))

RetailCoder.VBE/UI/RubberduckMenu.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ internal class RubberduckMenu : Menu
2828
private readonly CodeExplorerMenu _codeExplorerMenu;
2929
private readonly CodeInspectionsMenu _codeInspectionsMenu;
3030
private readonly RefactorMenu _refactorMenu;
31-
private readonly IConfigurationLoader _configService;
31+
private readonly IGeneralConfigService _configService;
3232
private readonly IRubberduckParser _parser;
3333
private readonly IActiveCodePaneEditor _editor;
3434
private readonly IRubberduckCodePaneFactory _factory;
@@ -40,7 +40,7 @@ internal class RubberduckMenu : Menu
4040

4141
private ProjectExplorerContextMenu _projectExplorerContextMenu;
4242

43-
public RubberduckMenu(VBE vbe, AddIn addIn, IConfigurationLoader configService, IRubberduckParser parser, IActiveCodePaneEditor editor, IInspector inspector, IRubberduckCodePaneFactory factory)
43+
public RubberduckMenu(VBE vbe, AddIn addIn, IGeneralConfigService configService, IRubberduckParser parser, IActiveCodePaneEditor editor, IInspector inspector, IRubberduckCodePaneFactory factory)
4444
: base(vbe, addIn)
4545
{
4646
_addIn = addIn;

RetailCoder.VBE/UI/Settings/GeneralSettingsControl.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ namespace Rubberduck.UI.Settings
66
{
77
public partial class GeneralSettingsControl : UserControl
88
{
9+
private readonly IGeneralConfigService _configService;
10+
private readonly DisplayLanguageSetting _currentLanguage;
11+
912
public GeneralSettingsControl()
1013
{
1114
InitializeComponent();
@@ -15,9 +18,11 @@ public GeneralSettingsControl()
1518
LoadLanguageList();
1619
}
1720

18-
public GeneralSettingsControl(DisplayLanguageSetting displayLanguage)
21+
public GeneralSettingsControl(DisplayLanguageSetting displayLanguage, IGeneralConfigService configService)
1922
: this()
2023
{
24+
_configService = configService;
25+
_currentLanguage = displayLanguage;
2126
LanguageList.SelectedItem = displayLanguage;
2227
}
2328

@@ -36,7 +41,6 @@ private void LoadLanguageList()
3641
new DisplayLanguageSetting("de-DE"),
3742
};
3843

39-
// ReSharper disable once CoVariantArrayConversion
4044
LanguageList.Items.AddRange(settings.Where(item => item.Exists).ToArray());
4145
LanguageList.DisplayMember = "Name";
4246
}

RetailCoder.VBE/UI/Settings/SettingsDialog.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public partial class _SettingsDialog : Form
1818
private const string ProgId = "Rubberduck.UI.Settings.SettingsDialog";
1919

2020
private Configuration _config;
21-
private IConfigurationLoader _configService;
21+
private IGeneralConfigService _configService;
2222
private ConfigurationTreeViewControl _treeview;
2323
private Control _activeControl;
2424

@@ -85,7 +85,7 @@ private void OkButton_Click(object sender, EventArgs e)
8585
Close();
8686
}
8787

88-
public _SettingsDialog(IConfigurationLoader configService)
88+
public _SettingsDialog(IGeneralConfigService configService)
8989
: this()
9090
{
9191
_configService = configService;
@@ -105,7 +105,7 @@ private void LoadWindow()
105105
splitContainer1.Panel1.Controls.Add(_treeview);
106106
_treeview.Dock = DockStyle.Fill;
107107

108-
_generalSettingsView = new GeneralSettingsControl(_config.UserSettings.LanguageSetting);
108+
_generalSettingsView = new GeneralSettingsControl(_config.UserSettings.LanguageSetting, _configService);
109109

110110
var markers = _config.UserSettings.ToDoListSettings.ToDoMarkers;
111111
var gridViewSort = new GridViewSort<ToDoMarker>("Priority", true);

0 commit comments

Comments
 (0)