Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Declaring parts being based on PartDescriptors in E4XMI
Declaring parts being based on PartDescriptors in E4XMI [message #926051] Fri, 28 September 2012 09:01 Go to next message
Ralph Schuster is currently offline Ralph SchusterFriend
Messages: 8
Registered: September 2012
Junior Member
Hi,

I have an application that needs to open three instances of the same part when starting up. I described the PartDescriptor but I can't get the parts being instantiated when the application comes up.

1) Is it possible to reference the part descriptor in the part description within e4xmi file? If so, how?

2) If not, at what stage I can use partService.create(descriptorId) to programmatically create the parts? I wasn't able to find a hook in the lifecycle where this is possible. Usually it throws an application saying that the application doesn't have any active window yet, e.g.

java.lang.IllegalStateException: Application does not have an active window
	at org.eclipse.e4.ui.internal.workbench.ApplicationPartServiceImpl.getActiveWindowService(ApplicationPartServiceImpl.java:36)
	at org.eclipse.e4.ui.internal.workbench.ApplicationPartServiceImpl.createPart(ApplicationPartServiceImpl.java:95)
	at myapp.rcp.ui.model.ApplicationLifecycleHook.addPart(ApplicationLifecycleHook.java:143)
	at myapp.rcp.ui.model.ApplicationLifecycleHook.configurePerspective(ApplicationLifecycleHook.java:109)
	at myapp.rcp.ui.model.ApplicationLifecycleHook.elementVisible(ApplicationLifecycleHook.java:78)
...
Re: Declaring parts being based on PartDescriptors in E4XMI [message #928581 is a reply to message #926051] Sun, 30 September 2012 19:37 Go to previous messageGo to next message
Sopot Cela is currently offline Sopot CelaFriend
Messages: 597
Registered: December 2010
Senior Member

1) No
2) The exception happens because the construction happens too early (even before the window is created). You can listen for the window activation event like described in http://www.eclipse.org/forums/index.php/mv/msg/383895/922990/#msg_922990 or you can also listen for the window-bringToTop event (explore the UIEvents interface for more possibilities)
Re: Declaring parts being based on PartDescriptors in E4XMI [message #928934 is a reply to message #926051] Mon, 01 October 2012 04:43 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5470
Registered: July 2009
Senior Member
Why not directly adding the them in the base model when they should show
up in the initial state?

Tom

Am 28.09.12 02:01, schrieb Ralph Schuster:
> Hi,
>
> I have an application that needs to open three instances of the same
> part when starting up. I described the PartDescriptor but I can't get
> the parts being instantiated when the application comes up.
>
> 1) Is it possible to reference the part descriptor in the part
> description within e4xmi file? If so, how?
>
> 2) If not, at what stage I can use partService.create(descriptorId) to
> programmatically create the parts? I wasn't able to find a hook in the
> lifecycle where this is possible. Usually it throws an application
> saying that the application doesn't have any active window yet, e.g.
>
>
> java.lang.IllegalStateException: Application does not have an active window
> at
> org.eclipse.e4.ui.internal.workbench.ApplicationPartServiceImpl.getActiveWindowService(ApplicationPartServiceImpl.java:36)
>
> at
> org.eclipse.e4.ui.internal.workbench.ApplicationPartServiceImpl.createPart(ApplicationPartServiceImpl.java:95)
>
> at
> myapp.rcp.ui.model.ApplicationLifecycleHook.addPart(ApplicationLifecycleHook.java:143)
>
> at
> myapp.rcp.ui.model.ApplicationLifecycleHook.configurePerspective(ApplicationLifecycleHook.java:109)
>
> at
> myapp.rcp.ui.model.ApplicationLifecycleHook.elementVisible(ApplicationLifecycleHook.java:78)
>
> ..
>
Re: Declaring parts being based on PartDescriptors in E4XMI [message #928977 is a reply to message #928934] Mon, 01 October 2012 05:41 Go to previous messageGo to next message
Ralph Schuster is currently offline Ralph SchusterFriend
Messages: 8
Registered: September 2012
Junior Member
Hi Tom,

because the parts will have menus and toolbars that all need then be repeated, and I still would need the part descriptor to open a new instance dynamically.

Of course this could be done in e4XMI, but the duplication of definition doesn't seem right at all to me.

Re: Declaring parts being based on PartDescriptors in E4XMI [message #929776 is a reply to message #928581] Mon, 01 October 2012 19:07 Go to previous messageGo to next message
Ralph Schuster is currently offline Ralph SchusterFriend
Messages: 8
Registered: September 2012
Junior Member
Hi Sopot,

I tried subscribe to all Window events (TOPIC_ALL) but none of them arrived. No BRINGTOFRONT, ACTIVATE or any other. Occasionally I see HEIGHT and WIDTH events in the startup.

Regards

Ralph
Re: Declaring parts being based on PartDescriptors in E4XMI [message #929842 is a reply to message #928977] Mon, 01 October 2012 20:31 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5470
Registered: July 2009
Senior Member
Ok - that's what snippets are good for! Add your template there and add
a processor which clones the snippet to your final destination (IIRC the
model service has support for that) ;-)

Tom

Am 30.09.12 22:41, schrieb Ralph Schuster:
> Hi Tom,
>
> because the parts will have menus and toolbars that all need then be
> repeated, and I still would need the part descriptor to open a new
> instance dynamically.
> Of course this could be done in e4XMI, but the duplication of definition
> doesn't seem right at all to me.
>
>
Previous Topic:.e4css Folder
Next Topic:Quick Context View from Navigate Menu
Goto Forum:
  


Current Time: Sat Nov 29 03:53:22 GMT 2014

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

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