Hallo,

I wonder if one can have a splitted MultiView window by default.

When you create a new MultiView (e.g. after following the *File Type*
wizard) you end up to something like the following:

[image: Fig0.png]
One can click and drag the + button on the far right of the toolbar in
order to split the editor horizontally or vertically.

[image: Fig1.png]
Then you can click on *Source* on the left and *Visual* on the right editor
and be able to visualize your changes (unfortunately only after you save
your changes in the editor on the left these are visualized on the visual
representation on the right but anyway).

I wonder if there is a way to achieve this in MultiView or one has to
resolve to a pure JSplitPane solution instead?
[image: Fig2.png]
This view (where you have the editor on the left and whatever you type you
can see it visualized on the right at the same time) is very common and you
can find it also in other popular IDEs like Idea and Visual Studio Code.

My idea was to call the SplitAction, i.e. action that does the split (i.e.
what a user does manually by dragging the +) from the constructor of my
VisualElement class or call the splitComponent() method of a Splitable
TopComponent:

        final TopComponent tc =
WindowManager.getDefault().getRegistry().getActivated();
        if (tc != null) {
            setEnabled(true);
            if (tc instanceof Splitable && ((Splitable) tc).canSplit()) {
                ((Splitable)
tc).splitComponent(JSplitPane.HORIZONTAL_SPLIT, 150);
            }
        }

but both 'solutions' are impossible because both Splitable and SplitAction
are inside non-public packages. org.netbeans.core.spi.multiview module
doesn't seem to provide, unfortunately, any way to do a window split via
its public API, or does it?

Has anybody come across this or are there any ideas?

Thank you in advance.

John.

Reply via email to