3 Developing with the Extension SDK

This chapter describes the Extension SDK, which is available to download to JDeveloper, and how to use it to develop your own extensions.

This chapter includes the following sections:

3.1 About Developing with the Extension SDK

The JDeveloper Extension Software Developer Kit (SDK) includes a collection of projects containing sample code and Javadoc-generated documentation for the Extension API.

Each sample project contains a deployment profile for one-click deployment of the sample to the appropriate directory. You can also deploy all the projects at once.

You can use the code that provides each extension as a template to help you develop similar features.

3.2 Downloading and Installing the Extension SDK

Learn how to download and install the Extension SDK to JDeveloper.

You can download and install the Extension SDK using the Check for Updates wizard, or by downloading it from the Oracle website.

To install the Extension SDK using Check for Updates:

  1. Follow the information in "How to Install Extensions with Check for Updates" in Developing Applications with Oracle JDeveloper, and on the Source page select the Official Oracle Extensions and Updates update center.

  2. On the Updates page, choose Extension SDK from the list of available extensions, and click Next. Owing to the size of the extension, it may take a few minutes to download depending on your internet connection.

  3. When you finish the wizard, JDeveloper will restart and install the Extension SDK. When it restarts, you are asked whether JDeveloper should install the sample application containing the sample projects described in this chapter. If you answer yes, the application extensionsdk is open in the Applications window, and the sample projects are listed.

If you are working behind a firewall, JDeveloper will not be able to connect to the update center until you enter details of your proxy server. You can either do this in the Web Browser and Proxy page of the Preferences dialog (available from the Tools menu), or the Check for Updates wizard will time out and display the Web Browser and Proxy page.

To install the Extension SDK using a file:

  1. Follow the information in "How to Install Extensions Directly from OTN" in Developing Applications with Oracle JDeveloper, and navigate to the page for Official Oracle JDeveloper Extensions.
  2. Download the Extension SDK to a local location, then open the Check for Updates wizard from the Help menu.
  3. On the Source page, choose Install from Local File and enter the location of the esdk_bundle.zip file and complete the wizard.
  4. JDeveloper will restart and install the Extension SDK. When it restarts, you are asked whether JDeveloper should install the sample application containing the sample projects described in this chapter. If you answer yes, the application extensionsdk is open in the Applications window, and the sample projects are listed.

3.2.1 What Happens When you Install the Extension SDK

When you successfully install the Extension SDK, the sample application is optionally open in the Applications window, giving you access to the sample projects that illustrate different aspects of JDeveloper functionality. You can use the code to help you develop your own extensions.

The Oracle Fusion Middleware Java API Reference for Oracle Extension SDK is available from the Reference node in the Contents list of the online help (available from the Help menu).

3.2.2 Troubleshooting Installing the Extension SDK

If you have trouble downloading the Extension SDK and you are working behind a firewall, ensure that you have set the proxy server settings on the Web Browser and Proxy page of the Preferences dialog (available from the Tools menu).

If the Check for Updates wizard has located the update center you are using, it may take up to a couple of minutes before the list of available extensions is displayed, depending on the speed of your connection.

When you select the Extension SDK in the wizard, it downloads while the wizard is still open, and this can take a couple of minutes, depending on the speed of your connection. Once the extension has finished downloading, JDeveloper needs to restart in order to install it, and a message to this effect is displayed.

3.3 Using the Sample Extensions

JDeveloper’s Extension SDK has a number of sample projects that illustrate how to use different types of JDeveloper element.

When you install the Extension SDK, you install an application extensionsdk, which contains a number of projects that give examples of how to create and use different types of JDeveloper element.

For information about running the samples, see Running the Sample Projects.

Most of the extension samples are described at:

http://www.oracle.com/technetwork/developer-tools/jdev/samples-083838.html

