|
Re: PropertySource vs Adapter beginner question [message #129602 is a reply to message #129332] |
Wed, 28 April 2004 22:35 |
Eclipse User |
|
|
|
Originally posted by: chris.gaudi.freeserve.co.uk
I have just been doing something similar and asking myself the same
question.
It seems the abstract graphical viewer implements ISelectionProvider (which
provides the selection object(s) to Eclipse - and hence the property sheet).
The selection is the selected EditPart(s) - which implements IAdaptable and
delegate (if possible) to the model object to provide for IPropertySource or
IAdaptable (which in turn means the model can provide an IPropertySource
adapter) [see source code for AbstractEditPart#getAdapter()].
If you don't like "polluting" the model with IPropertySource methods then
implement IAdaptable and provide another class to do the IPropertySource
methods. Personally I can live with the model implementing IPropertySource,
as I am normally editing the properties of the model object.
The proprty sheet uses the methods of IPropertySource (such as
getPropertyDescriptors and getPropertyValue(Object propID)) to populate the
sheet.
- Chris
"Steven Melzer" <smelzer@paymentech.com> wrote in message
news:c6ol3t$iet$1@eclipse.org...
> hello,
>
> i am just starting out with GEF. i am creating a diagram as an editor
> using the GraphicalEditor. i want to have the elements on the screen
> exposed on the Properties View. i see two slightly different ways to do
> this:
> 1) have your model implement IAdaptable and call off to a IPropertySource
> 2) have your model implement IPropertySource
>
> the logic example seems to use the (2) case and the example at eclipse.org
> uses the (1) case. i decided to use the (1) case because i had started
> down that road from reading the example, and all works very well.
>
> my question is more about what is happening under the covers, because i
> eventually want to use my own EditorPart and not the GraphicalEditor. why
> does the model have the handle to the property sheet information, it seems
> to clutter the model? how is the model geting called to update the
> property sheet? does anyone have an example of using a model with a
> custom GraphicalEditor?
>
> BTW - to the people who developed the GEF framework. it is very
> impressive and very comprehensive.
>
> thanks,
> steve
>
|
|
|
Powered by
FUDForum. Page generated in 0.03579 seconds