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

Bug 88730

Summary: [Perspectives] Allow to specify orientation of a fastview in plugin.xml
Product: [Eclipse Project] Platform Reporter: Yves <techyves>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED WONTFIX QA Contact:
Severity: enhancement    
Priority: P5 CC: ankit.200490, charafcs, lafeuil, sxenos, thomas.darimont
Version: 3.1Keywords: helpwanted
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard: stalebug

Description Yves CLA 2005-03-22 07:40:31 EST
When defining an extension "perspectiveExtension", you can add views.

It should be possible to specify in "plugin.xml" the initial orientation of a 
view when it becomes a fastview. Something like : 
fastvieworientation="horizontal".
Comment 1 Eddie Galvez CLA 2005-07-27 14:20:33 EDT
Our product needs this -- could this be done soon? Is there any workaround possible?
Comment 2 Eddie Galvez CLA 2005-07-27 15:26:17 EDT
workaround (ugly ugly! so ugly we cant use it for our release)

 drop a cleverly constructed workbench.xml in the
.metadata/.plugins/org.eclipse.ui.workbench for the workspace that contains:

<?xml version="1.0" encoding="UTF-8"?>
 <workbench version="2.0">
 
 <window x="0" y="0" width="1024" height="768">
 
 <fastViewData fastViewLocation="1024">
 <orientation view="com.streambase.sb.ide.views.PropertiesView" position="256"/>
 </fastViewData>
 
 <fastViews>
 <view id="com.streambase.sb.ide.views.PropertiesView" ratio="0.6"/>
 </fastViews>
 
 </window>
 
 </workbench>

  Where position=256 means horizontal, position=512 means vertical.
Comment 3 Nick Edgar CLA 2005-07-28 11:20:56 EDT
Eddie, there are no immediate plans to address this one.
If you'd like to investigate a patch, that would greatly increase the likelihood
of it going into 3.2.  The place to start would be
PerspectiveExtensionReader.processView (in the org.eclipse.ui.workbench plug-in).

The entrypoint, PerspectiveExtensionReader.extendLayout, is called during
perspective creation from Perspective.loadPredefinedPersp.
Comment 4 Nick Edgar CLA 2006-03-15 11:46:53 EST
Reassigning bugs in component areas that are changing ownership.
Comment 5 Paul Webster CLA 2006-09-28 11:00:53 EDT
There are currently no plans to work on this feature.

PW
Comment 6 Denis Roy CLA 2007-06-22 09:32:50 EDT
Changes requested on bug 193523
Comment 7 ankit chauhan CLA 2014-06-05 02:31:52 EDT
Hi,

In your setFocus() method of your fast view just do this:

IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        if( page != null )
        {
            IViewReference[] viewReferences = page.getViewReferences();
            for( IViewReference ivr : viewReferences )
            {
                if( ivr.getId().equalsIgnoreCase(YOUR_VIEW_ID ) )
                {
                    ( (WorkbenchWindow)             PlatformUI.getWorkbench().getActiveWorkbenchWindow() ).getFastViewBar().setOrientation(
                            ivr, SWT.HORIZONTAL );
                }
            }
        }
Comment 8 Paul Webster CLA 2014-06-13 10:23:54 EDT
(In reply to ankit chauhan from comment #7)
> Hi,
> 
> In your setFocus() method of your fast view just do this:

Just a note that setFocus() is only called when the tab is clicked, not necessarily when the view is activated, and more generally this won't work in 4.x (Juno onwards) at all as the fastview implementation changed.

PW
Comment 9 ankit chauhan CLA 2014-06-18 01:45:27 EDT
Hi Paul. There's another solution for this but I don't know whether this will work in eclipse 4.x or not. Here's the solution: After create a view(fast) just set the 
state to minimize(so no need to declare in setFocus()):-

/**
 * @param state - one of the IWorkbenchPage STATE_* values: STATE_MAXIMIZED,        *STATE_MINIMIZED, STATE_RESTORED
 * @unpublished
 */
 public void setViewState( int state )
    {
        IWorkbenchPage page =  PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        int currentState = page.getPartState( page.getReference( this ) );
        if( currentState != state )
        {
            page.activate( this );
            page.setPartState( page.getReference( this ), state );
        }
    }


so when you pass '0' in setViewState it will make the default orientation to horizontal.

Hope this will work :)
Comment 10 ankit chauhan CLA 2014-06-18 01:54:34 EDT
So the code from my last two comment in combination will temporarily allow you to put default orientation to horizontal() without using setFocus() method. Hope there will be a permanent solution. :)
Comment 11 Lars Vogel CLA 2019-11-27 07:07:08 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.

If you have further information on the current state of the bug, please add it.
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.

If the bug is still relevant, please remove the stalebug whiteboard tag.