Declarative Menus in JDeveloper Extensions – Part One

When creating an extension for JDeveloper, the most common way of connecting that extension to the IDE is through the menu structure.

Whether it's via a context menu, or adding a menu to the existing menu bar at the top of the IDE, it can all be done in two different ways.  In code, or declaratively in the extension.xml file

In this post, I'm going to talk about how to work with the declarative method for menu creation, as I believe it is the easiest and most flexible way to connect to the IDE.

All of the IDE commands used here, are available when working with an Extension Project type.

I will break this post into multiple sections since it's a bit of a long topic

Part One: Introduction and Creating an Action

Part Two: Creating Context menus

Part Three: Creating Gallery menus  (File / New) using a Wizard

Part Four: Creating  Toolbar and Menubar menus

The SDK example application "First Sample" does a really good job of showing how to add a menu to the following areas of the IDE:

Context Menu for:

Navigator
Editor
Explorer (Structure pane)

image

New Gallery

image

Menubar

image

Toolbar

image

The above examples show the proper syntax for working with all of the different kinds of menus.  However, they don't give you the information about how to find the ID for the menu areas that you want to add to, or how to nest menus.  We'll go into more detail about how to do these things as well as take a general look at how everything is tied together.

Getting Started (creating an action)

The first thing you need to do when working with menus, is to create the action section that will define what the menu item will do.  All of the menu items will reference this action to get the actual work done.  This is made very simple in JDev 11g by using the "File -> New" Wizard to add an Action to the existing extension project.

Right-Click on your extension project name in the Navigator pane and select New.  In the resulting Wizard, make sure the "All Technologies" tab is selected and then click on the Extension Development folder under the Client Tier  category.

image

Double click on the Action item and fill out the dialog with the information about your new Action.

image

You can select an Icon for your menu item from the OracleIcons group here, or you can add an icon to the project at a later time and then reference it in the extension.xml file later.

Once you have created your action, it will look like this in the extension.xml file

image



Next Steps: 

-- Part Two: Creating Context menus

-- Part Three: Creating Gallery menus  (File / New) using a Wizard

-- Part Four: Creating  Toolbar and Menubar menus

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

profile image
My name is John 'JB' Brock.
This Blog will focus on tips and tricks for working with the JDeveloper Extension SDK.
I hope to bring clarity to some of the mysteries around developing extensions for JDeveloper.


Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today