Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Help with creating a facade plugin for RAP/RCP
Help with creating a facade plugin for RAP/RCP [message #97859] Sun, 13 July 2008 11:21 Go to next message
Eclipse UserFriend
Originally posted by: sarek.nurfuerspam.de

Hi all,

I hope you can help me with the following problem. I am developing an
application which at the moment is a pure RAP app. But I want to be able
to switch over to RCP easily. From what I have read so far, this is best
done by diving the app into several plugins.

At the moment I have two plugins: myapp.core and myapp.ui. So from my
understanding best practice is to introduce a facade plugin, say
myapp.ui.facade which provides a facade for the RAP/RCP specific code.
And two other plugins myapp.ui.rap and myapp.ui.rcp that provide the
actual implementation for the the facade. Is that right so far?

My problem is that I do not know how the actual code for this facade and
the RAP or RCP plugins should look like. Can anyone of you describe in
further detail or tell me where I can find example code that shows how
to use/introduce a facade for RAP/RCP?

I hope my problem is clear and that anyone can help.

TIA

Christian

--
To reply to this posting directly use the following address and
remove the 'NO-SPAM' part: Riedel.Christian.NO-SPAM@gmx.net
Re: Help with creating a facade plugin for RAP/RCP [message #97875 is a reply to message #97859] Sun, 13 July 2008 15:29 Go to previous messageGo to next message
Patrick Turcotte is currently offline Patrick TurcotteFriend
Messages: 23
Registered: July 2009
Junior Member
Hi Christian,

> My problem is that I do not know how the actual code for this facade and
> the RAP or RCP plugins should look like. Can anyone of you describe in
> further detail or tell me where I can find example code that shows how
> to use/introduce a facade for RAP/RCP?
>

We did exactly this. And it works like a charm. Allows us to easily
check if a problem is from our understanding of RCP/RAP or a bug in the
RAP version.

I can't show you code right now (I'm at home). But I'll send you some
from work as soon as possible.

I'll get back to you soon.

Patrick
Re: Help with creating a facade plugin for RAP/RCP [message #97888 is a reply to message #97875] Sun, 13 July 2008 15:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sarek.nurfuerspam.de

Hi Patrick,

thanks, that sounds great. I think in theory I know what to do and how
things are meant to work together. My problem just is to actually
transfer it into reality.

I hope that I can eliminate these problems when I see some snippets that
show me how it could be ...

I'm looking forward to your answer ;-)

Christian


Patrick schrieb:
> Hi Christian,
>
>> My problem is that I do not know how the actual code for this facade
>> and the RAP or RCP plugins should look like. Can anyone of you
>> describe in further detail or tell me where I can find example code
>> that shows how to use/introduce a facade for RAP/RCP?
>>
>
> We did exactly this. And it works like a charm. Allows us to easily
> check if a problem is from our understanding of RCP/RAP or a bug in the
> RAP version.
>
> I can't show you code right now (I'm at home). But I'll send you some
> from work as soon as possible.
>
> I'll get back to you soon.
>
> Patrick

--
To reply to this posting directly use the following address and
remove the 'NO-SPAM' part: Riedel.Christian.NO-SPAM@gmx.net
Re: Help with creating a facade plugin for RAP/RCP [message #97901 is a reply to message #97875] Mon, 14 July 2008 04:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: adv.zahn.googlemail.com

Hi Patrick,

I'm also interested in an example. Could you please add me as copy?

Ralf

Patrick schrieb:
> Hi Christian,
>
>> My problem is that I do not know how the actual code for this facade
>> and the RAP or RCP plugins should look like. Can anyone of you
>> describe in further detail or tell me where I can find example code
>> that shows how to use/introduce a facade for RAP/RCP?
>>
>
> We did exactly this. And it works like a charm. Allows us to easily
> check if a problem is from our understanding of RCP/RAP or a bug in the
> RAP version.
>
> I can't show you code right now (I'm at home). But I'll send you some
> from work as soon as possible.
>
> I'll get back to you soon.
>
> Patrick
Re: Help with creating a facade plugin for RAP/RCP [message #97916 is a reply to message #97888] Mon, 14 July 2008 06:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

Hi,

are you aware of these resources?

EclipseCon 2008 Tutorial: From RCP to RCP/RAP – Conversion and
Single-Sourcing Techniques
http://www.eclipsecon.org/2008/index.php?page=sub/&id=23 3

The Eclipse Examples Project
http://www.eclipse.org/examples/
It hosts the "The Eclipse Business Expenses Reporting Tool (EBERT)",
an example application that runs on RCP, RAP and eRCP. The source
code that is available from CVS might give you some more hints.
Please note that due to this bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=235834
it only runs on RAP <= 1.1 M3 without modification.

Another way to go would be to put the RCP/RAP specific code into
distinct fragments.

HTH
Rüdiger

Christian Riedel wrote:
> Hi Patrick,
>
> thanks, that sounds great. I think in theory I know what to do and how
> things are meant to work together. My problem just is to actually
> transfer it into reality.
>
> I hope that I can eliminate these problems when I see some snippets that
> show me how it could be ...
>
> I'm looking forward to your answer ;-)
>
> Christian
>
>
> Patrick schrieb:
>> Hi Christian,
>>
>>> My problem is that I do not know how the actual code for this facade
>>> and the RAP or RCP plugins should look like. Can anyone of you
>>> describe in further detail or tell me where I can find example code
>>> that shows how to use/introduce a facade for RAP/RCP?
>>>
>>
>> We did exactly this. And it works like a charm. Allows us to easily
>> check if a problem is from our understanding of RCP/RAP or a bug in
>> the RAP version.
>>
>> I can't show you code right now (I'm at home). But I'll send you some
>> from work as soon as possible.
>>
>> I'll get back to you soon.
>>
>> Patrick
>
Re: Help with creating a facade plugin for RAP/RCP [message #97931 is a reply to message #97916] Mon, 14 July 2008 07:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sarek.nurfuerspam.de

Hi Rüdiger,

> are you aware of these resources?
>
> EclipseCon 2008 Tutorial: From RCP to RCP/RAP – Conversion and
> Single-Sourcing Techniques
> http://www.eclipsecon.org/2008/index.php?page=sub/&id=23 3

Yes, I know the slides. As I said in my initial post I think that I
understood how things should be done (in theory) but I have some
difficulties to actually putting it into practice. IIRC the slides say
something like: Identify the problematic parts of your code, separate
them from the other parts, introduce a facade which encapsulates the
problematic parts.

And exactly the last part is what troubles me ... I am not quite sure
how ;-(

> The Eclipse Examples Project
> http://www.eclipse.org/examples/
> It hosts the "The Eclipse Business Expenses Reporting Tool (EBERT)", an
> example application that runs on RCP, RAP and eRCP. The source code that
> is available from CVS might give you some more hints.

I was not aware of that. That's definitely something I will check out
right away.

> Please note that due to this bug:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=235834
> it only runs on RAP <= 1.1 M3 without modification.
>
> Another way to go would be to put the RCP/RAP specific code into
> distinct fragments.

This goes right along with my first problem. I am pretty new to the
eclipse plugins concept. Everything I have done before was standalone
SWT. I think I have understood _what_ fragments are and what they are
used for but I'm having my difficulties to write one myself. It's the
initial setup, I think, what makes my brain end up in knots (uhh, that
seems like too literally translated, sorry ;-) )

>
> HTH
> Rüdiger

Thanks anyways ... again some new points where I can try to find more info.

Christian


>
> Christian Riedel wrote:
>> Hi Patrick,
>>
>> thanks, that sounds great. I think in theory I know what to do and how
>> things are meant to work together. My problem just is to actually
>> transfer it into reality.
>>
>> I hope that I can eliminate these problems when I see some snippets
>> that show me how it could be ...
>>
>> I'm looking forward to your answer ;-)
>>
>> Christian
>>
>>
>> Patrick schrieb:
>>> Hi Christian,
>>>
>>>> My problem is that I do not know how the actual code for this facade
>>>> and the RAP or RCP plugins should look like. Can anyone of you
>>>> describe in further detail or tell me where I can find example code
>>>> that shows how to use/introduce a facade for RAP/RCP?
>>>>
>>>
>>> We did exactly this. And it works like a charm. Allows us to easily
>>> check if a problem is from our understanding of RCP/RAP or a bug in
>>> the RAP version.
>>>
>>> I can't show you code right now (I'm at home). But I'll send you some
>>> from work as soon as possible.
>>>
>>> I'll get back to you soon.
>>>
>>> Patrick
>>

--
To reply to this posting directly use the following address and
remove the 'NO-SPAM' part: Riedel.Christian.NO-SPAM@gmx.net
Re: Help with creating a facade plugin for RAP/RCP [message #97946 is a reply to message #97931] Mon, 14 July 2008 10:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sarek.nurfuerspam.de

Hi,

sorry guys, but I still don't get it ... I just had a look at the ebert
Example. There we have two plugins application.rap and application.rcp
which both have a dependency to application.general.

The first thing is ... I don't see any facade(-plugin) there. and the
second thing is the "direction" of the dependencies. The tutorial from
EclipseCon2008 talks about adding (optional) dependencies to be defined
in the ui-plugin to depend on the ui.rap or the ui.rcp plugin respectively.

My problem is that this tutorial seems to define dependencies the other
way round.

So in terms of "starting" the application would that mean the in the
tutorial the ui-plugin is started (and the rap plugin would be used
implicitly) whereas in the ebert example the application.rap plugin
would be the starting point, so here I explicitely say that the RAP
should be started?

I hope you get my point. Atm it's more than confusing, maybe it's my
weird way of thinking and I should go back to bad ;-)

Any help is greatly appreciated!

Christian


Christian Riedel schrieb:
> Hi Rüdiger,
>
>> are you aware of these resources?
>>
>> EclipseCon 2008 Tutorial: From RCP to RCP/RAP – Conversion and
>> Single-Sourcing Techniques
>> http://www.eclipsecon.org/2008/index.php?page=sub/&id=23 3
>
> Yes, I know the slides. As I said in my initial post I think that I
> understood how things should be done (in theory) but I have some
> difficulties to actually putting it into practice. IIRC the slides say
> something like: Identify the problematic parts of your code, separate
> them from the other parts, introduce a facade which encapsulates the
> problematic parts.
>
> And exactly the last part is what troubles me ... I am not quite sure
> how ;-(
>
>> The Eclipse Examples Project
>> http://www.eclipse.org/examples/
>> It hosts the "The Eclipse Business Expenses Reporting Tool (EBERT)",
>> an example application that runs on RCP, RAP and eRCP. The source code
>> that is available from CVS might give you some more hints.
>
> I was not aware of that. That's definitely something I will check out
> right away.
>
>> Please note that due to this bug:
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=235834
>> it only runs on RAP <= 1.1 M3 without modification.
>>
>> Another way to go would be to put the RCP/RAP specific code into
>> distinct fragments.
>
> This goes right along with my first problem. I am pretty new to the
> eclipse plugins concept. Everything I have done before was standalone
> SWT. I think I have understood _what_ fragments are and what they are
> used for but I'm having my difficulties to write one myself. It's the
> initial setup, I think, what makes my brain end up in knots (uhh, that
> seems like too literally translated, sorry ;-) )
>
>>
>> HTH
>> Rüdiger
>
> Thanks anyways ... again some new points where I can try to find more info.
>
> Christian
>
>
>>
>> Christian Riedel wrote:
>>> Hi Patrick,
>>>
>>> thanks, that sounds great. I think in theory I know what to do and
>>> how things are meant to work together. My problem just is to actually
>>> transfer it into reality.
>>>
>>> I hope that I can eliminate these problems when I see some snippets
>>> that show me how it could be ...
>>>
>>> I'm looking forward to your answer ;-)
>>>
>>> Christian
>>>
>>>
>>> Patrick schrieb:
>>>> Hi Christian,
>>>>
>>>>> My problem is that I do not know how the actual code for this
>>>>> facade and the RAP or RCP plugins should look like. Can anyone of
>>>>> you describe in further detail or tell me where I can find example
>>>>> code that shows how to use/introduce a facade for RAP/RCP?
>>>>>
>>>>
>>>> We did exactly this. And it works like a charm. Allows us to easily
>>>> check if a problem is from our understanding of RCP/RAP or a bug in
>>>> the RAP version.
>>>>
>>>> I can't show you code right now (I'm at home). But I'll send you
>>>> some from work as soon as possible.
>>>>
>>>> I'll get back to you soon.
>>>>
>>>> Patrick
>>>
>

