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.
There is missing convenient API to access the multiview TopComponent instance from its client implementations. Either you implement MultiViewElement, MultiViewDescription you have no API to access the enclosing multiview TopComponent instance.
The MultiViewElement implementation is passed the MultiViewCallback that does have the getTopComponent() method for accessing the enclosing TC. The MVDescriptions should be just simple lazy placeholders for elements. closing as worksforme because such API is there already.
That works only after the element was first time selected (just then the callback is initiated), but up to that point (until is selected), there is no such API. We need such a cawe when element needs to change the display name of the multiview, but it wasn't selected yet. Also keep in mind that all the elements could be implemented in different modules, so there is no way to access the selected element and get the info from it.
I don't see a solution for your scenario. The element that was not selected yet, was not even created yet. That happens only when you select it (both instantiation and the callback instance injection) that's as designed, the only reason why there is MVDescription and MVElement split is the performance issue with creating multiple full blown view instances at startup. can you describe in more details what the actual usecase is?
I think I described it already. In sum there is missing conveniet API to retrieve enclosing multiview component for a component which is an element of the multiview and vice versa, something like this: TopComponent MultiViews.findEnclosingMultiViewTopComponent(JComponent element); which would return enclosing multiview topcomponent for provided element or null if there is no such. JComponent[] MultiViews.getElements(TopComponent multiView); which would return element components for specified multiview TopComponent or null if the specified topcomponent is not a multiview. JComponent MultiViews.getSelectedElement(TopComponent multiView); which would return selected element for specified multiview TopComponent or null if the specified top component is not a multiview. Also useful could be: boolean MultiViews.isMultiView(TopComponent tc); Missing those basic API's causes a lot of problems for implementors. I.e. such a basic task like setting display name and tooltip on the multiview according changes in the elements (or surrounding implementation, typically editor support) top component becomes extremelly difficult task. As an example. Have a look at the implementation of form multiview (FormEditorSupport) and the presence of the 'multiviewTC' variable, .. that hack is needed due to absence of that API. And now imagine you implement the elements of the same multiview in different (independent) modules, then you need to hack it even more, and the code becomes very clumsy. I don't understand why don't you provide that API (which I would expect will be there at the beginning and before all the others). It is like providing an API for a List whithout any possibility to retrieve the elements it contains.
pzavadsky, this is still valid am I right?