I'm developing a simple extension in Jdeveloper. In my extension, I would like to start an action without having to click a menu item in toolbar, context menu, etc. In the documentation*, I see that there are several types of hooks, which can be used for different purposes. Even though I'm not really sure if using a hook would be my solution; I think there must be a replacement for the most widely seen usage in the examples, menu-hook, which makes an action gets initiated by a menu item click.
I was not able to find detailed explanation or usage example for different types of hooks usage neither in documentation nor in the extsamples directory. Moreover, I see that it is possible to implement "custom" hooks, but I couldn't get the idea how.
Could you please set me in a more correct direction with my need? Maybe there is even enough already in the docs, but I really was not able to make use of it, after weeks.
My ideal trigger would be: clicking a tab in the explorer to activate an editor. If this is a difficult action to catch, it's also okay that my addin initiates and my controller's update method is called when the JDeveloper starts.
I'm going to assume that you are working with the 11gR2 release of JDeveloper, since you are looking at Trigger Hooks.
When JDeveloper moved over to the OSGi framework, we removed the ability for an extension to automatically load on startup. This is done for many reasons, but the most prominent reason is performance. We now use a lazy-loading approach to extension management.
You need to re-think how and when a customer needs to use your extension. Can you explain a little more about what your extension does? I may be able to help with finding the proper trigger hook.
There is a little bit of documentation about trigger hooks located here:
You may find that your extension needs to be loaded when a specific technology scope is added or used in the project, or when a specific library is loaded in the project maybe. I really can't tell until I know more about what the extension does.
If you can provide a few more details like which specific version of JDev you are working with, what OS (and version) you're using, and the details of the extension itself, I will be more than happy to help out.
Yes, that's true I do use JDeveloper 18.104.22.168.0. My OS is Windows 7 Professional SP1 (actually an 2011-wise OBI installation).
The main purpose of my extension is very easy: To link the navigation window and the active editor. In the navigation window (most generally in the project tree), I would like JDeveloper to auto select the item that is correspondent to selected editor on the right hand side part of the default window scatter. So basic use case: user clicks a tab of an editor and activates it, the project tree selects the correspondent item.
I managed this with a presumely not very good approach, just to understand the basics for my needs (but it works primitively). I couldn't find a proper hook, so temporarily I placed it in the controller that made it work in each action happens in the IDE. If you want to have a look, here is the chunk of code finds the activated node and selects it in the project tree.
Now, my question is how to enable this behaviour in IDE by default. I don't want the end-user be mandatory to click a menu item or button for activating this behaviour. So, I believe I need a hook that enables my extension on either IDE startup or the first click on any editor pane tab. Though I don't know if you would agree with me with this, or foresee a better way for it.
I will really be glad to hear your opinions on how to proceed to make it a good-solution and also if any part or idea with my extension does not make enough sense for you. Thank you for your time.
I'm not sure if you can change the default behavior of a tab selection in the editor area.
Just so you'll know, if you click alt+home while you are in a specific code editor - JDeveloper will highlight the corresponding file in the application navigator.
Isn't there really any way to start an extension automatically with IDE startup? I mean maybe, instead of hooks, you guys could advice me to go for an alternative solution through a listener or another design pattern. I have no idea how to move on now...