Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1144 from rubberduck-vba/CodeExplorer
merge latest changes
- Loading branch information
Showing
26 changed files
with
379 additions
and
369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
|
||
namespace Rubberduck.Common.Dispatch | ||
{ | ||
public class DispatcherEventArgs<T> : EventArgs | ||
where T : class | ||
{ | ||
private readonly T _item; | ||
|
||
public DispatcherEventArgs(T item) | ||
{ | ||
_item = item; | ||
} | ||
|
||
public T Item { get { return _item; } } | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
RetailCoder.VBE/Common/Dispatch/DispatcherRenamedEventArgs.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace Rubberduck.Common.Dispatch | ||
{ | ||
public class DispatcherRenamedEventArgs<T> : DispatcherEventArgs<T> | ||
where T : class | ||
{ | ||
private readonly string _oldName; | ||
|
||
public DispatcherRenamedEventArgs(T item, string oldName) | ||
: base(item) | ||
{ | ||
_oldName = oldName; | ||
} | ||
|
||
public string OldName { get { return _oldName; } } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using Microsoft.Vbe.Interop; | ||
|
||
namespace Rubberduck.Common.Dispatch | ||
{ | ||
public class ReferencesEventsSink : _dispReferencesEvents | ||
{ | ||
public event EventHandler<DispatcherEventArgs<Reference>> ReferenceAdded; | ||
public void ItemAdded(Reference Reference) | ||
{ | ||
OnDispatch(ReferenceAdded, Reference); | ||
} | ||
|
||
public event EventHandler<DispatcherEventArgs<Reference>> ReferenceRemoved; | ||
public void ItemRemoved(Reference Reference) | ||
{ | ||
OnDispatch(ReferenceRemoved, Reference); | ||
} | ||
|
||
private void OnDispatch(EventHandler<DispatcherEventArgs<Reference>> dispatched, Reference reference) | ||
{ | ||
var handler = dispatched; | ||
if (handler != null) | ||
{ | ||
handler.Invoke(this, new DispatcherEventArgs<Reference>(reference)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System; | ||
using Microsoft.Vbe.Interop; | ||
|
||
namespace Rubberduck.Common.Dispatch | ||
{ | ||
public class VBComponentsEventsSink : _dispVBComponentsEvents | ||
{ | ||
public event EventHandler<DispatcherEventArgs<VBComponent>> ComponentAdded; | ||
public void ItemAdded(VBComponent VBComponent) | ||
{ | ||
OnDispatch(ComponentAdded, VBComponent); | ||
} | ||
|
||
public event EventHandler<DispatcherEventArgs<VBComponent>> ComponentRemoved; | ||
public void ItemRemoved(VBComponent VBComponent) | ||
{ | ||
OnDispatch(ComponentRemoved, VBComponent); | ||
} | ||
|
||
public event EventHandler<DispatcherRenamedEventArgs<VBComponent>> ComponentRenamed; | ||
public void ItemRenamed(VBComponent VBComponent, string OldName) | ||
{ | ||
var handler = ComponentRenamed; | ||
if (handler != null) | ||
{ | ||
handler.Invoke(this, new DispatcherRenamedEventArgs<VBComponent>(VBComponent, OldName)); | ||
} | ||
} | ||
|
||
public event EventHandler<DispatcherEventArgs<VBComponent>> ComponentSelected; | ||
public void ItemSelected(VBComponent VBComponent) | ||
{ | ||
OnDispatch(ComponentSelected, VBComponent); | ||
} | ||
|
||
public event EventHandler<DispatcherEventArgs<VBComponent>> ComponentActivated; | ||
public void ItemActivated(VBComponent VBComponent) | ||
{ | ||
OnDispatch(ComponentActivated, VBComponent); | ||
} | ||
|
||
public event EventHandler<DispatcherEventArgs<VBComponent>> ComponentReloaded; | ||
public void ItemReloaded(VBComponent VBComponent) | ||
{ | ||
OnDispatch(ComponentReloaded, VBComponent); | ||
} | ||
|
||
private void OnDispatch(EventHandler<DispatcherEventArgs<VBComponent>> dispatched, VBComponent component) | ||
{ | ||
var handler = dispatched; | ||
if (handler != null) | ||
{ | ||
handler.Invoke(this, new DispatcherEventArgs<VBComponent>(component)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using Microsoft.Vbe.Interop; | ||
|
||
namespace Rubberduck.Common.Dispatch | ||
{ | ||
public class VBProjectsEventsSink : _dispVBProjectsEvents | ||
{ | ||
public event EventHandler<DispatcherEventArgs<VBProject>> ProjectAdded; | ||
public void ItemAdded(VBProject VBProject) | ||
{ | ||
OnDispatch(ProjectAdded, VBProject); | ||
} | ||
|
||
public event EventHandler<DispatcherEventArgs<VBProject>> ProjectRemoved; | ||
public void ItemRemoved(VBProject VBProject) | ||
{ | ||
OnDispatch(ProjectRemoved, VBProject); | ||
} | ||
|
||
public event EventHandler<DispatcherRenamedEventArgs<VBProject>> ProjectRenamed; | ||
public void ItemRenamed(VBProject VBProject, string OldName) | ||
{ | ||
var handler = ProjectRenamed; | ||
if (handler != null) | ||
{ | ||
handler.Invoke(this, new DispatcherRenamedEventArgs<VBProject>(VBProject, OldName)); | ||
} | ||
} | ||
|
||
public event EventHandler<DispatcherEventArgs<VBProject>> ProjectActivated; | ||
public void ItemActivated(VBProject VBProject) | ||
{ | ||
OnDispatch(ProjectActivated, VBProject); | ||
} | ||
|
||
private void OnDispatch(EventHandler<DispatcherEventArgs<VBProject>> dispatched, VBProject project) | ||
{ | ||
var handler = dispatched; | ||
if (handler != null) | ||
{ | ||
handler.Invoke(this, new DispatcherEventArgs<VBProject>(project)); | ||
} | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
RetailCoder.VBE/Common/Dispatch/VBProjectsEventsWrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Rubberduck.Common.Dispatch | ||
{ | ||
public class VBProjectsEventsWrapper | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.