Re: LogicalViewProvider.createLogicalView is called twice when project explorer is created. Why?
Tim Boudreau <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.modules.openide.devel |
|---|---|
| Message-ID | <CA+qecROhqpvtM35aXnDsBnaj8GT6VB2pTm89SsKbZq-hg0HTkg@mail.gmail.com> |
Cache the result of the first call. Better yet, initialize as little as possible up-front (you can do structural stuff on-demand when the node is expanded), but it's perfectly fine to cache the result. There's nothing in the API that guarantees that it will only be called once. -Tim On Mon, Feb 1, 2016 at 6:34 PM, Todd Stevenson <[email protected]> wrote: > I am looking at the tutorial found at > > > > > https://platform.netbeans.org/tutorials/nbm-projecttype.html#projectlogicalview > > > > and I’ve built it from the source found in the repository at: > > > > > https://java.net/projects/nb-api-samples/sources/api-samples/show/versions/7.2/tutorials/CustomerProjectType > > > > After I create a customer project as outlined in the tutorial and save it > and restart the component I can see that createLogicalView() is called > twice. (line 223 of CustomerProject.java). Is this correct behavior? It > seems that it should be called once when initializing the app. > > > > This is causing performance problems in my app because the initialization > of the project structure in my app is somewhat expensive. > > > > I’m using Netbeans 8.0.2. > > > > Any ideas? Any suggestions? > > > > Thank you. > > > > *Todd Stevenson* > > > -- http://timboudreau.com