Implementing RAP from RCP - best practice? [message #56688] |
Wed, 31 October 2007 23:12 |
Martin Dilger Messages: 54 Registered: July 2009 |
Member |
|
|
Hi,
i have an RCP Application. Now we have a new UseCase and some Logic from
the RCP CLient must be exposed to the Web.
RAP is perfect.
So what would be a best practice to work on this?
It would be important to change as few code as possible.
I thought about that. I think the best way would
be to create 2 workspaces. One for the RCP and the RAP - Application.
Every Plugin in the RCP-APplication has 2 Source-Folders, one for the RCP
dependant Code and one for the Common Code. The RAP Client has also 2
Folders, a RAP-Folder and a Source-Folder which links to the Common Code
of the RCP Application.
A Problem is, that the RCP CLient, which is already developed must be
refactored, so that RCP-dependent code is separated from the Domaincode.
Also there are several sourcefolders to be managed, and another problem
is, that the linked folders link to targets relative to the workspace, so
that every time one of my colleagues checks out the projects, the paths
have to be updated.
What are your thoughts about this? is there a better way to do that? or
how do you do that?
Thank in advance
Greetings
Martin
|
|
|
|
|
Re: Implementing RAP from RCP - best practice? [message #57339 is a reply to message #57288] |
Sun, 04 November 2007 21:39 |
Eclipse User |
|
|
|
Originally posted by: eclipse-dev.volanakis.de
Hi Martin,
we use the following approach for UI-code. We have three plug-ins:
foo.bar.ui.base - contains all common UI code
adds common contributions via plugin.xml
foo.bar.ui.rcp - contains RCP specific code
adds RCP specific contributions via plugin.xml
depends on foo.bar.ui.base
foo.bar.ui.rap - contains RAP specific code
adds RAP specific contributions via plugin.xml
depends on foo.bar.ui.base
Then we have two workspaces.
RCP workspace - has ui.base + ui.rcp. Uses RCP target.
RAP workspace - has ui.base + ui.rap. Uses RAP target.
In the beginning we had to spend some time refactoring, to move most of
the existing code to the ui.base plug-in.
Optionally: we also use a "service" approach to "inject" different
behavior into the base (example: an interface ISomething used in
ui.base. Ui.rcp / Ui.rap contribute a different implementation of
ISomething. We use a custom extension point for that. It seems you could
do the same with OSGi services too).
This works for us. YMMV.
Regards,
Elias.
Martin wrote:
> No suggestions?
> How do you solve such issues when both, the RCP and the RAP are
> developed in parallel and the same source code should be used as far as
> possible?
> I would really like any suggestions on this.
>
> Martin
>
|
|
|
|
|
Re: Implementing RAP from RCP - best practice? [message #58130 is a reply to message #58081] |
Wed, 07 November 2007 04:51 |
Eclipse User |
|
|
|
Originally posted by: eclipse-dev.volanakis.de
Hi David,
david wang wrote:
> May I have a look on your plugin dependence setting
> I am still doubt how to set the dependence for UI.BASE
> thanks
>
I can't post code since it is a closed source project, but I'm ok with
answering any specific questions you may have.
Essentially the issue with foo.bar.ui.base is that in the RCP scenario
it has to use the swt / jface / workbench implementation that is part of
RCP - and in the RAP scenario it has to use the RAP equivalents. So how
to you express this different dependencies in the MANIFEST.MF ?
It think this can be tackled in three ways:
(a) having two different MANIFEST.MFs in each workspace
(b) having a optional dependencies to both the org.eclipse.ui plugin and
the org.eclipse.rap.ui plugin. Since only one of those exists in any
target (RCP / RAP) you are fine. I just tried this approach and it works
for me. I like it because is relatively simple, but have to use it for a
bit more to see if there are any drawbacks.
The MANIFEST.MF looks like this:
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui;resolution:=optional,
org.eclipse.rap.ui;resolution:=optional
(c) Using Import-Package instead of Require-Bundle. With this you can
specify that you want to use some packages in your plug-in but do not
care from what plug-in the implementation is coming from. The OSGi crowd
favors this approach for the added flexibility (for example it does not
matter if you refactor the package and move it to another plug-in). The
drawback is that you potentially have to add many packages to the
Import-Package statement in the MANIFEST.MF until you have everything
you need.
Let me know if this helped. :-)
Regards,
Elias.
|
|
|
|
|
Re: Implementing RAP from RCP - best practice? [message #60150 is a reply to message #58254] |
Fri, 16 November 2007 01:08 |
Eclipse User |
|
|
|
Originally posted by: xinqiang_wang.yahoo.com
very gooood news
I have setup my project which for telecommunication SMS web-app
they need both RCP and RAP
I got most of developers work on RCP branch
so they are easy to develop and test
no need wait the browser to startup to play the RAP
the RAP and RCP can reuse all of the VIEWs code and some perspective's
that 's very excellent
----------------------------
I will pay bill too
once anybody trip to my town even my country
I will pay the beer and the dinner
|
|
|
Powered by
FUDForum. Page generated in 0.03540 seconds