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 252174 - EditorCookie.getEditorPanes() does not return both editors in split multiview
Summary: EditorCookie.getEditorPanes() does not return both editors in split multiview
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 8.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-30 07:53 UTC by Jaroslav Tulach
Modified: 2015-04-30 07:53 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Two editors, but only one is found (87.57 KB, image/jpeg)
2015-04-30 07:53 UTC, Jaroslav Tulach
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2015-04-30 07:53:38 UTC
Created attachment 153471 [details]
Two editors, but only one is found

Here is a sample action that prints all known JEditorPanes for currently selected node:

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JEditorPane;
import org.openide.cookies.EditorCookie;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionRegistration;
import org.openide.util.NbBundle.Messages;
import org.openide.windows.IOProvider;
import org.openide.windows.OutputWriter;

@ActionID(
    category = "Edit",
    id = "cz.xelfi.bug.listeditors.ListEditors"
)
@ActionRegistration(
    displayName = "#CTL_ListEditors"
)
@ActionReference(path = "Menu/Tools", position = 0)
@Messages("CTL_ListEditors=List Editors")
public final class ListEditors implements ActionListener {

    private final EditorCookie context;

    public ListEditors(EditorCookie context) {
        this.context = context;
    }

    @Override
    public void actionPerformed(ActionEvent ev) {
        OutputWriter out = IOProvider.getDefault().getStdOut();
        out.println("Listing editor panes for " + context);
        for (JEditorPane openedPane : context.getOpenedPanes()) {
            out.println("  pane: " + openedPane);
        }
        out.println("And that is all!");
    }
}


if you open multiview editor and split it to two parts (as the attached image shows), the action returns just one JEditorPane in spite it is clear that there are two.

This violates the expected API contract and makes it hard to 3rd party code to find out currently selected editor and its caret.