Re: TopComponent/setActivatedNodes not workin with a given layer.xml file.

Boris Heithecker <[email protected]>
Newsgroups gmane.comp.java.netbeans.modules.openide.devel
Message-ID <CAL465RE+LtFSzGMMfggiFohuwvyTEMG3023KLEgEcfrZ2=rJpg@mail.gmail.com>
Hello,
if the NPE is not because Node == null, you could provide some stack trace,
from TopComponent.setActivatedNodes() to the NPE.
Boris

2015-12-02 13:18 GMT+01:00 Casqueiro Gilles <[email protected]>:

> Hi Boris,
>
> Thanks for your reply. I had to cast the DataObject “env” to
> FileSupportDataObject, which implements  CloneableOpenSupport.Env to be
> able to call to call the constructor of the CloneableOpenSupport. Also I
> wonder why you made FileSupportCloneableOpenSupport static?
>
> Unfortunately, this new code didn’t solve the problem of the
> NullPointerException. I really think that there is a problem/conflict
>  behind the Customization module and the setActivatedNodes method. This is
> strange…
>
> Were you able to reproduce it?
>
> Gilles
>
>
>
> *From:* Boris Heithecker [mailto:[email protected]]
> *Sent:* mercredi 2 décembre 2015 10:57
> *To:* [email protected]
> *Subject:* [platform-dev] Re: TopComponent/setActivatedNodes not workin
> with a given layer.xml file.
>
>
>
> Try this in your FileSupportDataObject:
>
>
>
>  // private FileSupportDataNode node;
>
>   //  private final InstanceContent ic = new InstanceContent();
>
>   //  private final Lookup lkp;
>
>   //  private final FileSupportCloneableOpenSupport openCloneableOpenSupport;
>
>   //  private FileSupportTopComponent tc;
>
>
>
>
>
>     public FileSupportDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
>
>         super(pf, loader);
>
>   //      lkp = new ProxyLookup(getCookieSet().getLookup(), new AbstractLookup(ic));
>
>       FileSupportCloneableOpenSupport  openCloneableOpenSupport = new FileSupportCloneableOpenSupport(this);
>
> getCookieSet().assign(OpenSupport.class, openCloneableOpenSupport);
>
>
>
>    //     ic.add(openCloneableOpenSupport);
>
>
>
>     }
>
>
>
>     @Override
>
>     protected int associateLookup() {
>
>         return 1;
>
>     }
>
>
>
> //The method is create, not get...., the super class does the caching of the Node object
>
>     @Override
>
>     protected Node createNodeDelegate() {
>
>     //    if(node == null) {
>
>        return  new FileSupportDataNode(this, Children.LEAF, getLookup());
>
>      //   }
>
>       //  return node;
>
>     }
>
>
>
>    // @Override
>
>   //  public Lookup getLookup() {
>
>     //    return lkp;
>
>   //  }
>
>   @Override
>
>     public void unmarkModified() {
>
>         setModified(false);     // not sure
>
>     }
>
>
>
>     @Override
>
>     public CloneableOpenSupport findCloneableOpenSupport() {
>
>       //  return openCloneableOpenSupport;
>
> return getLookup().lookup(CloneableOpenSupport.class);
>
>     }
>
>
>
>     @Override
>
>     public void markModified() throws IOException {
>
>         setModified(true);      // not sure
>
>     }
>
>
>
>
>
>  public   static class FileSupportCloneableOpenSupport extends CloneableOpenSupport implements OpenCookie, ViewCookie, CloseCookie {
>
>
>
>         public FileSupportCloneableOpenSupport(DataObject env) {
>
>             super(env);
>
>         }
>
>
>
> //See above
>
>         @Override
>
>         protected CloneableTopComponent createCloneableTopComponent() {
>
>     //        if (tc == null) {
>
>                 return new FileSupportTopComponent(((DataObject) env).getLookup());
>
>  //           }
>
>   //          return tc;
>
>         }
>
>
>
>         @Override
>
>         protected String messageOpening() {
>
>             return FileSupportDataObject.this.getName() + " was opened.";
>
>         }
>
>
>
>         @Override
>
>         protected String messageOpened() {
>
>             return FileSupportDataObject.this.getName() + " was closed.";
>
>
>
> Boris
>
>
>
> 2015-12-01 11:40 GMT+01:00 Casqueiro Gilles <[email protected]>:
>
> Hi everybody,
>
> I have a NullPointer exception when I use the setActivatedNodes method
> from a TopComponent. I was able to reproduce the problem in a prototype by
> adding one of my modules responsible for the platform customization. This
> module basically contains only a layer.xml file and some  Wstcref and
> Wsmode files. I cannot figure out what happens with this module that
> prevents setActivatedNodes to work properly.
>
> Does someone could take a look at this prototype on GitHub?
> https://github.com/gil-c/DemoPropertiesWindowNotWorking.git. The steps to
> reproduce the problem are described in the README.md file.
>
> Thanks in advance
>
> 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.
>
> -----------------------------------------------------------------------
>
>
>
>
> -----------------------------------------------------------------------
>
> 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.
>
> -----------------------------------------------------------------------
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.