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.

Bug 37141 - Missing way how to explicitely deserialize singleton TopComponent instance using winsys API
Summary: Missing way how to explicitely deserialize singleton TopComponent instance us...
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 3.x
Hardware: All All
: P1 blocker (vote)
Assignee: mslama
URL:
Keywords:
Depends on:
Blocks: 37199
  Show dependency tree
 
Reported: 2003-11-11 12:12 UTC by Marian Mirilovic
Modified: 2008-12-22 18:52 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marian Mirilovic 2003-11-11 12:12:18 UTC
[nb winsys patched modules](031111), [jdk1.4.2_02]

Project tab is opened in Document Area!
Comment 1 Peter Zavadsky 2003-11-11 14:33:15 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.
Comment 2 mslama 2003-11-12 13:59:32 UTC
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.
Comment 3 mslama 2003-11-12 14:31:02 UTC
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).
Comment 4 Marian Mirilovic 2003-11-12 15:49:08 UTC
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 !
Comment 5 mslama 2003-11-13 13:22:49 UTC
Sorry going to create separate TASK for review.
Comment 6 Petr Pisl 2003-11-13 13:54:23 UTC
*** Issue 37188 has been marked as a duplicate of this issue. ***
Comment 7 mslama 2003-11-28 15:34:29 UTC
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.
Comment 8 Marian Mirilovic 2004-01-06 13:41:06 UTC
verified in [nb_dev](200401051900)