3 Replies Latest reply: May 22, 2014 8:35 AM by Kris Rice-Oracle RSS

    Are there any sample sql dev 4 extensions available yet?


      I'll just ask the questions first so you don't need to try to find them below. The goal is explained about half way down.


      Using Jdev 12.1.2, Sql Dev and the latest Extension SDK


      1. Are there any sample extensions available from Oracle for Sql Developer 4 and the new framework?

      2. Is ANY documentation available on the 'sql dev specific' IDs used for menu and other user interface items?


      3. Is there a CURRENT version of the extension.xsd file available?


      This is the link to an article from over two years ago, by Jeff Smith, titled 'How To Create a Java Defined Extension'.



      That was useful as were the other extension examples provided.


      The menu structure and IDs for Sql Developer are different than for JDeveloper. So some documentation (a list?) or programmatic method is needed to obtain the IDs to use for working with the menus.


      The old framework and Sql Dev samples and my own extension used 'db_nav' and I was able to get the JDev FirstSample extension from the ESDK to work in Sql Dev 4. But I don't know of any place even that one 'id' is actually documented.


      The extension.xsd file deployed with both Sql Developer and JDeveloper appears to be an older version than what is required in JDeveloper. The 'menuType' says the first element can be a 'label' but JDeveloper gives an error saying it expects a section element.

        <xs:complexType name="menuType">


            <xs:extension base="identifiableType">

              <xs:sequence minOccurs="0">

                <xs:element name="label" type="i18n_string" minOccurs="0"



                    <xs:documentation>The label for the menu.</xs:documentation>




      I have reviewed all of the latest JDeveloper samples in the Extension SDK for the new OSGI extension framework.


      The goal is to migrate my Sql Dev 3 extension to the new framework. It basically adds items and a submenu when you right-click on any database item (e.g. the DEPT table)


      1) adding multiple, and/or multi-level, items to a context menu

      2) filtering/recognizing specific node types

      3) executing custom actions for the new context menu items


      Assuming this tree in the DB navigator

      IDE Connections




                     . . .



                      . . .

      The goal is to add additional menu items for ONLY that lowest level (the FirstSample items show up everywhere).


      So for a given table, e.g. Dept, Add Custom1, Custom2 or CustomSubMenu . . . which then has Custom1 and Custom2 submenu items.


                     . . .



                      . . .






      In the old framework it was easy. You just needed a listener hook in the extension.xml file


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


          <site idref="db_nav">






      . . .

      That listener class implemented both ContextMenuListener and Controller.


      1. menuWillShow method - build the multi-level menu using Java code and add it to the 'contextMenu' using the parameter passed. You would define the actions and add IdeAction items to the menu. By getting the selection and testing for an 'instanceof ObjectNode (a datababase item) you could just NOT add to the menu unless the user clicked in an appropriate place in the nav tree.


      2. handleEvent method - use 'action.getCommandId' to find out which of the actions (menu items) was clicked and dispatch to the appropriate code


      Does anyone know of any examples of using the new extension framework to do a similar thing?


      The new mix of actions, controllers, listeners, etc is rather confusing and a lot of the ESDK examples use a common extension.xml file that has a little of everything in it.


      I have also been unable to find any freeware/shareware extension samples for the new framework to use as a template.


      The ultimate goal of actually being able to use Sql Developer as a target platform in JDeveloper is on hold since it now uses version 12.1.3 of the JDeveloper which hasn't been publicly released yet.


      Any links to samples would be appreciated.

        • 1. Re: Are there any sample sql dev 4 extensions available yet?
          Kris Rice-Oracle

          For your first questions,

          1 - There isn't yet but it's on my short list to do.  I'm going to give a talk at KScope on extending sqldev so something will be coming soon, probably a bunch of examples on my blog and possible a skeleton ext on github.  So stay tuned , it's coming.

          2 - There isn't a list

          3 - I'm not sure, the jdev guys own the extension.xml so maybe pester them.


          The wonderous OSGI is probably snagging you up.  I'll ask someone about the hooks.



          • 2. Re: Are there any sample sql dev 4 extensions available yet?

            Kris Rice wrote:


            For your first questions,

            1 - There isn't yet but it's on my short list to do.  I'm going to give a talk at KScope on extending sqldev so something will be coming soon, probably a bunch of examples on my blog and possible a skeleton ext on github.  So stay tuned , it's coming.

            This reply may initially seem like 'dumping' but it is NOT intended that way. It is meant to, once again, try to enlighten as to why, IMHO, developers are not creating more Sql Dev extensions and/or migrating their old extensions to the new framework. We are one of those groups.


            The first part below tries to explain why. The second part at the end is specific feedback about the sample XML extension solution you provided in this companion thread by another poster about the setschem extension



            The two simple reasons are:


            1) Oracle will NOT release the information (e.g. XSDs) needed to to understand what/how to create the extension.xml file and related files

            2) The samples that were released in the past did not include enough explanation about WHY the various elements were specified the way they were and, more importantly, did not explain why things showed up where they did (e.g. why they appeared on a menu in the location they appeared on).


            For background this is my most recent thread (from one month ago) where I try to gather in one place the state of things as I experienced them.



            That thread includes links to my original thread from over three years ago when I first ask about obtaining the XSDs and includes links to threads from over five years ago by others that ask the same thing about XSD availability . Those older threads include the responses from Sue Harper and other team members that can be summed up by this one comment from about five years ago about the Javadocs and XSDs:

            not yet, but its something I want to release at some point.

            That series of threads should give a good overall idea of the info needed.

            2 - There isn't a list

            That was in response to this question:

            2. Is ANY documentation available on the 'sql dev specific' IDs used for menu and other user interface items?

            One example of the need: The database navigator window is the most prominent window in Sql Developer. To addd menu items to it you need to know to reference it as 'db_nav'. That isn't documented anywhere. It is in SOME of the samples floating around but if you don't know it, you don't know it and won't guess what it is.


            The XSDs (XML schema definition files) control the allowable content of the XML files that are used for extensions. The most important one is probably 'extension.xml' and the corresponding 'extension.xsd'.


            But this is the line from the example you provided in the other thread:


            That XSD file is the spec for  one type of XML extension but it is NOT publicly available from Oracle. I was able to find it on the web at this location:


            That is an Oracle URL and it works for the public. But it is likely NOT supposed to be available since the parent directories give a web page with this error if you try to access them or similar XSD file names such as navigator.xsd

            Content Server Request Failed
            Error Unable to retrieve content. Security access denied.


            That XSD file has EXTENSIVE detailed info with comments about how to properly created the companion XML file. But Oracle, for over five years now, won't release it for some reason.


            This is another line from your example in the other thread:

            <item type="CONNECTION" reload="true">       

            That 'item' element is of type  <xs:element name="item" type="tns:itemType" as  explained clearly in the XSD. That XSD also gives an extensive list of the values that can be used for the 'type' attribute. This partial listing includes the 'CONNECTION' value that you used in your example:

                  <dt><a name="object_types"></a>Common Object Types:</dt>



                  <li>CATALOG (schema)</li>



                  <li>DATABASE LINK</li>






                  <li>MATERIALIZED VIEW[_FOLDER]</li>

                  <li>MATERIALIZED VIEW LOG</li>


                  <li>PACKAGE BODY</li>


            The most frustrating part is not the lack of examples. It is that 1) these XSDs already exist, 2) they are needed to properly create extensions and 3) Oracle won't release them.


            Thanks for providing that example in the other thread. Here is some feedback about it to show you what question I had when I saw it and tried it:

            1) create this xml file:

            <?xml version="1.0" encoding="UTF-8"?> 

            1. <items xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            2. xsi:noNamespaceSchemaLocation="dialogs.xsd"> 
            3.    <item type="CONNECTION" reload="true">       
            4.      <title>Set Schema</title>      
            5.      <prompt> 
            6.         <label>Schema</label> 
            7.         <default><![CDATA[select user from dual]]> 
            8.         </default> 
            9.         <value> 
            10.           <![CDATA[select distinct username from sys.all_users order by 1]]> 
            11.         </value> 
            12.       </prompt> 
            13.      <prompt type="confirm"> 
            14.         <label>Confirm that adding an XML based action is easy.</label> 
            15.      </prompt> 
            16.      <sql> 
            17.         <![CDATA[alter session set current_schema = #1#]]> 
            18.      </sql><help>Issues alter sessions</help>       
            19.      <confirmation> 
            20.      <title>Confirmation</title> 
            21.         <prompt>Success! Alternate personality installed...</prompt> 
            22.      </confirmation> 
            23.    </item> 
            24. </items> 

            .2 - why did you use this namespace and XSD? what is the list of other namespaces and XSDs available?

            3 - The 'CONNECTION' type appears to refer an entry under the 'Connections' tree element in the navigation tree. Is that correct? will ALL entries under that 'Connections' element have the same type? If not, what other types 'could' there be?

            4. -  The title element appears to be the string that will display in the menu. The XSD helps explain this. But without the XSD we have NO way of knowing what element to provide, whether it is required and so on

            5. + The prompt, sql, label and other titles seem to correspond to elements of the dialog box that gets displayed, For an actual sample extension it would be helpful to correlate those elements (line numbers) to an image of the dialog box that gets displayed.


            The menu entry appears for each 'connection' but it isn't at all clear why it appears in the location that it does. That is what determines which section and where in that section that it appears. Other XSDs discuss 'section' elements where you can specify a section by name and a weight to provide a location.


            But without a list of 'names' for the Sql Dev menus there is not way to put a menu entry where you want to put it.


            That is where having that 'list' comes into play. There isn't any way to 'guess' the proper names. Knowing how to create some simple code that can iterate through the menu tree and create a master list of names would get the job done. We don't need a pretty document but we do need SOME way to get the info.


            In short - by using your example I was able to get a simple two stage menu created using this code:

            <?xml version="1.0" encoding="UTF-8"?>

            <items xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"


            <folder type="TABLE">

               <name>Custom Menu</name>

               <item type="TABLE" reload="false" className="menuaction.TestMenuAction">

                 <title>Submenu Choice1</title>


               <item type="TABLE" reload="false" className="menuaction.TestMenuAction">

                 <title>Submenu Choice2</title>



            <item type="TABLE" reload="false" className="menuaction.TestMenuAction">

               <title>Custom Choice1</title>


            <item type="TABLE" reload="false" className="menuaction.TestMenuAction">

               <title>Custom Choice2</title>



              Now I'm trying to figure out how to link that 'className' to everything so that it will actually call a method in that class when the menu item is selected:

            package menuaction;

            import oracle.javatools.dialogs.MessageDialog;
            import oracle.dbtools.raptor.dialogs.actions.AbstractMenuAction;

            import oracle.ide.Ide;

            public class TestMenuAction extends AbstractMenuAction {

                public void launch() {
                    MessageDialog.information( Ide.getMainWindow(), "In the TestMenuAction Class", "Testing a menu action", null );

            My suggestions (and my opinion) for sample extensions
            1. A sample should do just ONE thing. It should not put things on a context-menu, and on the main menu, and in the 'new' gallery. The JDev 'FirstSample' does all of those together


            2. The source files should only include what is needed for that sample being presented. Again, the FirstSample sources include entries and java code for a menu listener that isn't used and the Java code has a comment that it isn't used. Then, IMHO, it should NOT be included in that example.


            3. A sample, even a simple one, is MUCH more useful if ALL of the elements are explained without making any assumptions about something being too simple for explanation. Some of the JDev samples have 'label' elements everywhere when they aren't needed and it is confusing to try to determine which ones are really being used and which ones aren't necessary for that particular sample.


            4. Provide the source, or a link to it, for ALL elements used by the sample. That means XSDs used for namespaces. It means if the example uses 'CONNECTION' for a type then we need a list of legal types or info on how to find or generate a list.


            5. Unlock the thread that was created for extension migration questions:



            Or alternatively tell us how/where to post those questions.


            Many of us are more than capable, and more than willing, to dig out the information but we need to have access to it and know where to look.


            Many of us would willingly create and make available sample code like you did in the other thread.


            The XSDs clearly exist and have existed for over five years. The only efforts as far as I can tell that remain is to have someone vet them for legal and copyright issues (not a minor consideration) and provide acces to them (on a website or delivered with the product).


            Any assistance you can provide to get things moving and in the right direction would be appreciated.


            No response to any of the 'history' is needed.

            • 3. Re: Are there any sample sql dev 4 extensions available yet?
              Kris Rice-Oracle

              Thanks.  I think you have some bad assumptions in here.

              1) If that xsd wasn't meant to be public, it wouldn't be.  I would never put anything on OTN if it wasn't meant to be used.

              2) There are discrete examples of various things on my blog for 1.x thru 3.x.  These all need updates for 4.x with the great OSGI now.  Here's a few Examples:

              3) Unlock the thread that was created for extension migration questions  <<  We didn't lock it the system did from inactivity


              OSGI did change way more than I like for extension folks and it is on my list to get all samples updated and more of them.