This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
See recent thread on nbdev. The current generated code in the TC template is a little optimistic that the layer files will always be intact - this code will throw an NPE if there is a problem with layer registration. I think you can break this as easily as setting the persistence type to persistence_never, and opening the component once and closing it and restarting - the original layer-defined file will be gone (same reason we have to [idiotically] keep empty usages and search results tabs open on restart - if we don't they'll open in the editor area on second invocation). The code should look more like this: public static TopComponent findDefault() { TopComponent tc = WindowManager.getDefault().findTopComponent(ID); if (tc == null) { tc = getDefault(); I'm tempted to suggest going further and generating an overridden open() method, ala public void open() { Mode m = WindowManager.getDefault().findMode("targetMode"); if (m != null) m.dockInto(this); super.open(); } but that might be overkill.
I'm not sure where this code should go. the TC or it's action? There's currently no FindDefault() method in the TC. Maybe the code you put in the open method should go into the findDefault() body.. docing when the default instance is not found.. on a more general note, I'm for fixing the winsys usecases and persistence rather then making winsys template buletproof with the current broken state.
I'm for that as well, but lets do something for 5.0. Most modules do the fallback to getDefault(), it seems reasonable; the NPE definitely isn't.
still not convinced it helps anything but hre you are.. findInstance() method added. Checking in project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/templateAction.javx; /cvs/apisupport/project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/templateAction.javx,v <-- templateAction.javx new revision: 1.9; previous revision: 1.8 done Checking in project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/templateTopComponent.javx; /cvs/apisupport/project/src/org/netbeans/modules/apisupport/project/ui/wizard/winsys/templateTopComponent.javx,v <-- templateTopComponent.javx new revision: 1.8; previous revision: 1.7 done Command Finished.
it looks fine