3 Replies Latest reply on Sep 29, 2015 9:47 PM by rp0428

    import oracle.ide.controller.Command

    Simon Greener

      Folks,

       

      Can anyone explain to me what the Command class does for a SQL Developer/JDeveloper extension?

       

      import oracle.ide.controller.Command;

       

      Do all Extensions need an implementation of a Command class?

       

      regards

      Simon

        • 1. Re: import oracle.ide.controller.Command

          Can anyone explain to me what the Command class does for a SQL Developer/JDeveloper extension?

           

          import oracle.ide.controller.Command;

           

          Do all Extensions need an implementation of a Command class?

          I see you are still trying to avoid taking my suggestion from your other thread..

           

          That is certainly your choice. But until you change course you are destined to run into one dead-end after another.

           

          I've tried to explain that Sql Developer is a 'leaf' on the larger JDeveloper 'branch' which is just one of many on the Fusion MIddleware 'tree'.

           

          You can continue trying to understand the 'tree' by starting at a leaf.

           

          Or you can start at the trunk and examine how the 'tree' grew into the diverse structure that feeds and nurtures that 'leaf' that is Sql Developer.

           

          In either case you need to START the Journey from your desktop search engine.

           

          A search for 'oracle.ide.controller.Command returns over 100,000 results.

           

          Almost EVERY ONE on the first page has this one as the parent

          IdeAction (Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference)

           

          If you don't know what Fusion Middleware is then I suggest you begin there. That product is the trunk and  is 95% of the rest of the tree. You need to understand, at least at a high level, what that product is and what its purpose is.

           

          Then proceed to the JDeveloper 'branch' of the tree. Here is one of the main pages for JDeveloper extensions; a page that can be found on the VERY FIRST page of links in that simple web search

          https://java.net/projects/jdev-extensions/pages/Trigger-hooks

           

          Now I understand why you suggest I work entirely within the JDeveloper framework before trying to deploy to SQL

           

          I'm still not sure you do.

           

          I would venture that MOST of those web pages are for Fusion Middleware. A much smaller number are for JDeveloper extensions. An even tinier fraction mentions Sql Developer.

           

          Try rereading the parable about the 'blind man and the elephant' and see  the analogy.

          https://en.wikipedia.org/wiki/Blind_men_and_an_elephant

          1 person found this helpful
          • 2. Re: import oracle.ide.controller.Command
            Simon Greener

            I know you are trying to help, but I really don't want to read a lot of high level technology documentation on my lonesome.

             

            I guess my view on this is that I thought I could avoid spending time learning Fusion Middleware, JDeveloper etc, OSGi etc. After all,

            I am not a professional Java programmer, but someone who has worked on designing and implementing new functionality and algorithms within

            the existing GeoRaptor extension. We had people who did that but have moved on as their companies changed direction.

             

            The idea of having to spend weeks trying to learn a high level technology to effectively teach myself how to hook in an existing extension

            I see as being highly wasteful of my time. Why aren't there better examples of how to create extensions from someone who is fully conversant with the technology?

             

            Or can you, as an obvious expert, suggest that I read a small set of documents in a particular order?

             

            Surely there is a middle ground for people like me?

             

            If there isn't, and it appears so, I guess I have to decide if I am going to proceed with the extension port or not.

             

            I have already spent many weeks thrashing around with the various examples that are out there (eg Bedent), I can see that the hole I am in is conceptual,

            but it seems to me that I could achieve what I want with some good examples.

             

            Ok, now I look at this URL you suggested (I have seen it before):

             

            https://java.net/projects/jdev-extensions/pages/Trigger-hooks

             

            And all there is on the <command-class> tag is that it "can be used in either hook because no client code is necessary to handle updating the command; the extension is initialized on command invocation."

             

            Brilliant description.

             

            So I go to the actual Javadoc for the class and I get this:

             

            "The Command interface defines the interface of all command objects. This interface consists of a procedure, doit, to execute a command. Concrete Command subclasses implement the necessary behavior to carry out a specific command. This interface also provides additional methods necessary to implement the undo service provided by the CommandProcessor. For the undo mechanism it is necessary to distinguish three types of commands: NO_CHANGE A command that require no undo. NORMAL A command that can be undone. NO_UNDO A command that cannot be undone, and which prevents the undo of previously performed normal commands. MULTI_NODE A command that can be undone, but that affects multiple files."

             

            What is a "Command Object" within the concept of an extension whether JDeveloper or SQL Developer? The Bedent tutorial says this:

             

            "The extension command class maps the extension to an internal identifier."

             

            But what does it actually do? Why is it needed?

             

            I then go to IdeAction javadoc:

             

            "An IdeAction is used when adding a menu and/or toobar button. An action object is associated with a specific command. When a menu or toolbar button is clicked on, the action determines the active view and tells the view controller to handle the command."

             

            Here the following conceptually complex objects are introduced in two sentences: IdeAction, Menu, Toolbar, Comment, "Active View", "View Controller". What documents out there will clarify these objects and show how they link together?

             

            I will try and make an assessment as to your suggested way forward in order to decide what I will do.

             

            Thanks

            Simon

            • 3. Re: import oracle.ide.controller.Command

              I know you are trying to help, but I really don't want to read a lot of high level technology documentation on my lonesome.

               

              Trying, yes. But I can't really address what you do, or do not, want to do. All I can address is the reality of what needs to be done.

               

              Maybe reading through the various threads I have posted, and the limited responses I have gotten, will make that 'reality' a little more apparent.

               

              I suggest you start with my last one from over a year ago.

              Re: SQL Developer 4.0.2.15.21 bug or incompatability with JDev 12.1.2 Extension SDK

               

              You can follow my chain of previous threads as deep as you care to go. That thread above links to a previous one in the Sql Dev forum and a parallel one in the JDev forum.

               

              Here is the last related one I posted in this forum over a year ago and never got a response.

              SQL Developer 4.0.2.15.21 bug or incompatibility with JDev 12.1.3 or Extension SDK

               

              1. I reproduced a sample extension provided by JDev - it worked just fine

              2. I modified that same, simple sample for Sql Dev  it did NOT work properly

               

              Still haven't figured out why or gotten any help myself. So my extensions are limited to JDev

               

              I guess my view on this is that I thought I could avoid spending time learning Fusion Middleware, JDeveloper etc, OSGi etc. After all,

              I am not a professional Java programmer, but someone who has worked on designing and implementing new functionality and algorithms within

              the existing GeoRaptor extension. We had people who did that but have moved on as their companies changed direction.

              And now you know just how 'distorted' that view likely is.

               

              You need to know the general architecture to understand how all of the pieces fit together. Sql Dev is, in large part, a subset of JDev functionality. They both do 'database' things (connect, query, etc). They both do 'menu' and 'nested menu' things.

               

              The JDev product is a more generic product and that dev team is larger and more oriented to supporting 3rd party extensions. The primary purpose of Sql Dev is to facilitate conversions from other DBs to Oracle. Beyond that there isn't much of an incentive for the Sql Dev team to support general questions or issues related to doing OTHER types of work.

               

              If you review the forum threads you will see that the Sql Dev team (even the product manager) does actively support and respond to questions in the forum. But the thrust of the forum is how to use Sql Dev for its intended purpose and to address questions/issues related to that.

               

              Extensions, especially the lazy-loading of the new framework, is a VERY ADVANCED functionality. The whole idea is to avoid loading EVERY extension at app startup time and only load them when they are actually used. Do it right and it works fine. Do it wrong and your extension may NEVER get loaded or may even appear to disappear after the first use.

              Why aren't there better examples of how to create extensions from someone who is fully conversant with the technology?

              AHA! Now I think I see where you are going.

               

              Are you wanting the same info I posted questions about over a year ago in this thread?

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

               

              Read that thread and the reply I got about new samples that will be forthcoming. I'm still waiting for them.

               

               

              So I go to the actual Javadoc for the class and I get this:

               

              "The Command interface defines the interface of all command objects. This interface consists of a procedure, doit, to execute a command. Concrete Command subclasses implement the necessary behavior to carry out a specific command. This interface also provides additional methods necessary to implement the undo service provided by the CommandProcessor. For the undo mechanism it is necessary to distinguish three types of commands: NO_CHANGE A command that require no undo. NORMAL A command that can be undone. NO_UNDO A command that cannot be undone, and which prevents the undo of previously performed normal commands. MULTI_NODE A command that can be undone, but that affects multiple files."

               

              What is a "Command Object" within the concept of an extension whether JDeveloper or SQL Developer? The Bedent tutorial says this:

               

              "The extension command class maps the extension to an internal identifier."

               

              But what does it actually do? Why is it needed?

               

              I then go to IdeAction javadoc:

               

              "An IdeAction is used when adding a menu and/or toobar button. An action object is associated with a specific command. When a menu or toolbar button is clicked on, the action determines the active view and tells the view controller to handle the command."

              Ok - those menu/toolbar 'actions' use integers as a unique ID. So if you add a new selection you might assign it a value of 87. Then you create a 'mapping' that maps that 87 to an actual instance of a 'command object' that knows how to execute that particular 'command'.

               

              So a menu pick ultimately is a synonym for a 'command'. That command interface is what you implement in a class that provides the required methods that do what YOU need to do for YOUR command.

               

              The WHY hasn't really changed from the old framework so you can review the old extension examples (from both JDev and Sql Dev) and look for Java files that implement that command interface and see what they do.

               

              It is the HOW that has changed with the new framework. And that is where the limited documentation issues come into play. With new code comes new bugs. Without having the 'official' docs you don't really now if something that doesn't quite work the way you expect is BROKEN - or if it just isn't meant to work that way.

               

              Nothing more for me to say. Leave the thread open and maybe someone from the Dev Team will chime in with an update.

               

              Other than that download the LATEST version of JDev and the LATEST version of the JDev extension SDK and the LATEST version of Sql Dev and hope those versions really do work together.

              1 person found this helpful