4.4.3.5. Creating the editor plug-in

To test the editor, a plug-in package needs to be created as described in Chapter 4.2, Creating a plug-in package. The folder structure is the same as for the viewer plug-in (see Section 4.4.2.12, “Creating the viewer plug-in”). Compared to the viewer plug-in, the edit.jsp page has to be added to the content handler folder. Furthermore, the content handler class is named MyTextEditor instead of MyTextViewer. Note that the editor still supports the "View" operation for opening content-nodes in read-only mode. Therefore, the view.jsp page is still included in the plug-in package:

Figure 4.4.2. Editor plug-in package (example)

Instead of placing the class file in the web/WEB-INF/classes folder, the file could also be included in a jar-file and placed in the lib or web/WEB-INF/lib folder.
Be aware that the name of the content handler directory (here: my_text_editor_v1-0) must consist of letters, digits, underscore and dash only. This is because the directory name is used as content handler identifier and therefore has to follow the naming rules of an identifier.
Following an example of the plugin.properties file:

id=my_text_editor_v1_0
version=1.0
plugin_class=
required_app_version = 1.9
config_dialog = false
load_type = next_startup

Listing 4.4.11. plugin.properties (editor example)

The plug-in's locale.properties file just contains the localized plug-in description:

my_text_editor_v1_0.description = Editor plug-in example
my_text_editor_v1_0.help_url =

Listing 4.4.12. locale.properties (editor example)

In this example the help_url property is left empty as we do not provide any online-help for the plug-in.
There is a second locale.properties file in the content handler directory, which defines the localized display name of the content handler:

my_text_editor_v1-0.application_name = My Text Editor

Listing 4.4.13. locale.properties (located in apps/my_text_editor_v1-0)

The locale.properties in the content handler directory is not necessarily required, because all localized text could be defined in the plug-in's global locale.properties file. However, for reasons of modularity it is recommended to place localized text that is only used by the content handler in the locale.properties file within the content handler directory.
Each installed content handler needs a file named apphandler.properties, which has to be located in the content handler directory. This file must contain at least one property with name handler_class that defines the content handler implementation to be used. Therefore, in our example the apphandler.properties file has to contain following line:

handler_class = myexample.MyTextEditor

Listing 4.4.14. apphandler.properties (editor example)

The installation of an editor plug-in is identical to the installation of a viewer plug-in (see Section 4.4.2.13, “Installing the viewer plug-in”).