class StreamTextView implements MouseMotionListener, AncestorListener
{
    private final ToolTipController tTController;

    private JPanel mainPanel;
    private JTextPane textPane;
    private Searcher searcher;

    /**
     * Constructor.
     * @param document StyledDocument instance which is supposed to be shown in the pane.
     * @param controller ToolTipController instance.
     */
    StreamTextView(StyledDocument document, ToolTipController controller)
    {
        tTController = controller;
        initUI(document);
    }

    private void initUI(StyledDocument document)
    {
        mainPanel = new JPanel();

        textPane = new JTextPane(document);
        textPane.addMouseMotionListener(this);
        textPane.setFont(new Font("monospaced", Font.PLAIN, 13));
        searcher = new Searcher(textPane);

        JScrollPane scrollPane = new JScrollPane(textPane);

        BoxLayout boxLayout = new BoxLayout(mainPanel, BoxLayout.Y_AXIS);

        mainPanel.setLayout(boxLayout);

        mainPanel.add(searcher.getSearchPanel());
        mainPanel.add(scrollPane);

        searcher.getSearchPanel().setVisible(false);

        mainPanel.addAncestorListener(this);

    }

    JComponent getView()
    {
        return mainPanel;
    }

    @Override
    public void mouseDragged(MouseEvent mouseEvent)
    {
        // do nothing
    }

    @Override
    public void mouseMoved(MouseEvent mouseEvent)
    {
        if (tTController != null)
        {
            int offset = textPane.viewToModel2D(mouseEvent.getPoint());
            textPane.setToolTipText(tTController.getToolTip(offset, textPane));
        }
    }

    @Override
    public void ancestorAdded(AncestorEvent ancestorEvent)
    {<FILL_FUNCTION_BODY>}

    @Override
    public void ancestorRemoved(AncestorEvent ancestorEvent)
    {
        if (ancestorEvent.getAncestor().equals(mainPanel))
        {
            PDFDebugger debugger = (PDFDebugger) SwingUtilities.getRoot(mainPanel);
            debugger.getFindMenu().setEnabled(false);
            searcher.removeMenuListeners(debugger);
        }
    }

    @Override
    public void ancestorMoved(AncestorEvent ancestorEvent)
    {
        // do nothing
    }
}

        if (ancestorEvent.getAncestor().equals(mainPanel))
        {
            PDFDebugger debugger = (PDFDebugger) SwingUtilities.getRoot(mainPanel);
            debugger.getFindMenu().setEnabled(true);
            searcher.addMenuListeners(debugger);
        }
    
<no_super_class>