Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-ui-dev] Sharing views across Perspectives (sometimes)

Some background:

There are currently 3 relevant concepts in the implementation: windows, 
pages, and perspectives.
A window is the usual concept.  The corresponding interface is 
IWorkbenchWindow.
A page defines the contents of the window, and has its own set of open 
editors and views.  The corresponding interface is IWorkbenchPage.
A perspective is the layout of the page (which views are visible, where 
they're positioned, whether they're fast views or not) and also defines 
which action sets, view shortcuts and perspective shortcuts are available. 
 The corresponding interface is IPerspectiveDescriptor.   Views and 
editors are shared across perspectives in the same page.

In 1.0, we had multiple pages per window, with a fixed perspective per 
page.
This caused problems with loss of context. 
For example, if you switched from Java to Debug, you had different pages, 
and hence a different set of editors in each one.
If you then started editing things in the Debug page, you could not switch 
back to the Java page and retain the same editors you had open in Debug.

In 2.0, we are moving to one page per window with a changeable perspective 
per page.
This is what you currently get with the default preferences. 
Changing the perspective in the toolbar combobox, or by choosing 
Perspective / Open, switches the perspective for the (single) page.
It's still possible to get multiple pages in 2.0 by changing the 
preferences to open perspectives in the same window instead of a new 
window, and to not reuse perspectives.
The "reuse perspectives" preference is a bit of a misnomer: it actually 
controls whether a page with the same input is reused to show the new 
perspective.

Which brings us to the notion of input.  A page can have an input, which 
views within it can use to seed what portion of the model (i.e. the 
workspace) they show.
For example, if you select a project in the Packages view and choose Open 
Perspective / Java, you will get a new page with that project as its 
input, showing the Java perspective.
The input of the page is indicated in the window titlebar. 
By default, the workspace root is the input.

Separate from all this, the editors and views may have some underlying 
model.
The built-in text editors have a shared document model, so if you have the 
same file open in separate pages, they're sharing the same document (if 
you have the same editor open in different perspectives of the same page, 
there's only one editor).
Views like the Navigator and Packages view have the workspace as their 
underlying model.
Different views and editors on the same model should update appropriately 
when the model changes, but each view and editor maintains its own 
selection, scroll position, etc.

I'm not sure about the behaviour you're seeing with the Hierarchy view. 
You would have to ask the JDT team or file a bug report if you think 
there's a problem.
The Hierarchy view does have its own preferences for tracking selection, 
which may be what you're seeing, e.g. if switching perspectives changes 
the selection which it is tracking.
Alternatively, you might have the preference selected to open hierarchies 
in their own perspective.  In this case, it's giving the class as the 
input, so you might be getting new windows or new pages for these 
depending on the other prefs mentioned above.

Nick






"Randy Hudson" <hudsonr@xxxxxxxxxx>
Sent by: platform-ui-dev-admin@xxxxxxxxxxx
03/01/02 03:59 PM
Please respond to platform-ui-dev

 
        To:     platform-ui-dev@xxxxxxxxxxx
        cc: 
        Subject:        Re: [platform-ui-dev] Sharing views across Perspectives (sometimes)

By page you mean an SWT Shell with multiple perspectives in it?  Or, by
Page do you mean when I morph from one perspective to another.  A agree
that reuse on morphing (via the combobox) makes sense.

I am talking about View reuse across multiple open perspectives within the
same Shell.

I think in some cases it makes sense to see the same thing everywhere. The
console for example, or maybe the Search view.  However, this could and
sometimes is being done by sharing the View's Model, and not necessarily
the View's instance.  For example, the Console View has the same document
model even across Shells.

Does anybody know WHY the hierarchy view does not have this problem?  It
does not share state across multiple perspectives in the same 
Window/Shell.
What is it doing?  Page flipping?

_______________________________________________
platform-ui-dev mailing list
platform-ui-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-ui-dev





Back to the top