--
To reply to this posting directly use the following address and
remove the 'NO-SPAM' part: Riedel.Christian.NO-SPAM@gmx.net
Re: Help with creating a facade plugin for RAP/RCP [message #97974 is a reply to message #97946] Mon, 14 July 2008 14:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

Christian,

from what I know the EBERT example shares the same source for RCP,
RAP and eRCP except for the bits that are needed to start the
respective application: e.g. application extension in RCP vs.
entrypoint extension in RAP.
Therefore the direction of the dependencies. The specific plug-ins
contain the startup code/extensions and depend on the common code in
the application.general plug-in.

The tutorial talks about a use case where you have repeatedly code
passages within a plug-in that aren't easy to extract.
Let's assume there are various places where you create graphics
resources directly (RCP: new Color() vs. RAP Graphics#getColor()).

The tutorial suggests to define an interface and an extension point.
Distinct plug-ins for RCP and RAP can then contribute their
platform-specific implementations to this extension point.

Another option is the use of fragments. In the example above, you
could have a facade GraphicsFacade#getColor() method and fragments
that provide implementations suitable for the respective platform.
The host-plug-in could then obtain an instance of GraphicsFacade via
reflection.

HTH
Rüdiger

Christian Riedel wrote:
> Hi,
>
> sorry guys, but I still don't get it ... I just had a look at the ebert
> Example. There we have two plugins application.rap and application.rcp
> which both have a dependency to application.general.
>
> The first thing is ... I don't see any facade(-plugin) there. and the
> second thing is the "direction" of the dependencies. The tutorial from
> EclipseCon2008 talks about adding (optional) dependencies to be defined
> in the ui-plugin to depend on the ui.rap or the ui.rcp plugin respectively.
>
> My problem is that this tutorial seems to define dependencies the other
> way round.
>
> So in terms of "starting" the application would that mean the in the
> tutorial the ui-plugin is started (and the rap plugin would be used
> implicitly) whereas in the ebert example the application.rap plugin
> would be the starting point, so here I explicitely say that the RAP
> should be started?
>
> I hope you get my point. Atm it's more than confusing, maybe it's my
> weird way of thinking and I should go back to bad ;-)
>
> Any help is greatly appreciated!
>
> Christian
>
>
> Christian Riedel schrieb:
>> Hi Rüdiger,
>>
>>> are you aware of these resources?
>>>
>>> EclipseCon 2008 Tutorial: From RCP to RCP/RAP – Conversion and
>>> Single-Sourcing Techniques
>>> http://www.eclipsecon.org/2008/index.php?page=sub/&id=23 3
>>
>> Yes, I know the slides. As I said in my initial post I think that I
>> understood how things should be done (in theory) but I have some
>> difficulties to actually putting it into practice. IIRC the slides say
>> something like: Identify the problematic parts of your code, separate
>> them from the other parts, introduce a facade which encapsulates the
>> problematic parts.
>>
>> And exactly the last part is what troubles me ... I am not quite sure
>> how ;-(
>>
>>> The Eclipse Examples Project
>>> http://www.eclipse.org/examples/
>>> It hosts the "The Eclipse Business Expenses Reporting Tool (EBERT)",
>>> an example application that runs on RCP, RAP and eRCP. The source
>>> code that is available from CVS might give you some more hints.
>>
>> I was not aware of that. That's definitely something I will check out
>> right away.
>>
>>> Please note that due to this bug:
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=235834
>>> it only runs on RAP <= 1.1 M3 without modification.
>>>
>>> Another way to go would be to put the RCP/RAP specific code into
>>> distinct fragments.
>>
>> This goes right along with my first problem. I am pretty new to the
>> eclipse plugins concept. Everything I have done before was standalone
>> SWT. I think I have understood _what_ fragments are and what they are
>> used for but I'm having my difficulties to write one myself. It's the
>> initial setup, I think, what makes my brain end up in knots (uhh, that
>> seems like too literally translated, sorry ;-) )
>>
>>>
>>> HTH
>>> Rüdiger
>>
>> Thanks anyways ... again some new points where I can try to find more
>> info.
>>
>> Christian
>>
>>
>>>
>>> Christian Riedel wrote:
>>>> Hi Patrick,
>>>>
>>>> thanks, that sounds great. I think in theory I know what to do and
>>>> how things are meant to work together. My problem just is to
>>>> actually transfer it into reality.
>>>>
>>>> I hope that I can eliminate these problems when I see some snippets
>>>> that show me how it could be ...
>>>>
>>>> I'm looking forward to your answer ;-)
>>>>
>>>> Christian
>>>>
>>>>
>>>> Patrick schrieb:
>>>>> Hi Christian,
>>>>>
>>>>>> My problem is that I do not know how the actual code for this
>>>>>> facade and the RAP or RCP plugins should look like. Can anyone of
>>>>>> you describe in further detail or tell me where I can find example
>>>>>> code that shows how to use/introduce a facade for RAP/RCP?
>>>>>>
>>>>>
>>>>> We did exactly this. And it works like a charm. Allows us to easily
>>>>> check if a problem is from our understanding of RCP/RAP or a bug in
>>>>> the RAP version.
>>>>>
>>>>> I can't show you code right now (I'm at home). But I'll send you
>>>>> some from work as soon as possible.
>>>>>
>>>>> I'll get back to you soon.
>>>>>
>>>>> Patrick
>>>>
>>
>
Re: Help with creating a facade plugin for RAP/RCP [message #98018 is a reply to message #97974] Mon, 14 July 2008 14:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sarek.nurfuerspam.de

Hi Rüdiger,

that was an extensive answer that has put many things in a much clearer
light. I think I had mixed up some parts there.

Now it's up to me and see if I can actually apply what I have learned
today.

Thank you for your great help!

Christian


Rüdiger Herrmann schrieb:
> Christian,
>
> from what I know the EBERT example shares the same source for RCP, RAP
> and eRCP except for the bits that are needed to start the respective
> application: e.g. application extension in RCP vs. entrypoint extension
> in RAP.
> Therefore the direction of the dependencies. The specific plug-ins
> contain the startup code/extensions and depend on the common code in the
> application.general plug-in.
>
> The tutorial talks about a use case where you have repeatedly code
> passages within a plug-in that aren't easy to extract.
> Let's assume there are various places where you create graphics
> resources directly (RCP: new Color() vs. RAP Graphics#getColor()).
>
> The tutorial suggests to define an interface and an extension point.
> Distinct plug-ins for RCP and RAP can then contribute their
> platform-specific implementations to this extension point.
>
> Another option is the use of fragments. In the example above, you could
> have a facade GraphicsFacade#getColor() method and fragments that
> provide implementations suitable for the respective platform. The
> host-plug-in could then obtain an instance of GraphicsFacade via
> reflection.
>
> HTH
> Rüdiger
>
> Christian Riedel wrote:
>> Hi,
>>
>> sorry guys, but I still don't get it ... I just had a look at the
>> ebert Example. There we have two plugins application.rap and
>> application.rcp which both have a dependency to application.general.
>>
>> The first thing is ... I don't see any facade(-plugin) there. and the
>> second thing is the "direction" of the dependencies. The tutorial from
>> EclipseCon2008 talks about adding (optional) dependencies to be
>> defined in the ui-plugin to depend on the ui.rap or the ui.rcp plugin
>> respectively.
>>
>> My problem is that this tutorial seems to define dependencies the
>> other way round.
>>
>> So in terms of "starting" the application would that mean the in the
>> tutorial the ui-plugin is started (and the rap plugin would be used
>> implicitly) whereas in the ebert example the application.rap plugin
>> would be the starting point, so here I explicitely say that the RAP
>> should be started?
>>
>> I hope you get my point. Atm it's more than confusing, maybe it's my
>> weird way of thinking and I should go back to bad ;-)
>>
>> Any help is greatly appreciated!
>>
>> Christian
>>
>>
>> Christian Riedel schrieb:
>>> Hi Rüdiger,
>>>
>>>> are you aware of these resources?
>>>>
>>>> EclipseCon 2008 Tutorial: From RCP to RCP/RAP – Conversion and
>>>> Single-Sourcing Techniques
>>>> http://www.eclipsecon.org/2008/index.php?page=sub/&id=23 3
>>>
>>> Yes, I know the slides. As I said in my initial post I think that I
>>> understood how things should be done (in theory) but I have some
>>> difficulties to actually putting it into practice. IIRC the slides
>>> say something like: Identify the problematic parts of your code,
>>> separate them from the other parts, introduce a facade which
>>> encapsulates the problematic parts.
>>>
>>> And exactly the last part is what troubles me ... I am not quite sure
>>> how ;-(
>>>
>>>> The Eclipse Examples Project
>>>> http://www.eclipse.org/examples/
>>>> It hosts the "The Eclipse Business Expenses Reporting Tool (EBERT)",
>>>> an example application that runs on RCP, RAP and eRCP. The source
>>>> code that is available from CVS might give you some more hints.
>>>
>>> I was not aware of that. That's definitely something I will check out
>>> right away.
>>>
>>>> Please note that due to this bug:
>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=235834
>>>> it only runs on RAP <= 1.1 M3 without modification.
>>>>
>>>> Another way to go would be to put the RCP/RAP specific code into
>>>> distinct fragments.
>>>
>>> This goes right along with my first problem. I am pretty new to the
>>> eclipse plugins concept. Everything I have done before was standalone
>>> SWT. I think I have understood _what_ fragments are and what they are
>>> used for but I'm having my difficulties to write one myself. It's the
>>> initial setup, I think, what makes my brain end up in knots (uhh,
>>> that seems like too literally translated, sorry ;-) )
>>>
>>>>
>>>> HTH
>>>> Rüdiger
>>>
>>> Thanks anyways ... again some new points where I can try to find more
>>> info.
>>>
>>> Christian
>>>
>>>
>>>>
>>>> Christian Riedel wrote:
>>>>> Hi Patrick,
>>>>>
>>>>> thanks, that sounds great. I think in theory I know what to do and
>>>>> how things are meant to work together. My problem just is to
>>>>> actually transfer it into reality.
>>>>>
>>>>> I hope that I can eliminate these problems when I see some snippets
>>>>> that show me how it could be ...
>>>>>
>>>>> I'm looking forward to your answer ;-)
>>>>>
>>>>> Christian
>>>>>
>>>>>
>>>>> Patrick schrieb:
>>>>>> Hi Christian,
>>>>>>
>>>>>>> My problem is that I do not know how the actual code for this
>>>>>>> facade and the RAP or RCP plugins should look like. Can anyone of
>>>>>>> you describe in further detail or tell me where I can find
>>>>>>> example code that shows how to use/introduce a facade for RAP/RCP?
>>>>>>>
>>>>>>
>>>>>> We did exactly this. And it works like a charm. Allows us to
>>>>>> easily check if a problem is from our understanding of RCP/RAP or
>>>>>> a bug in the RAP version.
>>>>>>
>>>>>> I can't show you code right now (I'm at home). But I'll send you
>>>>>> some from work as soon as possible.
>>>>>>
>>>>>> I'll get back to you soon.
>>>>>>
>>>>>> Patrick
>>>>>
>>>
>>

