Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Using Drawable interface for class binary compability
Using Drawable interface for class binary compability [message #120327] Tue, 03 February 2009 16:55 Go to next message
Enrico Zanaga is currently offline Enrico ZanagaFriend
Messages: 50
Registered: July 2009
Member
Hi,

I've a project with sources written for both RCP and RAP, but comparing
the generated .class files I've found some differences.

I've created a dummy GC class for RAP with empty methods, and in .class
files for RCP there's a reference to java/lang/Drawable, while in .class
files for RAP there's a reference to java/lang/Resource.

I wish to use the same compiled .class files in RCP and RAP.

Is it possible to create an empty org.eclipse.swt.graphics.Drawable
interface in RAP libraries and let Control, Device, and Image classes
implements the Drawable interface (like in SWT)?

Thanks,
Enrico
Re: Using Drawable interface for class binary compability [message #120384 is a reply to message #120327] Wed, 04 February 2009 05:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: evolanakis.innoopract.com

Hi Enrico,

maybe I'm misunderstanding what you try to do, but...

RWT (i.e. RAP) offers compile-time compatibility with SWT, _not_ runtime
compatibility. That means you won't be able to use the same class files
for both RCP and RAP, if those classes have dependencies to UI (SWT,
RCP, JFace).

Of course if you are talking about core classes (i.e. datamodels) you
should be able to use those in any setting regardless of the UI technology.

Hope this helps,
Elias.

Enrico Zanaga wrote:
> Hi,
>
> I've a project with sources written for both RCP and RAP, but comparing
> the generated .class files I've found some differences.
>
> I've created a dummy GC class for RAP with empty methods, and in .class
> files for RCP there's a reference to java/lang/Drawable, while in .class
> files for RAP there's a reference to java/lang/Resource.
>
> I wish to use the same compiled .class files in RCP and RAP.
>
> Is it possible to create an empty org.eclipse.swt.graphics.Drawable
> interface in RAP libraries and let Control, Device, and Image classes
> implements the Drawable interface (like in SWT)?
>
> Thanks,
> Enrico


--
---
Elias Volanakis
Innoopract, Inc.
http://www.innoopract.com
Re: Using Drawable interface for class binary compability [message #120421 is a reply to message #120327] Wed, 04 February 2009 09:28 Go to previous messageGo to next message
Benjamin Muskalla is currently offline Benjamin MuskallaFriend
Messages: 338
Registered: July 2009
Senior Member
Hi,

Drawable is marker interface to indicate that you can acquire a GC from
the implementors - as we don't have a GC available yet it is unlikely
that we introduce this interface. As we try to be a concrete subset of
SWT we only offer API we really support.

Regarding the class file compatibility - I see your point but personally
I would not recommend to reuse the same .class files for both platforms
as this can lead to several runtime problems due to missing API.

Cheers
Benny

Enrico Zanaga wrote:
> Hi,
>
> I've a project with sources written for both RCP and RAP, but comparing
> the generated .class files I've found some differences.
>
> I've created a dummy GC class for RAP with empty methods, and in .class
> files for RCP there's a reference to java/lang/Drawable, while in .class
> files for RAP there's a reference to java/lang/Resource.
>
> I wish to use the same compiled .class files in RCP and RAP.
>
> Is it possible to create an empty org.eclipse.swt.graphics.Drawable
> interface in RAP libraries and let Control, Device, and Image classes
> implements the Drawable interface (like in SWT)?
>
> Thanks,
> Enrico
Re: Using Drawable interface for class binary compability [message #120437 is a reply to message #120421] Wed, 04 February 2009 15:27 Go to previous messageGo to next message
Stefan Hansel is currently offline Stefan HanselFriend
Messages: 103
Registered: July 2009
Senior Member
>> Regarding the class file compatibility - I see your point but
personally
>> I would not recommend to reuse the same .class files for both platforms

>> as this can lead to several runtime problems due to missing API.

Mhmm - we are doing exactly that and actually expected RWT to be binary
compatible (as far as supported API is concerned).
We compile against swt.jars once - and at runtime we switch to rwt.jar or
swt.jar as needed by the deployment.

This worked without problems so far - of course all incompatibilities
where abstracted with the common single-sourcing techniques, so of course
we have a little extra jar compiled against rwt.
But 95% of the code are compiled against swt.jar.

I'm wondering, why Enrico gets problems with the Drawable-Interface.
We use Control, Image and Device as well (but never reference them via the
Drawable-Interface, because that wouldn't make sense).

Enrico, could you post a small snippet which causes you trouble ?
Re: Using Drawable interface for class binary compability [message #120449 is a reply to message #120437] Wed, 04 February 2009 16:28 Go to previous message
Enrico Zanaga is currently offline Enrico ZanagaFriend
Messages: 50
Registered: July 2009
Member
Hi Stefan, Elias, and Benny,

I'm having trouble using GC. I know that GC doesn't exists in RWT, but
I've created a my own GC class.

The difference was that SWT GC class has the constructor GC(Drawable),
while my GC class has 3 constructors: GC(Control), GC(Image),
GC(Device), because Control, Image, and Device don't implement Drawable.

This situation makes .class binary files to differ from RWT and SWT
version of my jars.

I resolved wrapping the SWT GC class and my GC class to another class
called CompabilityGC zipped in 2 compability jar, one for SWT and one
for RWT.

So I can use the same compiled .class files for SWT and RWT, except for
a little compability jar file.

Thanks to all for the attention,
Enrico


stefan.hansel@tolina.de ha scritto:
>>> Regarding the class file compatibility - I see your point but
> personally
>>> I would not recommend to reuse the same .class files for both platforms
>
>>> as this can lead to several runtime problems due to missing API.
>
> Mhmm - we are doing exactly that and actually expected RWT to be binary
> compatible (as far as supported API is concerned).
> We compile against swt.jars once - and at runtime we switch to rwt.jar or
> swt.jar as needed by the deployment.
>
> This worked without problems so far - of course all incompatibilities
> where abstracted with the common single-sourcing techniques, so of course
> we have a little extra jar compiled against rwt.
> But 95% of the code are compiled against swt.jar.
>
> I'm wondering, why Enrico gets problems with the Drawable-Interface.
> We use Control, Image and Device as well (but never reference them via the
> Drawable-Interface, because that wouldn't make sense).
>
> Enrico, could you post a small snippet which causes you trouble ?
>
Previous Topic:Register PespectiveListener
Next Topic:Display.sleep different return type
Goto Forum:
  


Current Time: Wed Dec 01 03:40:46 GMT 2021

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

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

Back to the top