Interface IExtension
- All Known Subinterfaces:
ExclusiveUIExtension,HiddableExtension
- All Known Implementing Classes:
Extension,ExtensionDecorator,LibraryExtension
Extensions are the way in which plugins extend Andami. Every class
implementing this interface is an extension (although this class
should not be directly implemented, extending the Extension
abstract class is the preferred way). During startup,
Andami creates an instance from each extension. Extensions are able
to add controls (tools, toolbars and menus)
to the user interface (GUI); when these controls
are clicked or modified, Andami will call the execute()
method from the associated extension. Extensions will also control
whether their associated controls are enabled or not, and whether
they are visible or hidden.
Besides implementing this interface, extensions are required to have an empty constructor, because it will be invoked to create the extension's instance.
On correctly installed plugins, an instance of every plugin's
extension will be created. Then, the initialize()
method will be executed for each extension.
Each time the active window is switched and every time the execute
method is called, Andami checks the isEnabled() and
isVisible() for each extension, to decide whether
they will be enabled and visible.
The execute() method will be called from the GUI
thread, so it will block the GUI until it finishes. Therefore,
execution must be fast. If long process must be started from
the execute method, a new thread must be created.
Normally, extensions should not directly implement this interface,
but they should extend the Extension abstract class.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidThis method is executed when the user clicks on any of the controls associated with this extension (menus, tools, etc).Gets the status of the extension, which may be queried to check if the extension has some unsaved data or some associated background tasks.getStatus(IExtension extension) voidExtension's initialization code should be here.booleanThis method is invoked by Andami to check whether the extension (and its associated controls) is enabled or disabled.booleanThis method is invoked by Andami to check whether the extension (and its associated controls) is visible or hidden.voidExtension's post-initialization code should be here.voidExtension's termination code should be here.
-
Method Details
-
initialize
void initialize()Extension's initialization code should be here. This method is called for all the extensions during Andami's initialization. -
postInitialize
void postInitialize()Extension's post-initialization code should be here. This method is called for all the extensions during Andami's initialization, afterinitialize()has been called for ALL the extensions. -
terminate
void terminate()Extension's termination code should be here. This method is called for all the extensions during Andami's termination. -
execute
This method is executed when the user clicks on any of the controls associated with this extension (menus, tools, etc).- Parameters:
actionCommand- An String specifying the action to execute. This is useful when there are different controls associated with the same extension.
-
isEnabled
boolean isEnabled()This method is invoked by Andami to check whether the extension (and its associated controls) is enabled or disabled. Disabled controls (menus and buttons) are shown in light grey colour, and it is not possible to click on them.- Returns:
- true if the extension should be enabled, false otherwise
-
isVisible
boolean isVisible()This method is invoked by Andami to check whether the extension (and its associated controls) is visible or hidden.- Returns:
- true if the extension should be visible, false otherwise
-
getStatus
IExtensionStatus getStatus()Gets the status of the extension, which may be queried to check if the extension has some unsaved data or some associated background tasks.- Returns:
- An IExtensionStatus object, containing the status of this extension.
- See Also:
-
getStatus
-