The following behavior was observed with Eclipse 3.8 and RAP. A proposed fix can be found at the end of this message.
Let's say I define two perspectives sharing the same view "the.view":
Perspective P1
public class P1 implements IPerspectiveFactory {
public void createInitialLayout(IPageLayout layout) {
layout.addView("the.view", IPageLayout.LEFT, 0.3f,
layout.getEditorArea());
}
}
and Perspective P2
public class P2 implements IPerspectiveFactory {
public void createInitialLayout(IPageLayout layout) {
layout.addFastView("the.view");
}
}
That means the view "the.view" is a normal view in perspective P1 but a fast view in perspective P2.
If P1 is opened first and afterwards P2 then the view "the.view" disappears completely from P1 but is correctly shown as a fast view in P2.
I think this behavior is due to a bug in the org.eclipse.ui.internal.Perspective implementation in combination with the implementation of org.eclipse.ui.internal.WorkbenchPage#makeFastView.
If a new perspective is opened then the following code in org.eclipse.ui.internal.WorkbenchPage#createPerspective is executed:
Perspective persp = ((WorkbenchImplementation) Tweaklets.get(WorkbenchImplementation.KEY))
.createPerspective(desc, this);
perspList.add(persp);
The first instruction results in a call to org.eclipse.ui.internal.Perspective#loadPredefinedPersp which contains the following code for the intialization of fast views:
// Retrieve fast views
if (fastViewManager != null) {
ArrayList fastViews = layout.getFastViews();
for (Iterator fvIter = fastViews.iterator(); fvIter.hasNext();) {
IViewReference ref = (IViewReference) fvIter.next();
fastViewManager.addViewReference(FastViewBar.FASTVIEWBAR_ID, -1, ref,
!fvIter.hasNext());
}
}
This results in one or more calls to org.eclipse.ui.internal.WorkbenchPage#makeFastView which in turn modifies the currently active perspective
public void makeFastView(IViewReference ref) {
Perspective persp = getActivePerspective();
if (persp == null) {
return;
}
...
and not the one which is about to be initialized.
A possible fix would be to move the initialization of fast views into org.eclipse.ui.internal.Perspective#onActivate
private boolean fastViewsInitialized;
protected void onActivate() {
if (!fastViewsInitialized && fastViewManager != null) {
fastViewsInitialized = true;
for (Iterator fvIter = layout.getFastViews().iterator(); fvIter
.hasNext();) {
IViewReference ref = (IViewReference) fvIter.next();
fastViewManager.addViewReference(
FastViewBar.FASTVIEWBAR_ID, -1, ref,
!fvIter.hasNext());
}
}
...
}
Best regards,
Ken