Skip to main content



      Home
Home » Eclipse Projects » Eclipse 4 » Multiple Perspectives in an RCP e4 Application
Multiple Perspectives in an RCP e4 Application [message #870268] Mon, 07 May 2012 10:22 Go to next message
Eclipse UserFriend
I'm considering how to port an existing RCP 3 Appl to the new e4 application platform and I have questions related to the concept of Perspectives.

1. If I have more than one perspective, are these perspectives defined in my application model through the PerspectiveStack/Perspective entries?

2. How do I define the initial perspective? In other words, where do I implement the functions provided by the getInitialWindowPerspectiveId() method of the workbench advisor component of RCP 3.x?

Thanks
fausto
Re: Multiple Perspectives in an RCP e4 Application [message #870276 is a reply to message #870268] Mon, 07 May 2012 10:37 Go to previous messageGo to next message
Eclipse UserFriend
Am 07.05.12 16:22, schrieb Fausto Telia:
> I'm considering how to port an existing RCP 3 Appl to the new e4
> application platform and I have questions related to the concept of
> Perspectives.
>
> 1. If I have more than one perspective, are these perspectives defined
> in my application model through the PerspectiveStack/Perspective entries?
>

Yes.

> 2. How do I define the initial perspective? In other words, where do I
> implement the functions provided by the getInitialWindowPerspectiveId()
> method of the workbench advisor component of RCP 3.x?
>

If you look at the PerspectiveStack you should see a "Selected Element"
attribute this is the currently active Perspective.

Tom
Re: Multiple Perspectives in an RCP e4 Application [message #870339 is a reply to message #870276] Mon, 07 May 2012 13:03 Go to previous messageGo to next message
Eclipse UserFriend
Tom,
the getInitialPerspectiveId() method allows the RCP application at runtime to define which perspective should be the initial one based on some kind of application data, while the selected attribute in the Application model looks to me something to be set at definition time not at execution time.

Or is there any API that can be used when the RCP e4 appl starts in order to set the selected attribute in the application model so that the application may define the initial perspective?

fausto
Re: Multiple Perspectives in an RCP e4 Application [message #870341 is a reply to message #870339] Mon, 07 May 2012 13:09 Go to previous messageGo to next message
Eclipse UserFriend
That's only true if you are not using saveAndRestore IIRC!

You can control this from the lifecycle by accessing the model before it
gets rendered and modify the selected element value to your needs.

So you'd have something like this:

class MyLifecycle {

@ProcessAdditions
void process(MApplication app) {
MPerspectiveStack stack = app.getWindows().get(0).getChildren().get(0);

stack.setSelectedElement(stack.getChildren().get(1))
}

}

This will select the 2nd perspective.

Tom

Am 07.05.12 19:03, schrieb Fausto Telia:
> Tom,
> the getInitialPerspectiveId() method allows the RCP application at
> runtime to define which perspective should be the initial one based on
> some kind of application data, while the selected attribute in the
> Application model looks to me something to be set at definition time not
> at execution time.
> Or is there any API that can be used when the RCP e4 appl starts in
> order to set the selected attribute in the application model so that the
> application may define the initial perspective?
>
> fausto
Re: Multiple Perspectives in an RCP e4 Application [message #870368 is a reply to message #870341] Mon, 07 May 2012 16:12 Go to previous messageGo to next message
Eclipse UserFriend
Tom,
it works, but I had to change a little your code. This is my working sample

@ProcessAdditions
void process(MApplication app) {

MWindow l = app.getChildren().get(0);
MPerspectiveStack stack = (MPerspectiveStack) l.getChildren().get(0);

MPerspective perspectiveA = stack.getChildren().get(0);
System.out.println(perspectiveA.getLabel());

MPerspective perspectiveB = stack.getChildren().get(1);
System.out.println(perspectiveB.getLabel());

stack.setSelectedElement(perspectiveB);
}

I didn't find a getWindows() method for MApplication.

I'm using Build I20120315-1300. Do I have to download a different one?

Fausto

Re: Multiple Perspectives in an RCP e4 Application [message #870371 is a reply to message #870368] Mon, 07 May 2012 16:38 Go to previous message
Eclipse UserFriend
No the code was from the top of my head - no IDE running :-)

Tom

Am 07.05.12 22:12, schrieb Fausto Telia:
> Tom,
> it works, but I had to change a little your code. This is my working sample
>
> @ProcessAdditions
> void process(MApplication app) {
>
> MWindow l = app.getChildren().get(0);
> MPerspectiveStack stack = (MPerspectiveStack)
> l.getChildren().get(0);
>
> MPerspective perspectiveA = stack.getChildren().get(0);
> System.out.println(perspectiveA.getLabel());
>
> MPerspective perspectiveB = stack.getChildren().get(1);
> System.out.println(perspectiveB.getLabel());
>
> stack.setSelectedElement(perspectiveB);
> }
>
> I didn't find a getWindows() method for MApplication.
>
> I'm using Build I20120315-1300. Do I have to download a different one?
>
> Fausto
>
>
Previous Topic:Eclipse 3.x RCP application editor
Next Topic:Can't get visible-when to work
Goto Forum:
  


Current Time: Sun Jul 06 01:07:42 EDT 2025

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

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

Back to the top