Java Plug-ins (deprecated)
The extension method described in this chapter is deprecated and you should avoid using it for new development.
To creating Java plug-ins you need Java programming skills and knowledge of:
-
The Swing GUI component kit
-
The Escenic content model
The class StudioPlugin
can be used to create
standard plug-ins for Content Studio. You can use a plug-in based on
StudioPlugin
for a wide range of purposes. A
StudioPlugin
may be an "invisible" component that runs
entirely in the background, but it may also add menu items to the
Content Studio
user interface and display its own user interface components (dialogs,
messages and so on). The plug-in starts up and terminates together with
Content Studio.
During its life, it communicates with Content Studio via the
StudioContext
object.
Note that any StudioPlugin
s you write must
adhere strictly to Swing's event dispatch thread
(EDT) conventions, as described here:http://java.sun.com/docs/books/tutorial/uiswing/concurrency/dispatch.html
Failure to do so may cause Content Studio to become unresponsive.
The main classes involved in writing a plug-in are:
com.escenic.studio.plugins.StudioPlugin
-
The plug-in class itself. You create a plug-in by extending this class.
com.escenic.studio.plugins.spi.StudioPluginSpi
-
The SPI class that creates
StudioPlugin
instances. You extend this class to create an SPI class that creates instances of your plug-in. com.escenic.studio.StudioContext
-
All plug-ins communicate with Content Studio via this class.
StudioPlugin
has agetContext()
method that returns aStudioContext
object.StudioContext
has methods the plug-in can use to subscribe to various events and to gain access to various components of the Content Studio session.-
addLifeCycleListener()
: This method adds aStudioLifeCycleListener
to theStudioContext
object. -
getContentEditorContainer()
: This method returns aContentEditorContainer
object. -
getContentService()
: This method returns aContentService
object. -
getUser()
: This method returns aContent
object containing information about the current user. -
execute()
: This method can be used to execute code encapsulated inPluginTask
objects.
-
com.escenic.studio.StudioLifeCycleListener
-
This class provides plug-ins with a means of listening for and reacting to important events in a session's life cycle such as
launched
,userSessionStarted
,userSessionEnded
andexiting
. com.escenic.studio.editors.ContentEditorContainer
-
This object is a container for all the editors opened in a Content Studio session. You can use this object to get access to all the editors in a session. It also has an
addEditorListener()
method that adds anEditorListener
to theContentEditorContainer
. Note that this object is not available until Content Studio is completely initialized, so you should always access it via theuserSessionStarted
event (see the example code in Writing a Basic Plug-in). com.escenic.studio.editors.EditorListener
-
This class provides plug-ins with a means of listening for and reacting to editor events such as
editorOpened
andeditorClosed
. com.escenic.client.content.ContentService
-
This object provides access to content items. It also has an
addContentListener()
method that adds aContentListener
to theContentService
. com.escenic.client.content.ContentListener
-
This class provides plug-ins with a means of listening for and reacting to content item events such as
contentCreated
,contentCreated
andcontentDeleted
. com.escenic.studio.plugins.PluginTask
-
This class is a container for any time-consuming tasks that a plug-in performs. You must use this class to wrap any actions that are potentially time-consuming, such as disk reads or accessing Internet resources. You create a task by extending
PluginTask
and execute it usingStudioContext.execute()
. For further information, see Making a Plug-in Task.
For detailed information about the classes listed, see the javadoc
documentation in your
engine-distribution/apidocs
folder.