Hi Boris. Andreas Sewe wrote: > Boris Heithecker wrote: >> I think you'll have to implement an action (extending Action or >> AbstractAction, not ActionListener) that implements >> "org.openide.util.ContextAwareAction". >> Its business method is expected to create a proxy action for the context >> passed to it. This context is the current user selection of nodes, or >> the content of these nodes. >> I guess you'd have to find various methods to extract your URI from this >> lookup and pass it to the proxy action created. For example look-up a >> Project and, if present, extract an URI. >> If no URI at all can be extracted, nevertheless return an action, but >> its state should be disabled.
For other readers, org.netbeans.modules.html.editor.ViewAction is a nice example of this, but... >> Hope it helps, > > Thank you very much for this suggestion, Boris. That sounds like a good > direction to explore. ...I'm afraid I couldn't get this to work. Here's the problem I am facing: - My URI-taking action is a simple ActionListener and I would like to keep it that way. - If I now create a ContextAwareAction, I can convert whatever it finds in the lookup into a URI in createContextAwareInstance, but then I need to return an Action. - But I have only an ActionListener. I looked through org.openide.awt.Actions to see whether I can call one of the methods that are used under the hood for the ActionListener -> Action conversion, but they are either non-public or hardcoded to Utilities.actionsGlobalContext(), so I can really get my URI injected into the ActionListener. Any suggestions how to proceed? Best wishes, Andreas -- Dr. Andreas Sewe | s...@cqse.eu | +49 152 56342856 CQSE GmbH | Lichtenbergstrasse 8 | 85748 Garching | www.cqse.eu Amtsgericht Muenchen | HRB 177678 | GF: F. Deissenboeck, M. Feilkas
signature.asc
Description: OpenPGP digital signature