--
To reply to this posting directly use the following address and
remove the 'NO-SPAM' part: Riedel.Christian.NO-SPAM@gmx.net
Re: Help with creating a facade plugin for RAP/RCP [message #98125 is a reply to message #97859] Tue, 15 July 2008 05:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: anupgokhale.rediffmail.com

Christian,

We have done something similar, but we have not designed a "facade"
plugin as you put it. A plugin if designed well can happily work in a
RCP app and a RAP app without any change to it's code what-so-ever. You
only have to take some basic precautions to ensure that the GUI of the
plug-in, uses widgets that are available in both RCP and RAP. In the
plugin.xml, file of your plugin, you have to mark the dependencies on
org.eclipse.ui and org.eclipse.rap.ui as well as the dependencies to the
RCP and RAP versions of the forms plugins as optional.

Hope this helps.

Anup

Christian Riedel wrote:
> Hi all,
>
> I hope you can help me with the following problem. I am developing an
> application which at the moment is a pure RAP app. But I want to be able
> to switch over to RCP easily. From what I have read so far, this is best
> done by diving the app into several plugins.
>
> At the moment I have two plugins: myapp.core and myapp.ui. So from my
> understanding best practice is to introduce a facade plugin, say
> myapp.ui.facade which provides a facade for the RAP/RCP specific code.
> And two other plugins myapp.ui.rap and myapp.ui.rcp that provide the
> actual implementation for the the facade. Is that right so far?
>
> My problem is that I do not know how the actual code for this facade and
> the RAP or RCP plugins should look like. Can anyone of you describe in
> further detail or tell me where I can find example code that shows how
> to use/introduce a facade for RAP/RCP?
>
> I hope my problem is clear and that anyone can help.
>
> TIA
>
> Christian
>
Re: Help with creating a facade plugin for RAP/RCP [message #98155 is a reply to message #98125] Tue, 15 July 2008 07:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sarek.nurfuerspam.de

Hi Anup,

thanks for your explanation. However I wonder how the project could
possibly work with RCP and RCP without the code being changed, when for
RAP you have to extend from IEntryPoint and for RCP from Application(?).
I mean at least this would need a code change, or am I mistaken.

However - there have been some quite useful answers to this thread so
far, so my first steps seem to be working. I am sure though that I need
to come back to you now and then ;-)

Thanks for your support

Christian


Anup Gokhale schrieb:
> Christian,
>
> We have done something similar, but we have not designed a "facade"
> plugin as you put it. A plugin if designed well can happily work in a
> RCP app and a RAP app without any change to it's code what-so-ever. You
> only have to take some basic precautions to ensure that the GUI of the
> plug-in, uses widgets that are available in both RCP and RAP. In the
> plugin.xml, file of your plugin, you have to mark the dependencies on
> org.eclipse.ui and org.eclipse.rap.ui as well as the dependencies to the
> RCP and RAP versions of the forms plugins as optional.
>
> Hope this helps.
>
> Anup
>
> Christian Riedel wrote:
>> Hi all,
>>
>> I hope you can help me with the following problem. I am developing an
>> application which at the moment is a pure RAP app. But I want to be
>> able to switch over to RCP easily. From what I have read so far, this
>> is best done by diving the app into several plugins.
>>
>> At the moment I have two plugins: myapp.core and myapp.ui. So from my
>> understanding best practice is to introduce a facade plugin, say
>> myapp.ui.facade which provides a facade for the RAP/RCP specific code.
>> And two other plugins myapp.ui.rap and myapp.ui.rcp that provide the
>> actual implementation for the the facade. Is that right so far?
>>
>> My problem is that I do not know how the actual code for this facade
>> and the RAP or RCP plugins should look like. Can anyone of you
>> describe in further detail or tell me where I can find example code
>> that shows how to use/introduce a facade for RAP/RCP?
>>
>> I hope my problem is clear and that anyone can help.
>>
>> TIA
>>
>> Christian
>>

--
To reply to this posting directly use the following address and
remove the 'NO-SPAM' part: Riedel.Christian.NO-SPAM@gmx.net
Re: Help with creating a facade plugin for RAP/RCP [message #98185 is a reply to message #98155] Tue, 15 July 2008 09:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: anupgokhale.rediffmail.com

Christian,

Ahh! Now I got what you are trying to say. Suppose we want to develop an
application called "EmployeeDetails" then to make the same code base to
work in RCP as well as in RAP you will need to:
1. Create a plugin as a plain RCP application. This plugin will not have
any of your business logic, but will just have the main classes reqd for
a RCP app(Activator, Application, Workbenchadvisor etc)
2. Create another plugin as a plain RAP application (by changing the
workspace and target platform ofcourse). This plugin will similarly be a
plain vanilla plugin without any of your business logic.
3. Create a third plugin (this plugin will be as per my earlier reply).
This plugin will have all the business logic to view the list of
employees, to add/edit employees etc. You can use standard
editors/views/SWT dialogs etc for this functionality.

When you want to test the RCP implementation, include this third plugin
in the run configuration of your RCP app.

When you want to test the RAP implementation, include this third plugin
in the run configuration of your RAP app.

The source of third plugin can reside in any workspace(RCP or RAP) and
you can simply use the import project wizard (with copy projects to
workspace unchecked) to use the same code in both the RCP and RAP versions.

From my experience you need to switch workspaces quite frequently to
ensure that the changes that you have made to the third common plugin
work in both the RCP and RAP scenarios.

Regards,

Anup Gokhale



Christian Riedel wrote:
> Hi Anup,
>
> thanks for your explanation. However I wonder how the project could
> possibly work with RCP and RCP without the code being changed, when for
> RAP you have to extend from IEntryPoint and for RCP from Application(?).
> I mean at least this would need a code change, or am I mistaken.
>
> However - there have been some quite useful answers to this thread so
> far, so my first steps seem to be working. I am sure though that I need
> to come back to you now and then ;-)
>
> Thanks for your support
>
> Christian
>
>
> Anup Gokhale schrieb:
>> Christian,
>>
>> We have done something similar, but we have not designed a "facade"
>> plugin as you put it. A plugin if designed well can happily work in a
>> RCP app and a RAP app without any change to it's code what-so-ever.
>> You only have to take some basic precautions to ensure that the GUI of
>> the plug-in, uses widgets that are available in both RCP and RAP. In
>> the plugin.xml, file of your plugin, you have to mark the dependencies
>> on org.eclipse.ui and org.eclipse.rap.ui as well as the dependencies
>> to the RCP and RAP versions of the forms plugins as optional.
>>
>> Hope this helps.
>>
>> Anup
>>
>> Christian Riedel wrote:
>>> Hi all,
>>>
>>> I hope you can help me with the following problem. I am developing an
>>> application which at the moment is a pure RAP app. But I want to be
>>> able to switch over to RCP easily. From what I have read so far, this
>>> is best done by diving the app into several plugins.
>>>
>>> At the moment I have two plugins: myapp.core and myapp.ui. So from my
>>> understanding best practice is to introduce a facade plugin, say
>>> myapp.ui.facade which provides a facade for the RAP/RCP specific
>>> code. And two other plugins myapp.ui.rap and myapp.ui.rcp that
>>> provide the actual implementation for the the facade. Is that right
>>> so far?
>>>
>>> My problem is that I do not know how the actual code for this facade
>>> and the RAP or RCP plugins should look like. Can anyone of you
>>> describe in further detail or tell me where I can find example code
>>> that shows how to use/introduce a facade for RAP/RCP?
>>>
>>> I hope my problem is clear and that anyone can help.
>>>
>>> TIA
>>>
>>> Christian
>>>
>
Re: Help with creating a facade plugin for RAP/RCP [message #98198 is a reply to message #98185] Tue, 15 July 2008 09:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sarek.nurfuerspam.de

Hi Anup,

right, that was my initial question. As you may have seen, I am pretty
new to the plugin concept. All my applications before have been SWT
standalone applications. So that may be a reason why I mixed things up
or did not pose my question as precisely as necessary.

I think one of my biggest misunderstandings so far was that it could be
possible to start the application via the common ui plugin which then
would either incorporate the rap-specific or the rcp-specific plugin.

Never mind, I think I got it straight now.

Thanks for your patience ;-)

Christian

Anup Gokhale schrieb:
> Christian,
>
> Ahh! Now I got what you are trying to say. Suppose we want to develop an
> application called "EmployeeDetails" then to make the same code base to
> work in RCP as well as in RAP you will need to:
> 1. Create a plugin as a plain RCP application. This plugin will not have
> any of your business logic, but will just have the main classes reqd for
> a RCP app(Activator, Application, Workbenchadvisor etc)
> 2. Create another plugin as a plain RAP application (by changing the
> workspace and target platform ofcourse). This plugin will similarly be a
> plain vanilla plugin without any of your business logic.
> 3. Create a third plugin (this plugin will be as per my earlier reply).
> This plugin will have all the business logic to view the list of
> employees, to add/edit employees etc. You can use standard
> editors/views/SWT dialogs etc for this functionality.
>
> When you want to test the RCP implementation, include this third plugin
> in the run configuration of your RCP app.
>
> When you want to test the RAP implementation, include this third plugin
> in the run configuration of your RAP app.
>
> The source of third plugin can reside in any workspace(RCP or RAP) and
> you can simply use the import project wizard (with copy projects to
> workspace unchecked) to use the same code in both the RCP and RAP versions.
>
> From my experience you need to switch workspaces quite frequently to
> ensure that the changes that you have made to the third common plugin
> work in both the RCP and RAP scenarios.
>
> Regards,
>
> Anup Gokhale
>
>
>
> Christian Riedel wrote:
>> Hi Anup,
>>
>> thanks for your explanation. However I wonder how the project could
>> possibly work with RCP and RCP without the code being changed, when
>> for RAP you have to extend from IEntryPoint and for RCP from
>> Application(?). I mean at least this would need a code change, or am I
>> mistaken.
>>
>> However - there have been some quite useful answers to this thread so
>> far, so my first steps seem to be working. I am sure though that I
>> need to come back to you now and then ;-)
>>
>> Thanks for your support
>>
>> Christian
>>
>>
>> Anup Gokhale schrieb:
>>> Christian,
>>>
>>> We have done something similar, but we have not designed a "facade"
>>> plugin as you put it. A plugin if designed well can happily work in a
>>> RCP app and a RAP app without any change to it's code what-so-ever.
>>> You only have to take some basic precautions to ensure that the GUI
>>> of the plug-in, uses widgets that are available in both RCP and RAP.
>>> In the plugin.xml, file of your plugin, you have to mark the
>>> dependencies on org.eclipse.ui and org.eclipse.rap.ui as well as the
>>> dependencies to the RCP and RAP versions of the forms plugins as
>>> optional.
>>>
>>> Hope this helps.
>>>
>>> Anup
>>>
>>> Christian Riedel wrote:
>>>> Hi all,
>>>>
>>>> I hope you can help me with the following problem. I am developing
>>>> an application which at the moment is a pure RAP app. But I want to
>>>> be able to switch over to RCP easily. From what I have read so far,
>>>> this is best done by diving the app into several plugins.
>>>>
>>>> At the moment I have two plugins: myapp.core and myapp.ui. So from
>>>> my understanding best practice is to introduce a facade plugin, say
>>>> myapp.ui.facade which provides a facade for the RAP/RCP specific
>>>> code. And two other plugins myapp.ui.rap and myapp.ui.rcp that
>>>> provide the actual implementation for the the facade. Is that right
>>>> so far?
>>>>
>>>> My problem is that I do not know how the actual code for this facade
>>>> and the RAP or RCP plugins should look like. Can anyone of you
>>>> describe in further detail or tell me where I can find example code
>>>> that shows how to use/introduce a facade for RAP/RCP?
>>>>
>>>> I hope my problem is clear and that anyone can help.
>>>>
>>>> TIA
>>>>
>>>> Christian
>>>>
>>

