Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 331025

Summary: [Perspectives] View stack not correctly painted for a newly opened perspective
Product: [Eclipse Project] Platform Reporter: Peter Kullmann <peter.kullmann>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: hsoliwal, pwebster, remy.suen
Version: 3.6   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard: stalebug
Attachments:
Description Flags
Screen shot of the view stack after the perspective was opened none

Description Peter Kullmann CLA 2010-11-24 10:03:35 EST
This is from a news posting:
Hi, I have a problem in 3.6.x with perspectives that have a lot of views in a single view stack: If opened for the first time, the tab of the currently shown view is not selected and the blue line around the view is broken. The thin line between the tabs and the view is also missing (this is visible if the stack does not contain the active part). I have attached a screenshot showing this with a simple example.

To reproduce this, it is enough to create a new plug-in project with the RCP Mail Example template. In the file Perspective.java change the method to look like this:

  ...
  folder.addPlaceholder(View.ID + ":*");
  folder.addView(View.ID);
  for (int i = 0; i < 20; i++) {
    folder.addView(View.ID + ":" + i);
  }
  layout.getViewLayout(NavigationView.ID).setCloseable(false);
  ...

(just adding the three lines with the loop).

I saw this on Macs and also on Windows. It worked fine in 3.5.x and before.
Comment 1 Peter Kullmann CLA 2010-11-24 10:05:16 EST
I have been looking at some of the code and tried to understand what changed between 3.5.x and 3.6 but wasn't able to find it.
Comment 2 Peter Kullmann CLA 2010-11-24 10:59:23 EST
Created attachment 183775 [details]
Screen shot of the view stack after the perspective was opened
Comment 3 Hitesh CLA 2010-12-09 09:13:15 EST
Paul, [WorkbenchParts] seemed like the best area to put this under. But if the bug is more appropriate for [ViewMgmt], or for that matter SWT, please move this accordingly. Thanks.
Comment 4 Peter Kullmann CLA 2011-09-09 02:47:14 EDT
This is still a problem in 3.7.
Comment 5 Peter Kullmann CLA 2014-01-07 11:26:51 EST
As a workaround I’m setting CTabFolder.setMRUVisible(false) and then again to true followed by a layout(true) call to the DefaultTabFolder instance. 

    private static void fixPanes(ViewStack stack) throws Exception {
        Field field = PartStack.class.getDeclaredField("presentationSite");
        field.setAccessible(true);
        DefaultStackPresentationSite presentation = (DefaultStackPresentationSite) field
                .get(stack);
        TabbedStackPresentation stackPresentation = (TabbedStackPresentation) presentation
                .getPresentation();
        if (!(stackPresentation.getTabFolder() instanceof DefaultTabFolder))
            return;
        DefaultTabFolder tabFolder = (DefaultTabFolder) stackPresentation
                .getTabFolder();
        Field paneFolderField = DefaultTabFolder.class
                .getDeclaredField("paneFolder");
        paneFolderField.setAccessible(true);
        PaneFolder paneFolder = (PaneFolder) paneFolderField.get(tabFolder);
        CTabFolder ctabFolder = (CTabFolder) paneFolder.getControl();
        ctabFolder.setMRUVisible(false);
        ctabFolder.setMRUVisible(true);
        tabFolder.layout(true);
    }

Just in case, someone could use it.
Comment 6 Paul Webster CLA 2014-01-09 11:12:32 EST
Thanks for the update, Peter.

In Kepler things are done differently (PartStack doesn't exist) so it might need a different workaround.

PW
Comment 7 Eclipse Genie CLA 2020-01-26 11:52:19 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.