2 Replies Latest reply on Sep 12, 2015 6:34 AM by Simon Greener

    Example Menu with SubMenu SQL Developer Extension

    Simon Greener

      JDeveloper 12.1.3

      Oracle 12cR1

      Windows 7 Pro 64 Bit

      Extension samples: 12.1.3.0.41.140521.1008

      SQK Developer 4.1.1

       

      I've had a look at the JDeveloper extension examples, looked at https://java.net/projects/jdev-extensions/pages/Trigger-hooks#Menus, and worked with the Bedent extension PDF but I am struggling to understand how to implement sub-menus below an existing View menu entry.

       

      Can someone show me how to create the necessary extension.xml elements so that I can create a set of sub-menus below an existing extension menu (GeoRaptor - added to view menu)?

      The menu + sub-menus I want is:

       

      View>GeoRaptor> Open Map

                               > Load Shapefile

                               > Manage Metadata

                               > About"

       

      The current code implements command/controller code for a single "GeoRaptor" menu entry. Pointers as to how to implement a single sub-menu entry (say "Open Map" below) is all I want: I can build the rest from that as a template.

      Some indication of how to build the controller etc for "Open Map" would be useful.


      The relevant part of my extension.xml is as follows:


          <trigger-hooks xmlns="http://xmlns.oracle.com/ide/extension">

              <triggers>

                  <sqldev-snippet-hook xmlns="http://xmlns.oracle.com/sqldeveloper/sqldev-snippet">

                          <snippet file="/org/GeoRaptor/Snippets.xml" />

           </sqldev-snippet-hook>

       

                  <actions xmlns="http://xmlns.oracle.com/jdeveloper/1013/extension">

                      <action id="org.GeoRaptor">

                          <properties>

                              <property name="Name">GeoRaptor</property>

                              <property name="SmallIcon">${OracleIcons.DBDIAGRAM}</property>

                              <property name="LongDescription">GeoRaptor Spatial Extension for SQL Developer: Free and Open Source</property>

                          </properties>

                          <command-class>org.GeoRaptor.ExtensionCommand</command-class>

                          <menu-actions/>

                      </action>

                  </actions>

                

                  <controllers xmlns="http://xmlns.oracle.com/ide/extension">

                      <controller class="org.GeoRaptor.ExtensionController">

                          <update-rules>

                              <update-rule rule="always-enabled">

                                  <action id="org.GeoRaptor"/>

                              </update-rule>

                          </update-rules>

                      </controller>

                  </controllers>

                

                  <menu-hook xmlns="http://jcp.org/jsr/198/extension-manifest">

                      <menus>

                          <menubar id="javax.ide.view.MAIN_WINDOW_MENUBAR_ID">

                              <menu id="javax.ide.VIEW_MENU_ID">

                                  <section id="org.GeoRaptor"

                                           before="javax.ide.NEW_SECTION_ID">

                                      <item action-ref="org.GeoRaptor"/>

                                  </section>

                              </menu>

                          </menubar>

                      </menus>

                      <toolbars>

                          <toolbar id="javax.ide.view.MAIN_WINDOW_TOOLBAR_ID">

                              <section id="javax.ide.tck.toolbar.testsection" after="javax.ide.NEW_SECTION_ID">

                                  <item action-ref="org.GeoRaptor"></item>

                              </section>

                          </toolbar>

                      </toolbars>

                  </menu-hook>

       

                  <context-menu-hook rule="always-enabled">

                      <site idref="navigator, editor, explorer"/>

                      <extension-listener class="org.GeoRaptor.MenuContextListener"/>

                      <menu/>

                  </context-menu-hook>

              </triggers>

          </trigger-hooks>


      regards

      Simon