Re: Instanciate a DataNode wihout DataObject to display some properties
geertjan wielenga <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.modules.openide.devel |
|---|---|
| Organization | Oracle Corporation |
| Message-ID | <[email protected]> |
On 28-1-2016 10:59, Casqueiro Gilles wrote:
>
> Ok thanks, I successfully created a BeanNode with the appropriated
> createSheet method. This seems to work.
>
> Sorry for the next stupid question but I am unable to publish the Node
> into the Global Lookup…
>
The idea is not to publish the Node into the Lookup. The idea is that
when the user selects the Node, the Object that the Node visualizes is
published into the Lookup. That is done in the constructor of the Node.
Many tutorials on Node here: https://netbeans.org/kb/trails/platform.html
Also, please read the chapter on this topic hereL leanpub.com/nbp4beginners
Gj
> I have a table in the TopComponent, I listen for row selection and
> then I would like to dynamically update the exposed Node. I tried this
> first:
>
> lkp = new ProxyLookup(super.getLookup(), new AbstractLookup(ic)); //
> in the constructor
>
> with:
>
> @Override
>
> public Lookup getLookup() {
>
> return lkp;
>
> }
>
> And then I use the InstanceContent ic to manage the content of the
> Lookup. Unfortunately the following the always return null:
>
> Lookup.getDefault().lookup(MyBeanNode.class);
>
> I also tried this:
>
> ExplorerManager em = new ExplorerManager();
>
> associateLookup(ExplorerUtils.createLookup(em, this.getActionMap()));
>
> and then:
>
> Node[] nodes = new Node[1];
>
> nodes[0] = myBeanNode;
>
> em.setSelectedNodes(nodes);
>
> Also without success.
>
> Publishing a Node in the Global Lookup should be very standard… Sorry
> for this stupid question.
>
> Gilles
>
> *From:*Tim Boudreau [mailto:[email protected]]
> *Sent:* jeudi 28 janvier 2016 06:26
> *To:* [email protected]
> *Subject:* [platform-dev] Re: Instanciate a DataNode wihout DataObject
> to display some properties
>
> BeanNode or just a subclass of AbstractNode. DataNode is only useful
> for something that represents a file and you want to use, say the Save
> action or other file-related actions and want a lot of the plumbing
> for those built-in.
>
> -Tim
>
> On Wed, Jan 27, 2016 at 12:43 PM, Dmitriy Avtonomov
> <[email protected] <mailto:[email protected]>> wrote:
>
> Maybe you're looking for BeanNode?
>
> On Wed, Jan 27, 2016 at 12:23 PM, Casqueiro Gilles
> <[email protected] <mailto:[email protected]>> wrote:
>
> Hello,
>
> Is it possible to have a DataNode without any DataObject? If possible
> I would like to publish it in the Global Lookup and use its
> createSheet method to display some info in the Property window. I work
> with beans that don’t necessarily have any associated file on disk.
>
> Not sure if this approach is correct.
>
> Gilles
>
>
>
> -----------------------------------------------------------------------
>
> Le informazioni contenute in questo messaggio di posta elettronica e
> relativi allegati sono riservate e confidenziali e ne è vietata la
> diffusione in qualunque modo eseguita. Qualora Lei non fosse la
> persona a cui il presente messaggio è destinato, La invitiamo ad
> eliminarlo e a darcene gentile comunicazione.
>
> The information contained in this e-mail and any attachments is
> confidential and may also be privileged. If you are not the named
> recipient please notify the sender immediately and do not disclose the
> contents to any other person, use it for any purpose, or store or copy
> the information in any medium.
>
> -----------------------------------------------------------------------
>
>
>
> --
>
> http://timboudreau.com
>
>
>
> -----------------------------------------------------------------------
>
> Le informazioni contenute in questo messaggio di posta elettronica e
> relativi allegati sono riservate e confidenziali e ne è vietata la
> diffusione in qualunque modo eseguita. Qualora Lei non fosse la
> persona a cui il presente messaggio è destinato, La invitiamo ad
> eliminarlo e a darcene gentile comunicazione.
>
> The information contained in this e-mail and any attachments is
> confidential and may also be privileged. If you are not the named
> recipient please notify the sender immediately and do not disclose the
> contents to any other person, use it for any purpose, or store or copy
> the information in any medium.
>
> -----------------------------------------------------------------------