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.
Summary: | Missing way how to explicitely deserialize singleton TopComponent instance using winsys API | ||
---|---|---|---|
Product: | platform | Reporter: | Marian Mirilovic <mmirilovic> |
Component: | Window System | Assignee: | mslama <mslama> |
Status: | VERIFIED FIXED | ||
Severity: | blocker | CC: | pzavadsky |
Priority: | P1 | ||
Version: | 3.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | |
Bug Depends on: | |||
Bug Blocks: | 37199 |
Description
Marian Mirilovic
2003-11-11 12:12:18 UTC
The problem seems to be signigicant. There is deserialized closed TC (project tab) with id "project", but when the instance created and asking for its ID, it is constructed new one "Project Default". It needs to be assured that such ID is linked correctly in persistence. There is no way how to deserialize singleton TopComponent instance from module. Currently it is only possible internaly from window system. It means that following scenario does not work: 1.Start IDE. Module defines closed singleton TopComponent instance using settings file in its layer. Module can create TC instance using static accessor eg. MyTopComp.getDefault() but it looses persistent state serialized in settings file. Possible solution is to add method to WindowManager to create TC instance using deserialization. TopComponent WindowManager.findTopComponentForID(String tcID) Parametr tcID is unique TC ID equals to name of settings file by which is TC defined in module layer. eg. findTopComponentID("runtime") will deserialize Runtime tab. It can return null if corresponding serialized tc is not found. TopComponent must have 2 static accessor methods: 1.create instance using constructor: if (DEFAULT == null) { DEFAULT = new MyTopComponent(); } 2.call findTopComponentID("runtime") if it returns null (nothing is serialized) call first accessor method By this way we make sure that singleton TC instance is persistent using winsys infrastructure and created TC instance is registered in winsys TC cache ie. ID returned by findTopComponentID() matches to persistent TC ID (name of settings file). This would not possible if TC instance would be created using accessor method (1) This issue was discovered now as we started using TC ID in winsys model instead of TC instances (to avoid immediate instantiation of all TCs during IDE startup) but it was present in old winsys too. I forgot to add: First accessor method is used to create TC instance from IntanceDataObject using method attribute for the first time when settings file from module layer is used: <instance class="org.netbeans.modules.debugger.support.nodes.BreakpointsView" method="getDefault"/> When TC is serialized serial data element is saved in settings file so next time it is deserialized by standard way (readExternal()/readResolve() is called). The same problem is with Palette and Component Inspactor, if you invoke opening these two windows without previous opening in the GUI Editing mode, both are opened in the Document Area as new tabs ! Sorry going to create separate TASK for review. *** Issue 37188 has been marked as a duplicate of this issue. *** Fixed (together with Peter) all known singleton TopComponents now use WindowManager.findTopComponent(String) to access instance in their standard accessor. API doc will be updated too. verified in [nb_dev](200401051900) |