Problem getting getOpenedPanes to interact properly with multiview editors

View: New views
1 Messages — Rating Filter:   Alert me  

Problem getting getOpenedPanes to interact properly with multiview editors

by KM :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Suppose I want to display source files for some programming language L in a multiview editor.  I then define a second tab showing the corresponding assembler code I generate from the source.  I will have a CloneableEditorSupport subclass for the L file type and when I open files of type L within the netbeans IDE (or a platform app derived from it) the getOpenedPanes() call within the CloneableEditorSupport implementation for L will return the opened panes.  However, when I call getOpenedPanes using the CloneableEditorSupport implementation for the assemebler files then it only shows the panes that have been directly opened, i.e. it misses out those panes that appear as tabs within the multiview source editor panes.  

Now I could change the code that looks for opened assembler panes so that it not only calls getOpenedPanes, but also does the same for the source file from which the assembler file was derived, and from the source panes locate any opened assembler tabs attached to them.  But that seems messy.  I could make things a bit neater by redefining the definition of getOpenedPanes in the CloneableEditorSupport implementation for the assembler file type to do the same thing, but it still feels a bit messy.  Ideally when I use the assembler support class to create the assembler tab associated with a source file it should add the created pane to the set of opened panes associated with this support instance.  At present I just pass the support instance as a constructor argument to my subclass of CloneableEditor when creating the assembler tab.  Is there some other bit of magic I'm missing that will add the resulting pane to allEditors, which is what I presume getOpenedPanes uses?  Or is overriding the definition of getOpenedPanes the recommended way of doing this?  Or perhaps the intention is that getOpenedPanes should only return the top-level opened panes associated with the support class and I should define a completely different method to capture what I want?  Or is this just a bug...?