Gorgon
Show / Hide Table of Contents

Class ToolPlugIn

Base class for a plug in that provides basic utility functionality.

Inheritance
object
GorgonPlugIn
EditorPlugIn
ToolPlugIn
Implements
IGorgonNamedObject
Inherited Members
EditorPlugIn.HostServices
EditorPlugIn.OnGetSettings()
EditorPlugIn.OnGetPlugInAvailability()
EditorPlugIn.GetPlugInSettings()
EditorPlugIn.IsPlugInAvailable()
GorgonPlugIn.Name
GorgonPlugIn.Assembly
GorgonPlugIn.PlugInPath
GorgonPlugIn.Description
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
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 Source

ToolPlugIn(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 Source

ContentFileManager

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.

| Edit this page View Source

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
IHostServices
| Edit this page View Source

PlugInType

Property to return the type of this plug in.

Declaration
public override sealed PlugInType PlugInType { get; }
Property Value
Type Description
PlugInType
Overrides
EditorPlugIn.PlugInType
| Edit this page View Source

TemporaryFileSystem

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 Source

GetToolButton()

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.

| Edit this page View Source

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 hostServices parameter is null.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

OnProjectClosed()

Function to allow custom plug ins to implement custom actions when a project is closed.

Declaration
protected virtual void OnProjectClosed()
| Edit this page View Source

OnProjectOpened()

Function to allow custom plug ins to implement custom actions when a project is created/opened.

Declaration
protected virtual void OnProjectOpened()
| Edit this page View Source

OnShutdown()

Function to provide clean up for the plugin.

Declaration
protected virtual void OnShutdown()
| Edit this page View Source

ProjectClosed()

Function called when a project is unloaded.

Declaration
public void ProjectClosed()
| Edit this page View Source

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.

| Edit this page View Source

Shutdown()

Function to perform any required clean up for the plugin.

Declaration
public void Shutdown()

Implements

IGorgonNamedObject

Extension Methods

GorgonDebugExtensions.ValidateObject<T>(T, string)
GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author