how to place views when opening a perspective? [message #499796] |
Tue, 24 November 2009 08:31 |
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 #500019 is a reply to message #499945] |
Tue, 24 November 2009 17:34 |
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>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03841 seconds