The following list is a sampling of the some of the available sample extension projects and a brief summary of their main features:

  • ApplicationOverview.jpr: Demonstrates how to plug in to the Application Overview window. Adds a Show Overview menu item to both the Application and Project context menus. It illustrates how to:

  • AuditRefactor.jpr: Demonstrates using the Audit framework to detect problems in Java code, and how to write a transform using the refactoring API to fix the problems automatically.

  • Balloon.jpr: Demonstrates how to install a balloon notification into the JDeveloper status bar.

  • ClassBrowser.jpr: Shows how to use the JDeveloper ClassBrowser.

  • ClassGenerator.jpr: Shows the basic of JOT (Java Object Tool) to generate a java file in your project. Also demonstrates how to use the Finite State Machine (FSM) Wizard utility to create a multi step wizard.

  • ClassSpy.jpr: Shows the simplest way to identify the class of a given node in the Applications window, and how to write its name in the Log window.

  • ClickableURL.jpr: Shows how to generate a clickable URL in the Log window.

  • CodeInteraction.jpr: Shows how to get text from the code editor, and launches a Google search on the currently selected text.

  • ConfigPanel.jpr: Demonstrates how to store and retrieve preferences, and install a panel into the Preferences dialog.

  • CPPageProvider.jpr: Demonstrates how to plug into the component palette using the palette2 API.

  • CreateDialog.jpr: An example of a simple create dialog invoked from the gallery.

  • CreateStructure.jpr: Demonstrates creating a new empty application (.jws file) and adding a new empty project (.jpr file) to it.

  • CustomEditor.jpr: Shows how to implement your own editor for a given kind of file. To see the tool in action, open any XML file and switch to the Query page.

  • CustomExtensionHook.jpr: Demonstrates a custom extension hook, which allows other extensions to plug into your extension.

  • CustomNavigator.jpr: Demonstrates how to install a custom Applications window. Installs a "Favorites" window which can be used to store frequently accessed files.

  • DebugObjectPreferences.jpr: Demonstrates how to install a custom object preferences renderer for the Data window of the debugger.

  • DockableWindow.jpr: Shows how to implement a custom dockable window.

  • ExternalToolCreation.jpr: Shows how to write an addin that installs an external tools shortcut for an external program. This feature is actually part of the JDeveloper IDE, and uses a wizard to set up external applications. For more information about External Tools, see the section "Adding External Tools to JDeveloper" in Developing Applications with Oracle JDeveloper.

  • ExternalToolImportExport.jpr: Imports and exports the properties associated with a list of External Tools.

  • ExternalToolMacros.jpr: Shows how to write an addin that installs a custom macro for use by external tools.

  • ExternalToolScanner.jpr: Shows how to write a scanner for external tools that can automatically install external program shortcuts when the user clicks on the Find Tools button in the External Tools dialog, (available from the Tools menu).

  • FirstSample.jpr: A sample that illustrates the main concepts involved in writing extensions for JDeveloper.

  • FlatEditor.jpr: Demonstrates how to implement a form-based overview editor similar to the one used for extension.xml.

  • HelloX.jpr: This is a sample that demonstrates a number of core concepts, including installing New Gallery items, actions, and menu items.

  • LayoutMenuFilter.jpr: Shows how to filter the top level menus in the IDE when the layout changes.

  • MethodCallCounter.jpr: Uses JOT (Java Object Tool) to count the number of occurrences of a named method in some code.

  • OpenNodes.jpr: Implements a dockable window which shows nodes that are open in the NodeFactory, and tracks when nodes are opened and closed.

    When you run this sample, you can choose View > ESDKSample: Open Nodes to open an Open Node Tracker window, which shows the nodes that are open in NodeFactory, and tracks when nodes are opened and closed.

  • Overlay.jpr: Shows how to use overlays in the Applications window, like those used by the version control extensions.

  • ProgressBar.jpr: Shows how to implement a progress bar during the execution of some lengthy task.

  • ProjectSettings.jpr: Demonstrates storing and retrieving project properties and adding custom project settings UI.

  • StructurePane.jpr: Shows how to display your own content in the Structure Window.

  • UpdateCenter.jpr: Demonstrates how to install a custom update center as part of an extension.

3.4 Running the Sample Projects

Learn how to run the sample JDeveloper extension projects.

You can run the sample projects in JDeveloper to see how they work.

To run a sample project:

  1. The first time you run one of the sample project extensions, you have to right-click on it and choose Deploy to Target Platform.
  2. To run the extension, right-click and choose Run Extension.

    This runs a second copy of JDeveloper with the sample project installed.