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.
Looking forward to be enlightened. Thank you.
Edited by: saygili on 21-Sep-2012 02:02
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.
Does any of that make sense to you Shay?
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.
Hi JB, thank you for your consideration.
Yes, that's true I do use JDeveloper 22.214.171.124.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...
Edited by: saygili on Dec 11, 2012 10:45 AM
Edited by: saygili on Dec 18, 2012 10:48 PM
Edited by: saygili on Dec 22, 2012 10:30 PM
Edited by: saygili on Jan 3, 2013 9:47 AM
Edited by: saygili on Jan 4, 2013 12:12 PM
Edited by: saygili on Jan 10, 2013 9:52 AM