Class ToolPlugIn
Base class for a plug in that provides basic utility functionality.
Implements
Inherited Members
Namespace: Gorgon.Editor.PlugIns
Assembly: Gorgon.Editor.API.dll
Syntax
public abstract class ToolPlugIn : EditorPlugIn, IGorgonNamedObject
Remarks
Tool plug ins, unlike content plug ins, are independent plug ins that provide their own UI (if necessary) that do various jobs in the editor. They will be placed into a tab on the ribbon called "Tools" and provide global functionality across the editor and don't necessarily have to restrict themselves to one type of content.
A typical use of a tool plug in would be to display a dialog that allows mass actions on content files. For example, a dialog that sequentially renames a list of content files so that they're postfixed with "original_name (number)" would be a use case for a tool plug in.
Because these plug ins are independent, there is no interaction with the editor UI beyond providing information to display a button on the ribbon.
Constructors
| Edit this page View SourceToolPlugIn(string)
Initializes a new instance of the ToolPlugIn class.
Declaration
protected ToolPlugIn(string description)
Parameters
Type | Name | Description |
---|---|---|
string | description | Optional description of the plugin. |
Properties
| Edit this page View SourceContentFileManager
Property to return the manager used to manage files in the project file system.
Declaration
protected IContentFileManager ContentFileManager { get; }
Property Value
Type | Description |
---|---|
IContentFileManager |
Remarks
Plug ins can use this to create their own directories and files within the confines of project file system.
HostToolServices
Property to return the services from the host application.
Declaration
protected IHostContentServices HostToolServices { get; }
Property Value
Type | Description |
---|---|
IHostContentServices |
Remarks
Plug in developers that implement a common plug in type based on this base type, should assign this value to allow access to the common tool services supplied by the host application.
This will be assigned during the initialization of the plug in.
See Also
| Edit this page View SourcePlugInType
Property to return the type of this plug in.
Declaration
public override sealed PlugInType PlugInType { get; }
Property Value
Type | Description |
---|---|
PlugInType |
Overrides
| Edit this page View SourceTemporaryFileSystem
Property to return the file system used to hold temporary file data.
Declaration
protected IGorgonFileSystemWriter<Stream> TemporaryFileSystem { get; }
Property Value
Type | Description |
---|---|
IGorgonFileSystemWriter<Stream> |
Remarks
Importer plug ins can use this to write temporary working data, which is deleted after the project unloads, for use during the import process.
Methods
| Edit this page View SourceGetToolButton()
Function to retrieve the ribbon button for the tool.
Declaration
public IToolPlugInRibbonButton GetToolButton()
Returns
Type | Description |
---|---|
IToolPlugInRibbonButton | A new tool ribbon button instance. |
Remarks
This will return data to describe a new button for the tool in the plug in. If the return value is null, then the tool will not be available on the ribbon.
Initialize(IHostContentServices)
Function to perform any required initialization for the plugin.
Declaration
public void Initialize(IHostContentServices hostServices)
Parameters
Type | Name | Description |
---|---|---|
IHostContentServices | hostServices | The services from the host application. |
Remarks
This method is only called when the plugin is loaded at startup.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
OnGetToolButton()
Function to retrieve the ribbon button for the tool.
Declaration
protected abstract IToolPlugInRibbonButton OnGetToolButton()
Returns
Type | Description |
---|---|
IToolPlugInRibbonButton | A new tool ribbon button instance. |
Remarks
Tool plug in developers must override this method to return the button which is inserted on the application ribbon, under the "Tools" tab. If the method returns null, then the tool is ignored.
The resulting data structure will contain the means to handle the click event for the tool, and as such, is the only means of communication between the main UI and the plug in.
OnInitialize()
Function to provide initialization for the plugin.
Declaration
protected virtual void OnInitialize()
Remarks
This method is only called when the plugin is loaded at startup.
OnProjectClosed()
Function to allow custom plug ins to implement custom actions when a project is closed.
Declaration
protected virtual void OnProjectClosed()
OnProjectOpened()
Function to allow custom plug ins to implement custom actions when a project is created/opened.
Declaration
protected virtual void OnProjectOpened()
OnShutdown()
Function to provide clean up for the plugin.
Declaration
protected virtual void OnShutdown()
ProjectClosed()
Function called when a project is unloaded.
Declaration
public void ProjectClosed()
ProjectOpened(IContentFileManager, IGorgonFileSystemWriter<Stream>)
Function called when a project is loaded/created.
Declaration
public void ProjectOpened(IContentFileManager fileManager, IGorgonFileSystemWriter<Stream> tempFileSystem)
Parameters
Type | Name | Description |
---|---|---|
IContentFileManager | fileManager | The file manager for the project file system. |
IGorgonFileSystemWriter<Stream> | tempFileSystem | The file system used to hold temporary working data. |
Shutdown()
Function to perform any required clean up for the plugin.
Declaration
public void Shutdown()