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 | <CAL465RH4y_cF7Ph09=4bSsiW71WKr0bOWnAnt8pX-gDuwpFkBQ@mail.gmail.com> |
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.
>
> -----------------------------------------------------------------------
>