|
Re: Add an Extension dynamically [message #128432 is a reply to message #128196] |
Fri, 17 April 2009 08:47   |
Maghen Calinghee Messages: 23 Registered: July 2009 |
Junior Member |
|
|
Hi,
Finally I will answer to my own post. I might be useful to someone.
In RCP, it's not that difficult to add an extension in a programmatic way.
I've added an extension into the createPartControl() method of a ViewPart
and it works fine.
But in RAP, we need to be careful because in the createPartControl(), i
think we work in a thread which is specific to a session (and it's logic).
In RAP, we have multiple session at a time so we need be careful about we
do. (see
http://dev.eclipse.org/newslists/news.eclipse.technology.rap /msg01335.html).
So as we work in a thread which is specific to a session, this thread is
not shared with the others sessions and i don't think from this thread we
can add contributions because we can not load a plugin onto an application
which is shared with the others sessions.
So the only solution that i have found to add an extension is to do it in
the Activator#start() method, because from the start() method's thread, we
can provide to the OSGI platform and load plugin. This thread is not
specific to a session.
I'm not sure about what i'm saying here but it will be great, if someone
could confirm this. Maybe it will help others developpers to understand
differences between RAP and RCP, and how we need to be careful about what
we do in RAP.
Thanks you.
Maghen.
|
|
|
Re: Add an Extension dynamically [message #128458 is a reply to message #128432] |
Fri, 17 April 2009 13:50  |
Rüdiger Herrmann Messages: 581 Registered: July 2009 |
Senior Member |
|
|
Hi Maghen,
let me try to clarify a bit on this topic.
Right, there is only one extension registry (same as in RCP). What
caused the exception was a registry change listener that was added
by the workbench, at least that's what the stack trace suggests.
A workbench in RAP lives in the "session scope". All workbench code
(e.g. the registry change listener) should be executed on the UI
thread that is associated to the session.
If you put the addContribution() call in the Activator, there is no
workbench yet - thus no listeners.
Calling addContribution() while there are workbench instances
listening should not cause this exception, but will most certainly
lead to unexpected results.
So goes the theory. What I am not sure about is, why the exception
occurred if you were calling addContribution() from within a
session. If you like to, open a bugzilla so we can investigate this
further. Attach a use case and/or the code to reproduce the problem.
HTH
Rüdiger
Maghen Calinghee wrote:
> Hi,
>
> Finally I will answer to my own post. I might be useful to someone.
> In RCP, it's not that difficult to add an extension in a programmatic
> way. I've added an extension into the createPartControl() method of a
> ViewPart and it works fine. But in RAP, we need to be careful because in
> the createPartControl(), i think we work in a thread which is specific
> to a session (and it's logic). In RAP, we have multiple session at a
> time so we need be careful about we do. (see
> http://dev.eclipse.org/newslists/news.eclipse.technology.rap /msg01335.html).
>
> So as we work in a thread which is specific to a session, this thread is
> not shared with the others sessions and i don't think from this thread
> we can add contributions because we can not load a plugin onto an
> application which is shared with the others sessions.
> So the only solution that i have found to add an extension is to do it
> in the Activator#start() method, because from the start() method's
> thread, we can provide to the OSGI platform and load plugin. This thread
> is not specific to a session.
>
> I'm not sure about what i'm saying here but it will be great, if someone
> could confirm this. Maybe it will help others developpers to understand
> differences between RAP and RCP, and how we need to be careful about
> what we do in RAP.
>
> Thanks you.
>
> Maghen.
>
|
|
|
Powered by
FUDForum. Page generated in 0.06134 seconds