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.
Addition of method: TopComponent WindowManager.findTopComponentForID(String tcID) is necessary to be able to deserialize singleton TopComponent instance using window system infrastructure. By this way deserialized instance is also registered in winsys so method findTopComponentID(TopComponent tc) will return correct ID. Addition of this method will fix issue #37141. Currently when module creates singleton TC instance using static accessor no data are deserialized so persistent state is effectively lost.
Exact signature of added method is: public TopComponent WindowManager.findTopComponentForID(String tcID)
How would this affect modules? Say if Component Inspector is not deserialized correctly now, what will I have to do with the new method to make it work?
Described in issue #37141: There must be 2 accessor methods: 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 First accessor is reserved only for winsys (InstanceDataObject) to be able to create correctly TC instance from settings file when method is given ie. no serialized data in settings file Second accessor will be used as standard singleton accessor by module. So module must add second accessor in addition to existing one which will call findTopComponentID. Of course module knows what is correct TC ID (settings file name) because module defines this TC in its layer.
I see. I assume that by 'findTopComponentID' and 'findTopComponentForID' you mean just the one method...
> I see. I assume that by 'findTopComponentID' and > 'findTopComponentForID' you mean just the one method. No NOT at all. These are 2 different methods!! String findTopComponentID(TopComponent) returns always String ID for TopComponent instance whereas TopComponent findTopComponentForID(String ID) returns TopComponent instance for String ID if possible (if there is such TopComponent instance already created or it is possible create it by desrialization). So these are two different but complementary methods. 'findTopComponentID' is already present in API. We want to add missing 'findTopComponentForID' (possible full name would be 'findTopComponentForTopComponentID' but it would be too long). If anybody have any suggestion for better name we can discuss it.
Okay, I was just confused by your > 2.call findTopComponentID("runtime") if it returns null... from above. So it was just a typo, should be ..ForID(.. As for naming these two methods, I'd like: String getTopComponentID(TopComponent tc) TopComponent findTopComponent(String id) That would make it clear. But you'd have to rename the existing method which is a problem. So I basically agree with what you propose.
Yes exactly. It was typo. Sorry for confusion. So again correctly: First accessor reserved for widow system should be: if (DEFAULT == null) { DEFAULT = new MyTopComponent(); } return DEFAULT; Second accessor used publicly: if (DEFAULT == null) { TopComponent tc = findTopComponentForID("runtime"); if (tc instanceof MyTopComponent) { DEFAULT = (MyTopComponent) tc; } if (DEFAULT == null) { call first accessor; } }
My slight preference is to name the new method as TopComponent findTopComponent(String id) to be consistent with other find methods of pattern <type> find<type> (....) and also knowing that even Marek made mistake when typing it.
go for fast track review
11/20/2003 is gone. No other comments applied. Does that mean Marek can go and implement this? I am assigning back to him, if that is an incorrect decision, please override today.
Ok. Going to add method TopComponent findTopComponent(String tcID) to WindowManager.
Fixed in main trunk. openide spec version changed to 4.15. Method TopComponent findTopComponent(String) added to WindowManager.