Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Propertyview without using IAdaptable in the core model
Propertyview without using IAdaptable in the core model [message #259848] Thu, 08 July 2004 15:42 Go to next message
Eclipse UserFriend
Hi everybody,

how is it possible to display my model elements in the propertyview?
The thing is that I cannot implement the IAdaptable interface in my model
elements.

However I implemented an AdapterFactory that handles the getAdapter calls
for
a given model element.

I register my model element in the factory like that...

Platform.getAdapterManager().registerAdapters (this, UMLClass.class);

then in my getAdapter implemantation I did the following...

if (adaptableObject instanceof UMLClass && adapterType.equals
(UMLClassAdapter.class))
{

return new UMLClassAdapter ((UMLClass) adaptableObject);
}

I modified also the getAdapterList method...

public Class[] getAdapterList()
{
return new Class[]{ IPropertySource.class,UMLClassAdapter.class};
}


However the getAdapter method is never called when I click on the EditPart
for the model element...

Does anyone has an idea?

Thank's in advance...
Pet
Re: Propertyview without using IAdaptable in the core model [message #279968 is a reply to message #259848] Wed, 26 January 2005 07:49 Go to previous message
Eclipse UserFriend
One possible solution would include creating a wrapper class that
implements IAdaptable interface (way simplified):

public class AdaptableDecorator implements IAdaptable {
public Object adaptable;
public Object getAdapter(Class adapter) {
if (adapter.isInstance(adaptable)) return adaptable;
return Platform.getAdapterManager()
.getAdapter(adaptable, adapter)
}
}

Then - whenever You need to add adaptable behavior for Your model
objects, You just wrap them within AdaptableDecorator.


Peter T wrote:
> Hi everybody,
>
> how is it possible to display my model elements in the propertyview?
> The thing is that I cannot implement the IAdaptable interface in my model
> elements.
>
> However I implemented an AdapterFactory that handles the getAdapter calls
> for
> a given model element.
>
> I register my model element in the factory like that...
>
> Platform.getAdapterManager().registerAdapters (this, UMLClass.class);
>
> then in my getAdapter implemantation I did the following...
>
> if (adaptableObject instanceof UMLClass && adapterType.equals
> (UMLClassAdapter.class))
> {
>
> return new UMLClassAdapter ((UMLClass) adaptableObject);
> }
>
> I modified also the getAdapterList method...
>
> public Class[] getAdapterList()
> {
> return new Class[]{ IPropertySource.class,UMLClassAdapter.class};
> }
>
>
> However the getAdapter method is never called when I click on the EditPart
> for the model element...
>
> Does anyone has an idea?
>
> Thank's in advance...
> Pet
>
>


--
Roland Tepp
Previous Topic:High Level Eclipse Component Model Diagrams
Next Topic:Eclipse startup times
Goto Forum:
  


Current Time: Thu Sep 18 17:59:31 EDT 2025

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

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

Back to the top