Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » how to place views when opening a perspective?
how to place views when opening a perspective? [message #499796] Tue, 24 November 2009 08:31 Go to next message
Luca Ferrari is currently offline Luca Ferrari
Messages: 159
Registered: November 2009
Senior Member
Hi all,
I'm working on my first RCP application and I've created the following perspective:

public class SkillPerspective implements IPerspectiveFactory {
    public void createInitialLayout(IPageLayout layout) {

	String editorArea_eclipse_rcp_id = layout.getEditorArea();
	

	layout.setEditorAreaVisible(true);
	

	layout.setFixed( true );
	
	// add the views to the perspective
	layout.addView(SkillFamilyTableView.ECLIPSE_RCP_ID, IPageLayout.TOP, 0.33f, editorArea_eclipse_rcp_id);
	layout.addView(SkillTableView.ECLIPSE_RCP_ID, IPageLayout.BOTTOM, 0.66f, SkillFamilyTableView.ECLIPSE_RCP_ID);

    }

}


Now, when in the application I switch to such perspective I find a first problem: if I open one of the views, such views are placed from right to left, and not one at the top and one at the bottom. So my first question is how to get the views placed accordingly to the perspective.
The second question is: how can I open automatically such views when the perspective is selected? If I select the above perspective nothing changes in the displayed views.

Thanks,
Luca
Re: how to place views when opening a perspective? [message #499945 is a reply to message #499796] Tue, 24 November 2009 15:04 Go to previous messageGo to next message
Luca Ferrari is currently offline Luca Ferrari
Messages: 159
Registered: November 2009
Senior Member
I'm really getting nuts, since if I open the SkillPerspective I see views that are not connected to such perspective. In fact the SkillPerspective (see the code I posted before) opens the SkillFamilyTableView and SkillTableView, while in the program I see opened anoter view called ScoreView.
The following is an excerpt of the plugin.xml. Anyone can give me a clue?

 <extension
         point="org.eclipse.ui.perspectives">
      <perspective
            name="Punteggi"
            class="hrpm.rcp.Perspective"
            id="Punteggi">
      </perspective>
      <perspective
            class="hrpm.rcp.gui.perspective.SkillPerspective"
            fixed="true"
            icon="img/skill.png"
            id="SkillPerspective"
            name="Competenze">
      </perspective>
   </extension>
Re: how to place views when opening a perspective? [message #500019 is a reply to message #499945] Tue, 24 November 2009 17:34 Go to previous messageGo to next message
Eclipse User
Originally posted by: rjl.third-monday.com

Luca,

I have good luck with creating perspective folders for views. This
allows me to declaratively add views from other plugins. My main
perspective class:

public class Perspective implements IPerspectiveFactory {

public static final String ID_PERSPECTIVE = "com.bst.optimizer";

public void createInitialLayout(IPageLayout layout) {
logg.debug("createInitialLayout(): ");

layout.setEditorAreaVisible(true);
String editorArea = layout.getEditorArea();
layout.createPlaceholderFolder("left", IPageLayout.LEFT, 0.30f,
editorArea);
layout.createPlaceholderFolder("bottom", IPageLayout.BOTTOM, 0.60f,
editorArea);
}
}

In the plugin.xml of other plugins:

<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension targetID="com.bst.optimizer">
<perspectiveShortcut id="com.bst.optimizer"/>
<view
closeable="false"
id="com.bst.optimizer.clientMgr.clientsView"
relationship="stack"
relative="left"
showTitle="true"
visible="true"/>

On 11/24/2009 09:04 AM, Luca Ferrari wrote:
> I'm really getting nuts, since if I open the SkillPerspective I see
> views that are not connected to such perspective. In fact the
> SkillPerspective (see the code I posted before) opens the
> SkillFamilyTableView and SkillTableView, while in the program I see
> opened anoter view called ScoreView.
> The following is an excerpt of the plugin.xml. Anyone can give me a clue?
>
>
> <extension
> point="org.eclipse.ui.perspectives">
> <perspective
> name="Punteggi"
> class="hrpm.rcp.Perspective"
> id="Punteggi">
> </perspective>
> <perspective
> class="hrpm.rcp.gui.perspective.SkillPerspective"
> fixed="true"
> icon="img/skill.png"
> id="SkillPerspective"
> name="Competenze">
> </perspective>
> </extension>
>
Re: how to place views when opening a perspective? [message #500255 is a reply to message #500019] Wed, 25 November 2009 14:04 Go to previous message
Luca Ferrari is currently offline Luca Ferrari
Messages: 159
Registered: November 2009
Senior Member
Thanks for the reply, but I had a hint watching the plugin.xml when I found the following piece of code:

 <extension
         point="org.eclipse.ui.perspectiveExtensions">
      <perspectiveExtension
            targetID="*">
         <view
               closeable="true"
               id="hrpm.rcp.gui.view.ScoreView"
               minimized="false"
               moveable="true"
               ratio="0.95f"
               relationship="top"
               relative="org.eclipse.ui.editorss"
               showTitle="true"
               visible="true">
         </view>
      </perspectiveExtension>
   </extension>


I removed it and now the perspective switch seems to work correctly.

Thanks.
Previous Topic:OpenOffice + RCP: impossible?
Next Topic:How to Set TableViewer in a Dialog as a Selection Provider
Goto Forum:
  


Current Time: Fri Oct 24 21:27:59 GMT 2014

Powered by FUDForum. Page generated in 0.05115 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software