Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Howto contribute a perspective to a perspective stack?
Howto contribute a perspective to a perspective stack? [message #918842] Fri, 21 September 2012 11:54 Go to next message
techteam is currently offline techteam
Messages: 54
Registered: September 2010
Member
Hi,
I want to contribute a complete perspective including the views from a
fragment.e4xmi to the application model.
Inside the Application.e4.xmi I have defined:

<children xsi:type="basic:TrimmedWindow"
xmi:id="_XwsN6gMWEeKkEbp87BcYwQ" label="Application" width="500"
height="400">
<children xsi:type="advanced:PerspectiveStack"
xmi:id="_XwsN8gMWEeKkEbp87BcYwQ" elementId="de.ww.perspectivestack"
selectedElement="_XwsN8wMWEeKkEbp87BcYwQ">
<children xsi:type="advanced:Perspective"
xmi:id="_XwsN8wMWEeKkEbp87BcYwQ" elementId="de.ww.core.perspective"
label="Perspective">
<children .........


At my fragment.e4xmi I have defined the following Model Fragment:

<fragments xsi:type="fragment:StringModelFragment"
xmi:id="_kAkdUAPVEeKUqvnYpyiNPg" featurename="children"
parentElementId="de.ww.perspectivestack">
<elements xsi:type="advanced:Perspective"
xmi:id="_pZ4EUAPVEeKUqvnYpyiNPg" elementId="de.ww.docmgmt.perspective"
label="DocMgmt">
<children xsi:type="basic:PartSashContainer"
xmi:id="_BVhKoAPBEeKUqvnYpyiNPg"
elementId="de.ww.docmgmt.partsashcontainer.main" horizontal="true">
....
....
....
</children>
</elements>
</fragments>

I also add some more model fragments with handlers and commands.
So I add a Handler to switch to the defined perspective with the
following code:


@Execute
public void execute(MApplication app, EModelService modelService,
EPartService partService) {
MPerspective element =
(MPerspective) modelService.find("de.ww.docmgmt.perspective", app);
partService.switchPerspective(element);
}

But this method doesn't find the defined perspective and the
modelservice returns a null.


What have I do wrong???

Thanks in advance

Heiko
Re: Howto contribute a perspective to a perspective stack? [message #918869 is a reply to message #918842] Fri, 21 September 2012 12:27 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph Keimel
Messages: 353
Registered: December 2010
Location: Germany
Senior Member
Hi Heiko

your Handler-code looks good to me. I am doing the same thing, so it should work.

To test what your model looks like after start of the application, you can use the e4 live model editor.
1) You need to add some bundles to your product:
- org.eclipse.e4.tools.emf.liveeditor
- org.eclipse.e4.tools.emf.ui
- org.eclipse.e4.tools.emf.ui.script.js
and the required plug-ins
2) After you start the product like this, press Alt-Shift-F9

Now you can inspect your model and check, if all the elements are there and if the IDs are all correct.

Hope this helps!
Christoph
Re: Howto contribute a perspective to a perspective stack? [message #918890 is a reply to message #918869] Fri, 21 September 2012 12:51 Go to previous messageGo to next message
techteam is currently offline techteam
Messages: 54
Registered: September 2010
Member
Hi Christoph,

thanks for the tip, I have read about it but now used until now - it's a
nice feature. :)
It helps me to see that my defined perspective are not available at the
model.

And it helps to start an app with the option "clear workspace" sometime. :)

Now it works.

Greetings
Heiko

Am 21.09.2012 14:27, schrieb Christoph Keimel:
> Hi Heiko
>
> your Handler-code looks good to me. I am doing the same thing, so it
> should work.
>
> To test what your model looks like after start of the application, you
> can use the e4 live model editor.
> 1) You need to add some bundles to your product:
> - org.eclipse.e4.tools.emf.liveeditor
> - org.eclipse.e4.tools.emf.ui
> - org.eclipse.e4.tools.emf.ui.script.js
> and the required plug-ins
> 2) After you start the product like this, press Alt-Shift-F9
>
> Now you can inspect your model and check, if all the elements are there
> and if the IDs are all correct.
>
> Hope this helps!
> Christoph
Re: Howto contribute a perspective to a perspective stack? [message #919006 is a reply to message #918890] Fri, 21 September 2012 15:35 Go to previous message
Christoph Keimel is currently offline Christoph Keimel
Messages: 353
Registered: December 2010
Location: Germany
Senior Member
Hi Heiko

Great!

You might be interessted in this bug discussion concerning fragment contributions:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=389663

Greetings
Christoph
Previous Topic:Howto restart an e4 RCP application
Next Topic:DNDAddon Trouble
Goto Forum:
  


Current Time: Sat Sep 20 00:01:00 GMT 2014

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

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