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 StudioPlugins 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 a getContext() method that returns a StudioContext 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 a StudioLifeCycleListener to the StudioContext object.

  • getContentEditorContainer(): This method returns a ContentEditorContainer object.

  • getContentService(): This method returns a ContentService object.

  • getUser(): This method returns a Content object containing information about the current user.

  • execute(): This method can be used to execute code encapsulated in PluginTask 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 and exiting.

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 an EditorListener to the ContentEditorContainer. Note that this object is not available until Content Studio is completely initialized, so you should always access it via the userSessionStarted 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 and editorClosed.

com.escenic.client.content.ContentService

This object provides access to content items. It also has an addContentListener() method that adds a ContentListener to the ContentService.

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 and contentDeleted.

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 using StudioContext.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.