Getting an IAdaptable from an EObject [message #169473] |
Wed, 23 January 2008 07:14  |
Eclipse User |
|
|
|
Originally posted by: trommas.yahoo.com
From a new CreateViewRequest it would be:
// Get the Adapter to a newly created object
IAdaptable shapeViewAdapter = (IAdaptable) ((List) shapeRequest
..getNewObject()).get(0);
But I need the IAdaptable from an existing object. (ex: ClassNode a;)
Any Ideas?
Tomas Zijdemans
|
|
|
|
Re: Getting an IAdaptable from an EObject [message #169676 is a reply to message #169496] |
Thu, 24 January 2008 09:33   |
Eclipse User |
|
|
|
Originally posted by: trommas.yahoo.com
Christian W. Damus wrote:
> Hi, Tomas,
>
> EObjects aren't IAdaptable, so I don't know that this question really makes
> sense.
>
> There is an EObjectAdapter class that wraps an EObject for IAdaptable-ness,
> but it's up to you still to implement the required adaptations.
You are absolutely correct, it didn't make sense. What I meant was how
do I get an IAdaptable for a specific editpart?
What I'm trying to do is to create a link to an existing node - the link
creation needs two IAdaptables (source and target).
ICommand createLinkCmd = new DeferredCreateConnectionViewAndElementCommand(
connectionRequest, new EObjectAdapter((EObject) source
..getModel()), target, source.getViewer());
Thanks for helping,
Tomas Zijdemans
>
> HTH,
>
> Christian
>
> Tomas Zijdemans wrote:
>
>> From a new CreateViewRequest it would be:
>>
>> // Get the Adapter to a newly created object
>> IAdaptable shapeViewAdapter = (IAdaptable) ((List) shapeRequest
>> .getNewObject()).get(0);
>>
>> But I need the IAdaptable from an existing object. (ex: ClassNode a;)
>>
>>
>> Any Ideas?
>>
>> Tomas Zijdemans
>
|
|
|
Re: Getting an IAdaptable from an EObject [message #169691 is a reply to message #169676] |
Thu, 24 January 2008 10:01   |
Eclipse User |
|
|
|
Originally posted by: trommas.yahoo.com
It seems to be solved. Just throwing the editpart to IAdaptable seems to
work :) Doh!
Cheers,
Tomas Zijdemans
Tomas Zijdemans wrote:
> Christian W. Damus wrote:
>> Hi, Tomas,
>>
>> EObjects aren't IAdaptable, so I don't know that this question really
>> makes
>> sense.
>>
>> There is an EObjectAdapter class that wraps an EObject for
>> IAdaptable-ness,
>> but it's up to you still to implement the required adaptations.
>
> You are absolutely correct, it didn't make sense. What I meant was how
> do I get an IAdaptable for a specific editpart?
>
> What I'm trying to do is to create a link to an existing node - the link
> creation needs two IAdaptables (source and target).
>
> ICommand createLinkCmd = new DeferredCreateConnectionViewAndElementCommand(
> connectionRequest, new EObjectAdapter((EObject) source
> .getModel()), target, source.getViewer());
>
>
> Thanks for helping,
>
> Tomas Zijdemans
>
>
>>
>> HTH,
>>
>> Christian
>>
>> Tomas Zijdemans wrote:
>>
>>> From a new CreateViewRequest it would be:
>>>
>>> // Get the Adapter to a newly created object
>>> IAdaptable shapeViewAdapter = (IAdaptable) ((List) shapeRequest
>>> .getNewObject()).get(0);
>>>
>>> But I need the IAdaptable from an existing object. (ex: ClassNode a;)
>>>
>>>
>>> Any Ideas?
>>>
>>> Tomas Zijdemans
>>
|
|
|
Re: Getting an IAdaptable from an EObject [message #169699 is a reply to message #169691] |
Thu, 24 January 2008 10:04  |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Tomas,
Yes, all EditParts in GEF are adaptable (EditPart implements IAdaptable).
I'm glad it worked out!
Cheers,
Christian
Tomas Zijdemans wrote:
> It seems to be solved. Just throwing the editpart to IAdaptable seems to
> work :) Doh!
>
> Cheers,
>
> Tomas Zijdemans
>
-----8<-----
|
|
|
Powered by
FUDForum. Page generated in 0.04302 seconds