--
To reply to this posting directly use the following address and
remove the 'NO-SPAM' part: Riedel.Christian.NO-SPAM@gmx.net
Re: Help with creating a facade plugin for RAP/RCP [message #98403 is a reply to message #97901] Tue, 15 July 2008 16:24 Go to previous messageGo to next message
Patrick Turcotte is currently offline Patrick TurcotteFriend
Messages: 23
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.
--------------060900050704050503000904
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Hi Ralf,
> Hi Patrick,
>
> I'm also interested in an example. Could you please add me as copy?
>
> Ralf
>
Christian seems to have been able to find his answers from the other posts. I'll post some code anyway.

First, we were able to make it work from the presentation
( http://www.eclipsecon.org/2008/sub/attachments/From_RCP_to_R CPRAP_8211_Conversion_and_SingleSourcing_Techniques.pdf)
and code (that they were kind enough to send us) of Elias Volanakis (Innoopract Inc.), Jordi Boehme Lopez (Innoopract
Informationssysteme GmbH). We would still be at it otherwise.

So, basically, we have 4 plugins:

ui.facadefactory (to store the factory interfaces)
ui.core (the main application)
ui.rap (the startup and specific stuff for RAP)
ui.rcp (the startup and specific stuff for RCP)

In ui.core we have the following dependencies

- ui.facadefactory
- org.eclipse.rap.ui (optionnal)
- org.eclipse.ui (optionnal)

It is important to have the dependencies on the frameworks (rcp AND rap) and that they are optionnals.

Also, in ui.core we are carefull not to use anything specific to any of the frameworks. I.e. RAP specific stuff or RCP
specific stuff (think Colors or Activator) are in the corresponding plugins.


In ui.facadefactory we only have a dependency on org.eclipse.core.runtime

We have 2 classes in ui.facadefactory, one interface (see IFacadeFactory.java), and one activator (see
FacadeActivator.java). We also need a schema (see file) (described with an extension point) and to export our package
with the Activator and Factory.

Now, in your ui.rap project:

- Add an extension for your new facadeFactories
- Create a class that implements the interface (see SessionObjectFactory.java) in a RAP specific way.
- Define and create an org.eclipse.rap.ui.entrypoint according to your needs.

Finally, in your ui.rcp project:
- Add an extension for your new facadeFactories
- Create a class that implements the interface (see LocalObjectFactory.java) in a RCP specific way.
- Create a class that implements IApplication to start your application.

Of course, you'll probably need two workspaces to make this work, one with RAP as a target and the other with RCP. Or
you could be switching target.

Hope this helps.

Don't hesitate to ask questions.

I could contribute this message to a wiki if pointed in the right direction.

Patrick

--------------060900050704050503000904
Content-Type: text/plain;
name="FacadeActivator.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="FacadeActivator.java"

/**
* The activator class controls the plug-in life cycle
*/
public class FacadeActivator extends Plugin
{

// The plug-in ID
public static final String PLUGIN_ID = FacadeActivator.class.getPackage().getName();

// The shared instance
private static FacadeActivator plugin;

@Override
public void start(BundleContext context) throws Exception
{
super.start(context);
plugin = this;
}

@Override
public void stop(BundleContext context) throws Exception
{
plugin = null;
super.stop(context);
}

/**
* Returns an object implementing the given <tt>facadeClass</tt> or
* <tt>null</tt>, if no matching implementation was found. See also the
* facade factory extension point.
*
* @param facadeClass
* a Class instance of an interface or <tt>null</tt>
*/
public static Object getFacade(final Class facadeClass)
{
Object result = null;
if (facadeClass != null)
{
String className = facadeClass.getName();
IExtensionRegistry reg = Platform.getExtensionRegistry();
String extPoint = IFacadeFactory.FACADE_FACTORIES_EP;
IConfigurationElement[] elements = reg.getConfigurationElementsFor(extPoint);
for (int i = 0; result == null && i < elements.length; i++)
{
IConfigurationElement element = elements[i];
String attrib = element.getAttribute(IFacadeFactory.ATT_TYPE);
if (className.equals(attrib))
{
try
{
String attFactory = IFacadeFactory.ATT_FACTORY;
Object obj = element.createExecutableExtension(attFactory);
if (obj instanceof IFacadeFactory)
{
result = ((IFacadeFactory) obj).getImplementation();
}
}
catch (CoreException cex)
{
FacadeActivator.getDefault().getLog().log(cex.getStatus());
}
}
}
}
return result;
}

/**
* Returns the shared instance
*/
public static FacadeActivator getDefault()
{
return plugin;
}

}


--------------060900050704050503000904
Content-Type: text/xml;
name="facadeFactories.exsd"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="facadeFactories.exsd"

<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="ca.dictio.nnaire.ui.facadefactory">
<annotation>
<appInfo>
<meta.schema plugin="ca.dictio.nnaire.ui.facadefactory" id="facadeFactories" name="Facade Factories"/>
</appInfo>
<documentation>
&lt;p&gt;This extension point enables plugins to contribute different implementations of the same interface.&lt;/p&gt;

&lt;p&gt;To contribute different behavior for the same thing:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Come up with an interface. Place that interface (IFoo) into a public accessible (i.e. expored) package, like com.innoopract.ui.facades.&lt;/li&gt;
&lt;li&gt;In RCP and/or RAP: Implement an IFacadeFactory that returns an IFoo implementation.&lt;/li&gt;
&lt;li&gt;Contribute to the ca.dictio.nnaire.ui.facadefactory.facadeFactories extension point
(see com.innoopract.mp3m.ui.rcp for an example).&lt;/li&gt;
&lt;li&gt;Obtain the current implementation by calling
&lt;tt&gt;IFoo fooImpl = (IFoo) FacadeActivator.getFacade( IFoo.class );&lt;/tt&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Possible future work:&lt;/p&gt;

&lt;p&gt;1. Handle multiple contributions of the same interface by adding priorities. Currently if you have both rcp + rap in the same launch config and both contribute a facade factory for IFoo, it is not specified which one will be used. However I think this will not be a real problem, since normally only ui.rcp OR ui.rap will be used.&lt;/p&gt;
</documentation>
</annotation>

<element name="extension">
<complexType>
<sequence>
<element ref="factory" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>

</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>

</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>

</documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>

<element name="factory">
<annotation>
<appInfo>
<meta.element labelAttribute="interface"/>
</appInfo>
<documentation>
A Facade Factory can instantiate an implementation of some interface. Contributing different Facade Factories
gives you control over the instantiation mechanism and the returned implementation.
</documentation>
</annotation>
<complexType>
<attribute name="type" type="string" use="required">
<annotation>
<documentation>
The fully qualified name of a type. The implementation contributed by this facade factory MUST implement this type. If you want to contribute multiple implementation that hide behind an interface, type has to be an interface. If you want to contribute one implementation that is only instantiated differently, type should be a class. The type string is considered API, since it will be used to obtain a suitable implementation.
</documentation>
</annotation>
</attribute>
<attribute name="factory" type="string" use="required">
<annotation>
<documentation>
A class the implements &lt;code&gt;ca.dictio.nnaire.ui.facadefactory.IFacad eFactory&lt;/code&gt;.
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn=":ca.dictio.nnaire.ui.facadefactory.IFacadeFactory"/ >
</appInfo>
</annotation>
</attribute>
</complexType>
</element>

<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
<documentation>
v1.0.0
</documentation>
</annotation>

<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
&lt;pre&gt;
&lt;extension
point=&quot;ca.dictio.nnaire.ui.facadefactory.facadeFact ories&quot;&gt;
&lt;factory
factory=&quot;com.innoopract.mp3m.ui.rap.internal.MusicF olderStoreFactory&quot;
type=&quot;com.innoopract.mp3m.services.IMusicFolderStor e&quot;&gt;
&lt;/factory&gt;
&lt;/extension&gt;
&lt;/pre&gt;
</documentation>
</annotation>

<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
See IFacadeFactory interface.
</documentation>
</annotation>

<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
See &lt;tt&gt;ca.dictio.nnaire.ui.facadefactory&lt;/ tt&gt; package and &lt;tt&gt;FacadeActivator.getFacade( class )&lt;/tt&gt;.
</documentation>
</annotation>

<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
<documentation>
(c) Copyright 2007-2008, Innoopract Informationssysteme GmbH. All rights reserved. This content is made available under the Eclipse Public License (EPL), v1.0.
</documentation>
</annotation>

</schema>

--------------060900050704050503000904
Content-Type: text/plain;
name="IFacadeFactory.java"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="IFacadeFactory.java"

LyoqDQogKiBVc2VkIGJ5IHRoZSBmYWNhZGUgZmFjdG9yaWVzIGV4dGVuc2lv biBwb2ludCB0
byBjb250cmlidXRlIGFuIGltcGxlbWVudGF0aW9uDQogKiBvZiBhIHBhcnRp Y3VsYXIgaW50
ZXJmYWNlLg0KICogDQogKiBAYXV0aG9yIEVsaWFzIFZvbGFuYWtpcw0KICov DQpwdWJsaWMg
aW50ZXJmYWNlIElGYWNhZGVGYWN0b3J5DQp7DQoNCiAgICAvKiogRmFjYWRl IEZhY3Rvcmll
cyBFeHRlbnNpb24gUG9pbnQgKi8NCiAgICBTdHJpbmcgRkFDQURFX0ZBQ1RP UklFU19FUCA9
IEZhY2FkZUFjdGl2YXRvci5QTFVHSU5fSUQgKyAiLmZhY2FkZUZhY3Rvcmll cyI7IC8vJE5P
Ti1OTFMtMSQNCg0KICAgIC8qKiBOYW1lIG9mIHRoZSA8dHQ+ZmFjdG9yeTwv dHQ+IGF0dHJp
YnV0ZS4gKi8NCiAgICBTdHJpbmcgQVRUX0ZBQ1RPUlkgPSAiZmFjdG9yeSI7 IC8vJE5PTi1O
TFMtMSQNCg0KICAgIC8qKiBOYW1lIG9mIHRoZSA8dHQ+aW50ZXJmYWNlPC90 dD4gYXR0cmli
dXRlLiAqLw0KICAgIFN0cmluZyBBVFRfVFlQRSA9ICJ0eXBlIjsgLy8kTk9O LU5MUy0xJA0K
DQogICAgLyoqDQogICAgICogUmV0dXJuIGFuIGltcGxlbWVudGF0aW9uIG9m IGFuIGludGVy
ZmFjZS4gVGhlIHJldHVybmVkIG9iamVjdCA8Yj5tdXN0PC9iPg0KICAgICAq IGNvbmZvcm0g
dG8gdGhlIGludGVyZmFjZSBzcGVjaWZpZWQgaW4ge0BsaW5rICNnZXRJbnRl cmZhY2UoKX0u
DQogICAgICogDQogICAgICogQHJldHVybiBhbiBPYmplY3Q7IG5ldmVyIG51 bGwNCiAgICAg
Ki8NCiAgICBPYmplY3QgZ2V0SW1wbGVtZW50YXRpb24oKTsNCn0=
--------------060900050704050503000904
Content-Type: text/plain;
name="LocalObjectFactory.java"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="LocalObjectFactory.java"

cHVibGljIGNsYXNzIExvY2FsT2JqZWN0RmFjdG9yeSAgaW1wbGVtZW50cyBJ RmFjYWRlRmFj
dG9yeQ0Kew0KDQogcHJpdmF0ZSBzdGF0aWMgQ29tbW9uUGxhdGZvcm1TZXNz aW9uIGltcGwg
PSBuZXcgQ29tbW9uUGxhdGZvcm1TZXNzaW9uKCk7DQoJDQoJcHVibGljIE9i amVjdCBnZXRJ
bXBsZW1lbnRhdGlvbigpIHsNCgkJcmV0dXJuIGltcGw7DQoJfQ0KDQp9
--------------060900050704050503000904
Content-Type: text/plain;
name="SessionObjectFactory.java"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="SessionObjectFactory.java"

cHVibGljIGNsYXNzIFNlc3Npb25PYmplY3RGYWN0b3J5IGV4dGVuZHMgU2Vz c2lvblNpbmds
ZXRvbkJhc2UgaW1wbGVtZW50cyBJRmFjYWRlRmFjdG9yeQ0Kew0KDQogICAg cHVibGljIE9i
amVjdCBnZXRJbXBsZW1lbnRhdGlvbigpDQogICAgew0KICAgICAgICByZXR1 cm4gZ2V0SW5z
dGFuY2UoKTsNCiAgICB9DQoNCiAgICAvKioNCiAgICAgKiBBbHdheXMgcmV0 dXJuIHRoZSBz
YW1lIG9iamVjdCBmb3IgYSB1c2VyLCBidXQgZm9yIGRpZmZlcmVudCB1c2Vy IHNlc3Npb25z
DQogICAgICogZGlmZmVyZW50IG9iamVjdHMNCiAgICAgKiANCiAgICAgKiBA cmV0dXJuIE9i
amVjdCBJbnN0YW5jZSBvZiB0aGUgT2JqZWN0DQogICAgICovDQogICAgcHJv dGVjdGVkIHN0
YXRpYyBPYmplY3QgZ2V0SW5zdGFuY2UoKQ0KICAgIHsNCiAgICAgICAgcmV0 dXJuIGdldElu
c3RhbmNlKFJhcFNlc3Npb25PYmplY3QuY2xhc3MpOw0KICAgIH0NCg0KfQ==
--------------060900050704050503000904--
Re: Help with creating a facade plugin for RAP/RCP [message #98466 is a reply to message #98403] Tue, 15 July 2008 16:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sarek.nurfuerspam.de

Hi Patrick,

thanks for your code and your explaining words ... as of now, how to
actually implement the facade has not been entirely clear. I just
decided to get further on with my implementation and maybe make some
adjustments later on.

Again, with your help, things have become a lot clearer. I must confess
that I had underestimated the work necessary to introduce this facade.
But for the time being i can live with my provisional "solution".

There are a lot of very useful snippets (or even more than that) in this
newsgroup. A central point for collecting them, maybe a wiki, like you
suggested, would be a great idea!

Cu

Christian


Patrick Turcotte schrieb:
> Hi Ralf,
>> Hi Patrick,
>>
>> I'm also interested in an example. Could you please add me as copy?
>>
>> Ralf
>>
> Christian seems to have been able to find his answers from the other
> posts. I'll post some code anyway.
>
> First, we were able to make it work from the presentation
> ( http://www.eclipsecon.org/2008/sub/attachments/From_RCP_to_R CPRAP_8211_Conversion_and_SingleSourcing_Techniques.pdf)
> and code (that they were kind enough to send us) of Elias Volanakis
> (Innoopract Inc.), Jordi Boehme Lopez (Innoopract Informationssysteme
> GmbH). We would still be at it otherwise.
>
> So, basically, we have 4 plugins:
>
> ui.facadefactory (to store the factory interfaces)
> ui.core (the main application)
> ui.rap (the startup and specific stuff for RAP)
> ui.rcp (the startup and specific stuff for RCP)
>
> In ui.core we have the following dependencies
>
> - ui.facadefactory
> - org.eclipse.rap.ui (optionnal)
> - org.eclipse.ui (optionnal)
>
> It is important to have the dependencies on the frameworks (rcp AND rap)
> and that they are optionnals.
>
> Also, in ui.core we are carefull not to use anything specific to any of
> the frameworks. I.e. RAP specific stuff or RCP specific stuff (think
> Colors or Activator) are in the corresponding plugins.
>
>
> In ui.facadefactory we only have a dependency on org.eclipse.core.runtime
>
> We have 2 classes in ui.facadefactory, one interface (see
> IFacadeFactory.java), and one activator (see FacadeActivator.java). We
> also need a schema (see file) (described with an extension point) and to
> export our package with the Activator and Factory.
>
> Now, in your ui.rap project:
>
> - Add an extension for your new facadeFactories
> - Create a class that implements the interface (see
> SessionObjectFactory.java) in a RAP specific way.
> - Define and create an org.eclipse.rap.ui.entrypoint according to your
> needs.
>
> Finally, in your ui.rcp project:
> - Add an extension for your new facadeFactories
> - Create a class that implements the interface (see
> LocalObjectFactory.java) in a RCP specific way.
> - Create a class that implements IApplication to start your application.
>
> Of course, you'll probably need two workspaces to make this work, one
> with RAP as a target and the other with RCP. Or you could be switching
> target.
>
> Hope this helps.
>
> Don't hesitate to ask questions.
>
> I could contribute this message to a wiki if pointed in the right
> direction.
>
> Patrick
>

--
To reply to this posting directly use the following address and
remove the 'NO-SPAM' part: Riedel.Christian.NO-SPAM@gmx.net
Re: Help with creating a facade plugin for RAP/RCP [message #100393 is a reply to message #98185] Tue, 29 July 2008 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: m.n.com

You can also:
1. Have two instances of eclipse open pointing at a common source
repository.
2. Use workspaces and close/open projects based on what target is loaded.

Anup Gokhale wrote:
> Christian,
>
> Ahh! Now I got what you are trying to say. Suppose we want to develop an
> application called "EmployeeDetails" then to make the same code base to
> work in RCP as well as in RAP you will need to:
> 1. Create a plugin as a plain RCP application. This plugin will not have
> any of your business logic, but will just have the main classes reqd for
> a RCP app(Activator, Application, Workbenchadvisor etc)
> 2. Create another plugin as a plain RAP application (by changing the
> workspace and target platform ofcourse). This plugin will similarly be a
> plain vanilla plugin without any of your business logic.
> 3. Create a third plugin (this plugin will be as per my earlier reply).
> This plugin will have all the business logic to view the list of
> employees, to add/edit employees etc. You can use standard
> editors/views/SWT dialogs etc for this functionality.
>
> When you want to test the RCP implementation, include this third plugin
> in the run configuration of your RCP app.
>
> When you want to test the RAP implementation, include this third plugin
> in the run configuration of your RAP app.
>
> The source of third plugin can reside in any workspace(RCP or RAP) and
> you can simply use the import project wizard (with copy projects to
> workspace unchecked) to use the same code in both the RCP and RAP versions.
>
> From my experience you need to switch workspaces quite frequently to
> ensure that the changes that you have made to the third common plugin
> work in both the RCP and RAP scenarios.
>
> Regards,
>
> Anup Gokhale
>
>
>
> Christian Riedel wrote:
>> Hi Anup,
>>
>> thanks for your explanation. However I wonder how the project could
>> possibly work with RCP and RCP without the code being changed, when
>> for RAP you have to extend from IEntryPoint and for RCP from
>> Application(?). I mean at least this would need a code change, or am I
>> mistaken.
>>
>> However - there have been some quite useful answers to this thread so
>> far, so my first steps seem to be working. I am sure though that I
>> need to come back to you now and then ;-)
>>
>> Thanks for your support
>>
>> Christian
>>
>>
>> Anup Gokhale schrieb:
>>> Christian,
>>>
>>> We have done something similar, but we have not designed a "facade"
>>> plugin as you put it. A plugin if designed well can happily work in a
>>> RCP app and a RAP app without any change to it's code what-so-ever.
>>> You only have to take some basic precautions to ensure that the GUI
>>> of the plug-in, uses widgets that are available in both RCP and RAP.
>>> In the plugin.xml, file of your plugin, you have to mark the
>>> dependencies on org.eclipse.ui and org.eclipse.rap.ui as well as the
>>> dependencies to the RCP and RAP versions of the forms plugins as
>>> optional.
>>>
>>> Hope this helps.
>>>
>>> Anup
>>>
>>> Christian Riedel wrote:
>>>> Hi all,
>>>>
>>>> I hope you can help me with the following problem. I am developing
>>>> an application which at the moment is a pure RAP app. But I want to
>>>> be able to switch over to RCP easily. From what I have read so far,
>>>> this is best done by diving the app into several plugins.
>>>>
>>>> At the moment I have two plugins: myapp.core and myapp.ui. So from
>>>> my understanding best practice is to introduce a facade plugin, say
>>>> myapp.ui.facade which provides a facade for the RAP/RCP specific
>>>> code. And two other plugins myapp.ui.rap and myapp.ui.rcp that
>>>> provide the actual implementation for the the facade. Is that right
>>>> so far?
>>>>
>>>> My problem is that I do not know how the actual code for this facade
>>>> and the RAP or RCP plugins should look like. Can anyone of you
>>>> describe in further detail or tell me where I can find example code
>>>> that shows how to use/introduce a facade for RAP/RCP?
>>>>
>>>> I hope my problem is clear and that anyone can help.
>>>>
>>>> TIA
>>>>
>>>> Christian
>>>>
>>
Re: Help with creating a facade plugin for RAP/RCP [message #100407 is a reply to message #98198] Tue, 29 July 2008 00:32 Go to previous message
Eclipse UserFriend
Originally posted by: m.n.com

I using Spring to do the "facades". I will let you know how it goes. It
is work great so far with the RCP side.:)

Christian Riedel wrote:
> Hi Anup,
>
> right, that was my initial question. As you may have seen, I am pretty
> new to the plugin concept. All my applications before have been SWT
> standalone applications. So that may be a reason why I mixed things up
> or did not pose my question as precisely as necessary.
>
> I think one of my biggest misunderstandings so far was that it could be
> possible to start the application via the common ui plugin which then
> would either incorporate the rap-specific or the rcp-specific plugin.
>
> Never mind, I think I got it straight now.
>
> Thanks for your patience ;-)
>
> Christian
>
> Anup Gokhale schrieb:
>> Christian,
>>
>> Ahh! Now I got what you are trying to say. Suppose we want to develop
>> an application called "EmployeeDetails" then to make the same code
>> base to work in RCP as well as in RAP you will need to:
>> 1. Create a plugin as a plain RCP application. This plugin will not
>> have any of your business logic, but will just have the main classes
>> reqd for a RCP app(Activator, Application, Workbenchadvisor etc)
>> 2. Create another plugin as a plain RAP application (by changing the
>> workspace and target platform ofcourse). This plugin will similarly be
>> a plain vanilla plugin without any of your business logic.
>> 3. Create a third plugin (this plugin will be as per my earlier
>> reply). This plugin will have all the business logic to view the list
>> of employees, to add/edit employees etc. You can use standard
>> editors/views/SWT dialogs etc for this functionality.
>>
>> When you want to test the RCP implementation, include this third
>> plugin in the run configuration of your RCP app.
>>
>> When you want to test the RAP implementation, include this third
>> plugin in the run configuration of your RAP app.
>>
>> The source of third plugin can reside in any workspace(RCP or RAP) and
>> you can simply use the import project wizard (with copy projects to
>> workspace unchecked) to use the same code in both the RCP and RAP
>> versions.
>>
>> From my experience you need to switch workspaces quite frequently to
>> ensure that the changes that you have made to the third common plugin
>> work in both the RCP and RAP scenarios.
>>
>> Regards,
>>
>> Anup Gokhale
>>
>>
>>
>> Christian Riedel wrote:
>>> Hi Anup,
>>>
>>> thanks for your explanation. However I wonder how the project could
>>> possibly work with RCP and RCP without the code being changed, when
>>> for RAP you have to extend from IEntryPoint and for RCP from
>>> Application(?). I mean at least this would need a code change, or am
>>> I mistaken.
>>>
>>> However - there have been some quite useful answers to this thread so
>>> far, so my first steps seem to be working. I am sure though that I
>>> need to come back to you now and then ;-)
>>>
>>> Thanks for your support
>>>
>>> Christian
>>>
>>>
>>> Anup Gokhale schrieb:
>>>> Christian,
>>>>
>>>> We have done something similar, but we have not designed a "facade"
>>>> plugin as you put it. A plugin if designed well can happily work in
>>>> a RCP app and a RAP app without any change to it's code
>>>> what-so-ever. You only have to take some basic precautions to ensure
>>>> that the GUI of the plug-in, uses widgets that are available in both
>>>> RCP and RAP. In the plugin.xml, file of your plugin, you have to
>>>> mark the dependencies on org.eclipse.ui and org.eclipse.rap.ui as
>>>> well as the dependencies to the RCP and RAP versions of the forms
>>>> plugins as optional.
>>>>
>>>> Hope this helps.
>>>>
>>>> Anup
>>>>
>>>> Christian Riedel wrote:
>>>>> Hi all,
>>>>>
>>>>> I hope you can help me with the following problem. I am developing
>>>>> an application which at the moment is a pure RAP app. But I want to
>>>>> be able to switch over to RCP easily. From what I have read so far,
>>>>> this is best done by diving the app into several plugins.
>>>>>
>>>>> At the moment I have two plugins: myapp.core and myapp.ui. So from
>>>>> my understanding best practice is to introduce a facade plugin, say
>>>>> myapp.ui.facade which provides a facade for the RAP/RCP specific
>>>>> code. And two other plugins myapp.ui.rap and myapp.ui.rcp that
>>>>> provide the actual implementation for the the facade. Is that right
>>>>> so far?
>>>>>
>>>>> My problem is that I do not know how the actual code for this
>>>>> facade and the RAP or RCP plugins should look like. Can anyone of
>>>>> you describe in further detail or tell me where I can find example
>>>>> code that shows how to use/introduce a facade for RAP/RCP?
>>>>>
>>>>> I hope my problem is clear and that anyone can help.
>>>>>
>>>>> TIA
>>>>>
>>>>> Christian
>>>>>
>>>
>
Previous Topic:Update/close a View
Next Topic:How to change a treeitems background color of a CheckboxTreeViewer?
Goto Forum:
  


Current Time: Fri Apr 26 15:33:25 GMT 2024

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

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

Back to the top