Extending the WebLogic Workshop IDE

You can extend the WebLogic Workshop IDE at several levels of depth: from simple tool bar icons that launch external applications to fully integrated applications with custom windows, menus, and property sheets.

An IDE extension is made up of the following artifacts, packaged together as a JAR or directory.

WebLogic Workshop itself is the culmination of several extensions pulled together in one common interface. wlw-ide.jar is the main WebLogic Workshop executable, containing the core class files, utility classes, and the mechanism to load extensions. But the interesting code to run the IDE is contained in the required IDE extensions. These include the debugger, the JSP designer, source control, and more.

To cause Workshop to load a specific extension at start-up, the extension’s JAR file is placed in the "extensions" subdirectory below the directory containing the wlw-ide.JAR file that contains the IDE core. An extension may also be fully exploded to directories and class files in the ‘extensions’ sub-directory.

Creating Workshop Extensions

A WebLogic Workshop extension is simply defined as a JAR or a directory that contains at a minimum an extension.xml file that declares an extension's participation in the IDE. For example, a JAR file with the following extension.xml file adds a new tool bar icon to the IDE.

<extension-definition>
    <extension-xml id="urn:com-bea-ide:actions">
        <action-ui>
            <toolbar id="sqltoolbar" path="toolbar/main" priority="2" 
                label="%sqlEditor.extension.actionSQLAttributeEditor%">
                 <action-group id="sqledit" priority="10" />
            </toolbar>
         </action-ui>
         <action-set scope="com.bea.ide.lang.control.ControlDocument">
             <action class="sqlEditor.SQLAttributeEditor" label="%sqlEditor.extension.actionSQLAttributeEditor%" 
                 icon="images/database.gif">
                 <location priority="10" path="toolbar/sqltoolbar/sqledit"/>
         </action>
      </action-set>
    </extension-xml>
</extension-definition>

Note: The % signs in "%sqlEditor.extension.actionSQLAttributeEditor%" are a means of referring to a localizable string resource and that it's optional.

This extension places a new button on the toolbar with database.gif as its icon. When the new toolbar button is pressed, the SQLAttributeEditor is displayed.

For more complex extensions, the JAR file would contain the java code that is the extension's implementation, a manifest file which defines the class path and attributes that reference dependent JARs that need to be available at run time by the extension.

At start-up, the core IDE runtime reads all the extension.xml files, batches them together and ensures that the requested services by each extension are available.

Extensions may define handlers for the <extension-xml> tag found in the extension.xml file. Handlers are associated with a particular id attribute. All extension.xml files are scanned for fragments contained within the <extension-xml> tag and those fragments are passed to handlers defined for the particular id attribute. This mechanism allows extensions to create extendable infrastructure in which other extensions can participate. The handler class is instantiated by the core IDE and is completely responsible for parsing the xml contained in the fragment.

Services Provided by the IDE

One important aspect of an extension is its ability to expose and consume the various IDE services. A service is essentially a public interface that has a single instance implementation and provides access to functionality in an extension. In addition to handlers for <extension-xml> tags, an extension may declare services that it implements. For instance, the debugger extension defines a debugger service that, among other things, provides a method for setting a breakpoint. The shell provides a document service with a method for opening a document. Services are consumed by the extensions Java classes and registered with the system using special tags in the extensions.xml file. Many services have associated <extension-xml> tag handlers which allow extensions to add functionality to the service.

For a list of services, see Extension Services in WebLogic Workshop.

The IdeDevKit sample application includes several projects that illustrate IDE extensions. For more information, see IDE Extension Samples.

Related Topics

None.