text: Are there any sample sql dev 4 extensions available yet?rp0428 May 20, 2014 11:43 PM
  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 4.0.2.15.21 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
  <xs:complexContent>
  <xs:extension
  <xs:sequence
  <xs:element
  <xs:annotation>
  <xs:documentation>The label for the menu.</xs:documentation>
  </xs:annotation>
  </xs:element>
  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
  Scott-Dev
  Tables
  Dept
  . . .
  Table
  Column
  Constraint
  . . .
  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.
  Dept
  . . .
  Table
  Column
  Constraint
  . . .
  Custom1
  Custom2
  CustomSubMenu
  CustomSub1
  CustomSub2
  In the old framework it was easy. You just needed a listener hook in the extension.xml file
  <hooks>
  <jdeveloper-hook
  <context-menu-listeners>
  <site idref="db_nav">
  <listener-class>com.any.myContextMenuListener
  </listener-class>
  </site>
  </context-menu-listeners>
  </jdeveloper-hook>
  . . .
  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 May 21, 2014 2:51 PM (in response to rp0428).
  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.
  -kris
  2. Re: Are there any sample sql dev 4 extensions available yet?rp0428 May 21, 2014 10:12 PM (in response to Kris Rice-Oracle)
  Kris Rice wrote:.
  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:
  xsi:noNamespaceSchemaLocation="dialogs.xsd
  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
  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>
  <dd><ul>
  <li>APEX[_FOLDER]</li>
  <li>CATALOG (schema)</li>
  <li>COLUMN</li>
  <li>CONNECTION</li>
  <li>DATABASE LINK</li>
  <li>DIRECTORY[_FOLDER]</li>
  <li>FUNCTION[_FOLDER]</li>
  <li>INDEX</li>
  <li>JAVA[_FOLDER]</li>
  <li>JOBS[_FOLDER]</li>
  <li>MATERIALIZED VIEW[_FOLDER]</li>
  <li>MATERIALIZED VIEW LOG</li>
  <li>PACKAGE[_FOLDER]</li>
  <li>PACKAGE BODY</li>
  <li>PACKAGE_PARENT</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"?>
  - <items xmlns:xsi=""
  - xsi:
  - <item type="CONNECTION" reload="true">
  - <title>Set Schema</title>
  - <prompt>
  - <label>Schema</label>
  - <default><![CDATA[select user from dual]]>
  - </default>
  - <value>
  - <![CDATA[select distinct username from sys.all_users order by 1]]>
  - </value>
  - </prompt>
  - <prompt type="confirm">
  - <label>Confirm that adding an XML based action is easy.</label>
  - </prompt>
  - <sql>
  - <![CDATA[alter session set current_schema = #1#]]>
  - </sql><help>Issues alter sessions</help>
  - <confirmation>
  - <title>Confirmation</title>
  - <prompt>Success! Alternate personality installed...</prompt>
  - </confirmation>
  - </item>
  - </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=""
  xsi:
  <folder type="TABLE">
  <name>Custom Menu</name>
  <item type="TABLE" reload="false" className="menuaction.TestMenuAction">
  <title>Submenu Choice1</title>
  </item>
  <item type="TABLE" reload="false" className="menuaction.TestMenuAction">
  <title>Submenu Choice2</title>
  </item>
  </folder>
  <item type="TABLE" reload="false" className="menuaction.TestMenuAction">
  <title>Custom Choice1</title>
  </item>
  <item type="TABLE" reload="false" className="menuaction.TestMenuAction">
  <title>Custom Choice2</title>
  </item>
  </items>
  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 {
  @Override
  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 May 22, 2014 8:35 AM (in response to rp0428)
  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:
  - A skeleton extention for 1.x -> 3.x:
  - Adding custom datatypes: Kris' blog: New Datatype support and how to add more and
  - Adding context menus via xml :Kris' blog: XML Based right click menus
  - Getting started:
  - XML Extensions Including a link to the XSD Kris' blog: XML Extension Points ( Context Menus )
  - and lots more.
  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.