Skip to content

Commit

Permalink
Revert "implemented OptionsCommand"
Browse files Browse the repository at this point in the history
This reverts commit dbcd406.
  • Loading branch information
retailcoder committed Aug 5, 2015
1 parent 6332045 commit 6df055a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 57 deletions.
4 changes: 4 additions & 0 deletions RetailCoder.VBE/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class App : IDisposable
private readonly IInspectorFactory _inspectorFactory;
private IParserErrorsPresenter _parserErrorsPresenter;
private readonly IGeneralConfigService _configService;
//private readonly IMenu _integratedUserInterface;
private readonly IRubberduckMenuFactory _menuFactory;

private IRubberduckParser _parser;
Expand All @@ -33,6 +34,7 @@ public class App : IDisposable
IGeneralConfigService configService)
{
_messageBox = messageBox;
//_integratedUserInterface = integratedUserInterface;
_menuFactory = menuFactory;
_parserErrorsPresenterFactory = parserErrorsPresenterFactory;
_parserFactory = parserFactory;
Expand Down Expand Up @@ -87,6 +89,7 @@ private void Setup()

_menu = _menuFactory.Create();
_menu.Initialize();
//_integratedUserInterface.Initialize();
}

private void _parser_ParseStarted(object sender, ParseStartedEventArgs e)
Expand Down Expand Up @@ -114,6 +117,7 @@ protected virtual void Dispose(bool disposing)

private void CleanUp()
{
//_integratedUserInterface.TearDown();
var menu = _menu as IDisposable;
if (menu != null)
{
Expand Down
1 change: 0 additions & 1 deletion RetailCoder.VBE/Rubberduck.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@
<Compile Include="Inspections\IdentifierNotUsedInspectionResult.cs" />
<Compile Include="Inspections\VariableNotAssignedInspection.cs" />
<Compile Include="Inspections\IdentifierNotAssignedInspectionResult.cs" />
<Compile Include="UI\Commands\OptionsCommand.cs" />
<Compile Include="UI\Commands\ParentMenuNotFoundException.cs" />
<Compile Include="UI\Commands\RubberduckCommandBase.cs" />
<Compile Include="UI\Commands\ToolbarState.cs" />
Expand Down
1 change: 1 addition & 0 deletions RetailCoder.VBE/UI/Commands/AboutCommand.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Linq;
using Microsoft.Office.Core;
using Microsoft.Vbe.Interop;
Expand Down
43 changes: 0 additions & 43 deletions RetailCoder.VBE/UI/Commands/OptionsCommand.cs

This file was deleted.

11 changes: 2 additions & 9 deletions RetailCoder.VBE/UI/Commands/RubberduckMenuCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,8 @@ public void Release()
foreach (var button in _buttons)
{
button.Click -= button_Click;
try
{
button.Delete();
Marshal.ReleaseComObject(button);
}
catch (COMException)
{
// just let it be
}
button.Delete();
Marshal.ReleaseComObject(button);
}

_buttons.Clear();
Expand Down
20 changes: 16 additions & 4 deletions RetailCoder.VBE/UI/RubberduckMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ public class RubberduckMenu : Menu, IMenu
private readonly CodeExplorerMenu _codeExplorerMenu;
private readonly CodeInspectionsMenu _codeInspectionsMenu;
private readonly RefactorMenu _refactorMenu;
private readonly IGeneralConfigService _configService;
private readonly IRubberduckParser _parser;
private readonly IActiveCodePaneEditor _editor;
private readonly ICodePaneWrapperFactory _wrapperFactory;
private readonly AddIn _addIn;

private readonly RubberduckCommandBase _aboutCommand;
private readonly RubberduckCommandBase _optionsCommand;

private CommandBarButton _about;
private CommandBarButton _settings;
private CommandBarButton _sourceControl;

private ProjectExplorerContextMenu _projectExplorerContextMenu;
Expand All @@ -60,12 +62,12 @@ public class RubberduckMenu : Menu, IMenu
: base(vbe, addIn)
{
_aboutCommand = new AboutCommand(new RubberduckMenuCommand(), vbe);
_optionsCommand = new OptionsCommand(new RubberduckMenuCommand(), vbe, configService);

_addIn = addIn;
_parser = parser;
_editor = editor;
_wrapperFactory = wrapperFactory;
_configService = configService;

var testExplorer = new TestExplorerWindow();
var testEngine = new TestEngine();
Expand Down Expand Up @@ -143,8 +145,8 @@ public void Initialize()
_codeInspectionsMenu.Initialize(_menu);

_sourceControl = AddButton(_menu, RubberduckUI.RubberduckMenu_SourceControl, false, OnSourceControlClick);
_settings = AddButton(_menu, RubberduckUI.RubberduckMenu_Options, true, OnOptionsClick);

_optionsCommand.Initialize();
_aboutCommand.Initialize();

_projectExplorerContextMenu = new ProjectExplorerContextMenu(IDE, _addIn, _parser, _editor, _wrapperFactory);
Expand Down Expand Up @@ -172,6 +174,16 @@ private void OnSourceControlClick(CommandBarButton Ctrl, ref bool CancelDefault)
_sourceControlPresenter.Show();
}

//I'm not the one with the bad name, MS is. Signature must match delegate definition.
[SuppressMessage("ReSharper", "InconsistentNaming")]
private void OnOptionsClick(CommandBarButton Ctrl, ref bool CancelDefault)
{
using (var window = new _SettingsDialog(_configService))
{
window.ShowDialog();
}
}

private bool _disposed;
private CommandBarPopup _menu;

Expand Down Expand Up @@ -213,8 +225,8 @@ protected override void Dispose(bool disposing)
}

_aboutCommand.Release();
_optionsCommand.Release();

_settings.Click -= OnOptionsClick;
_sourceControl.Click -= OnSourceControlClick;

var menuBarControls = IDE.CommandBars[1].Controls;
Expand Down

0 comments on commit 6df055a

Please sign in to comment.