Question

I have an editor which can supply two different ContentOutlinePages to the outline, depending on the user's choice.

However, when I change the ContentOutlinePage to be displayed, I have to close and reopen the Outline View to see any changes. I understand that the Outline View requests a new ContentOutlinePage when the editor is activated, but is there a way to force it to request a new page at any other time?

I tried just calling

activePage.activate(editor);

where activePage is the active workbench page and editor ist the editor that is currently being displayed, but that didn't work.

Was it helpful?

Solution

Rather than have two content pages you could have one page that can show both of your outlines. To do this you cannot extend the normal ContentOutlinePage, instead you need a class like this:

public class MyContentOutlinePage extends Page 
   implements IContentOutlinePage, ISelectionChangedListener 

The amount of code in the standard ContentOutlinePage is quite small so it is not much extra work to implement a page which meets your needs.

Update: You would have one top level control containing the SashForm and TreeViewer and always return the top control in getControl(). You would hide either the SashForm or TreeViewer depending on which you want to show.

The top level control could be something like PageBook or a Composite using StackLayout.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top