Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Adapter pattern in eclipse: is it possible to have multiple adapter factories on platform?
Adapter pattern in eclipse: is it possible to have multiple adapter factories on platform? [message #663238] Mon, 04 April 2011 12:45 Go to next message
Tihomir  is currently offline Tihomir
Messages: 10
Registered: April 2011
Junior Member
I would like to use an adapter pattern to present data model from the legacy part of Eclipse RCP application I'm working on.


But there is already adapter factory for the adaptable type and I can not change that code.
Is it possible to declare additional adapter factory for the adaptable type on the Platform to make an adapter that is not present in the core (legacy) system? Or someone recommends some other approach as better solution.

Thanks in advance!

P.S. Tutorial: http://www.jeffreyricker.com/papers/Eclipse-Adapters.pdf

[Updated on: Mon, 04 April 2011 12:50]

Report message to a moderator

Re: Adapter pattern in ecluipse: is it possible to have multiple adapter factories on platform? [message #663272 is a reply to message #663238] Mon, 04 April 2011 13:45 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

As I understand it, an adapter factory is keyed on a the tuple of
sourceType,targetType. So if you were contributing a new source data
model, you could still provide an adapter factory that turned it into an
IFile representation, for example.

Or do you mean there's already a (sourceType, targetType) factory
declaration?

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: Adapter pattern in ecluipse: is it possible to have multiple adapter factories on platform? [message #663280 is a reply to message #663272] Mon, 04 April 2011 14:09 Go to previous messageGo to next message
Tihomir  is currently offline Tihomir
Messages: 10
Registered: April 2011
Junior Member
Actually I have core plugin, product platform that I can not change. But I'm using its data model. Some domain data about logging and test results.
The core system has its adapter factory which it uses for the data presentation in some tree viewer.

Now in my plugin I'm using the same data from the core plugin and I have to attach some additional informations to each data model element.
If it would be possible to change source from the core plugin, I would just add (and implement) my new adapter to existing adapter factory.
But as I can not do that I wonder if I can register in my plugin another adapter factory but for the cores domain type and convert it to my object.

Core plugin: domain type - adaptable object, object with which we are starting - source type.
Core plugin: adapter factory used for cores presentation layer.
My plugin: adapter type - my new object to which I want to adapt. New targetType, which is is not part of the existing adapter factory.

Since I can not add new targetType to existing adapter factory it would be convenient for me, if It is allowed to register additional adapter factory fort the adaptable type that already has one adapter factory. Or I need to find some workaround for that.

Tihomir

[Updated on: Mon, 04 April 2011 14:26]

Report message to a moderator

Re: Adapter pattern in ecluipse: is it possible to have multiple adapter factories on platform? [message #663287 is a reply to message #663280] Mon, 04 April 2011 14:26 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 04/04/2011 10:09 AM, Tihomir wrote:
> Therefore it would be convenient for me, if It is allowed to register
> additional adapter factory fort the adaptable type that already has one
> adapter factory.

Well, did it pass the test from my other post? If there is already
(yourType, corePresentationType) adapter factory provided then it won't
work properly.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: Adapter pattern in ecluipse: is it possible to have multiple adapter factories on platform? [message #663294 is a reply to message #663287] Mon, 04 April 2011 14:51 Go to previous messageGo to next message
Tihomir  is currently offline Tihomir
Messages: 10
Registered: April 2011
Junior Member

Thx, for replying.

But due to some deadlines maybe I'll not be able to make an test before tomorrow.

At the moment the core has (coreSrcType, coreTargetType) factory.
And I would need to have (coreSrcType, myTargetType) factory. So I'm not quite sure if I'm allowed to simply add an new (additional) factory for that coreSrcType (adaptableType).

Tihomir
Re: Adapter pattern in ecluipse: is it possible to have multiple adapter factories on platform? [message #663357 is a reply to message #663294] Mon, 04 April 2011 18:41 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 04/04/2011 10:51 AM, Tihomir wrote:
>
> Thx, for replying.
>
> But due to some deadlines maybe I'll not be able to make an test before
> tomorrow.
>
> At the moment the core has (coreSrcType, coreTargetType) factory.
> And I would need to have (coreSrcType, myTargetType) factory.

You are basically stating that you are creating a new system (processing
or presentation), and you need to adapt the core datamodel to
MyTargetType which your new system understands. That is definitely allowed.

PW



--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: Adapter pattern in eclipse: is it possible to have multiple adapter factories on platform? [message #663834 is a reply to message #663357] Wed, 06 April 2011 15:21 Go to previous message
Tihomir  is currently offline Tihomir
Messages: 10
Registered: April 2011
Junior Member
Thx, again!

Paul, you have right, it is allowed to register and use new Adapter Factory.

I still has some problems with presenting combination of core system data model and new system data model in tree viewer - stack overflow exception occurs. But it is clear that using Adapter Mechanism is reasonable approach for my case.


Previous Topic:how to define activeWhen for Undo/Redo handlers
Next Topic:How to hide the Editor tab
Goto Forum:
  


Current Time: Fri Sep 19 14:02:36 GMT 2014

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

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