-
-
Notifications
You must be signed in to change notification settings - Fork 44
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 #340 from reduckted/feature/tool-window-pane-aware
Allowed a tool window or its content to get access to the ToolWindowPane
- Loading branch information
Showing
8 changed files
with
104 additions
and
3 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
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
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
22 changes: 22 additions & 0 deletions
22
src/toolkit/Community.VisualStudio.Toolkit.Shared/Windows/IToolWindowPaneAware.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,22 @@ | ||
using Microsoft.VisualStudio.Shell; | ||
|
||
namespace Community.VisualStudio.Toolkit | ||
{ | ||
/// <summary> | ||
/// Allows the content of a <see cref="ToolWindowPane"/> to be aware of its owning <see cref="ToolWindowPane"/> object. | ||
/// <para> | ||
/// Implement this interface on your tool window's content (the object you return from | ||
/// <see cref="BaseToolWindow{T}.CreateAsync(int, System.Threading.CancellationToken)"/>) | ||
/// if you need the content object to have access to its <see cref="ToolWindowPane"/>. | ||
/// </para> | ||
/// </summary> | ||
public interface IToolWindowPaneAware | ||
{ | ||
/// <summary> | ||
/// Called when the <see cref="ToolWindowPane"/> has been initialized and "sited". | ||
/// The pane's service provider can be used from this point onwards. | ||
/// </summary> | ||
/// <param name="pane">The tool window pane that was created.</param> | ||
void SetPane(ToolWindowPane pane); | ||
} | ||
} |
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
25 changes: 25 additions & 0 deletions
25
src/toolkit/Community.VisualStudio.Toolkit.Shared/Windows/ToolkitToolWindowPane.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,25 @@ | ||
using System; | ||
using Microsoft.VisualStudio.Shell; | ||
|
||
namespace Community.VisualStudio.Toolkit | ||
{ | ||
/// <summary> | ||
/// An implementation of <see cref="ToolWindowPane"/> that allows the | ||
/// </summary> | ||
public abstract class ToolkitToolWindowPane : ToolWindowPane | ||
{ | ||
private bool _isInitialized; | ||
|
||
/// <inheritdoc/> | ||
protected override void Initialize() | ||
{ | ||
base.Initialize(); | ||
_isInitialized = true; | ||
Initialized?.Invoke(this, EventArgs.Empty); | ||
} | ||
|
||
internal bool IsInitialized => _isInitialized; | ||
|
||
internal event EventHandler? Initialized; | ||
} | ||
} |