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. Hope it helps, Boris
Am Do., 30. Aug. 2018 um 16:09 Uhr schrieb Andreas Sewe <s...@cqse.eu>: > Hi, > > I'm currently porting a plugin from Eclipse to NetBeans. So far, this > has been a quite pleasant experience, but now I am struggling with the > following: > > My plugin can open various selections in a Web browser. So I implemented > a generic "Open in Web Browser" ActionListener requiring a java.net.URI > as context object in its constructor. This works great for those Nodes I > create myself; there, I simply construct the URI and add it to the > Node's lookup. > > But how do I do this for Nodes I didn't implement myself, e.g., some of > the Nodes in the "Projects" tab? In Eclipse, I would register an > IAdapterFactory [1] that knows how to convert from, say, Project to URI. > Essentially, the lookup would contain a "virtual" URI whenever a Project > was present. > > AFAICT, InstanceContent.Converter [2] looks similar, but requires > cooperation from the creator of the node in question. So what is the > NetBeans way of tackling this issue? > > But maybe I am thinking about this the wrong way. So, any help is > greatly appreciated. > > Best wishes, > > Andreas > > [1] > < > https://help.eclipse.org/photon/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fextension-points%2Forg_eclipse_core_runtime_adapters.html > > > [2] > < > https://netbeans.apache.org/wiki/DevFaqNodeInjectingLookupContents.asciidoc > > > > -- > 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 > > -- Boris Heithecker Dr. Boris Heithecker Lüneburger Str. 30 28870 Ottersberg Tel.: 0 42 05/ 31 58 34