Skip to main content



      Home
Home » Eclipse Projects » GEF » two editpart for one model
two editpart for one model [message #245486] Mon, 15 September 2008 09:23 Go to next message
Eclipse UserFriend
hi,

can anybody tell me, is that possible, that two Editparts
are just for one model ? if yes. how it works ?

thanks
ming
Re: two editpart for one model [message #245491 is a reply to message #245486] Mon, 15 September 2008 10:21 Go to previous messageGo to next message
Eclipse UserFriend
Hi.
For my experience, isn't possible that two editParts corresponding to
one model. Internally, GEF map all EditPart instances generated by
EditPartFactory, with only model element.
My suggest is creating "fake" model objects ...

Marco

ming ha scritto:
> hi,
>
> can anybody tell me, is that possible, that two Editparts
> are just for one model ? if yes. how it works ?
>
> thanks
> ming
>
Re: two editpart for one model [message #245496 is a reply to message #245486] Mon, 15 September 2008 12:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: un1c0.email.it

ming wrote:

> hi,
>
> can anybody tell me, is that possible, that two Editparts
> are just for one model ? if yes. how it works ?
>
> thanks
> ming

Do you mean two different class for one model class?
In that case, you can create a subclass of EditPartFactory with
createEditPart(EditPart context, Object model) method that returns instances
of different classes based on state of "context" or/and "model".

If you mean two o more instances of EditPart for one instace of a model
class; it is possible too.

Roberto Zanon
Re: two editpart for one model [message #245500 is a reply to message #245496] Mon, 15 September 2008 15:37 Go to previous messageGo to next message
Eclipse UserFriend
thanks for ur reply.

i mean exactly two instances of EditPart for one instace of a model.
which means that these two Editparts is responsible for this model.

but each time in editpartfactory for each model can only one editpart
be created.

would u please tell me handle this problem.

thanks alot

ming zhang
Re: two editpart for one model [message #245514 is a reply to message #245500] Tue, 16 September 2008 04:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: un1c0.email.it

ming wrote:

> thanks for ur reply.
>
> i mean exactly two instances of EditPart for one instace of a model.
> which means that these two Editparts is responsible for this model.
>
> but each time in editpartfactory for each model can only one editpart
> be created.
>
> would u please tell me handle this problem.
>
> thanks alot
>
> ming zhang

For example you can have two instances of editPart for a model if you have
two visualisations or editors showing the same model: so you have two
EditPartViewer, each with the same model (set with setContents(Object)) and
will be created two editPart for all objects of model. If you want
different editPart in the two viewer, you can assign different
EditPartFactory to each EditPartViewer.

In general, you only need that the same model object is returned more times
as a "modelChild" of EditParts.

A dummy example to associate a two editPart to a model can be:
class XX extends AbstractGraphicalEditPart {
protected List getModelChildren() {
List duplicate = new LinkedList();
duplicate.addAll(getCastedModel().getChildren()));
duplicate.addAll(getCastedModel().getChildren()));
return duplicate;
}
......

Roberto Zanon
Re: two editpart for one model [message #245538 is a reply to message #245486] Tue, 16 September 2008 10:02 Go to previous message
Eclipse UserFriend
Originally posted by: felix.mayer.erdas.com

I am using 2 EditParts for the same model. In
EditPartFactory.createEditPart(EditPart context, Object model), I use the
context (parent) EditPart to determine out which child EditPart to create.
The only issue I have encountered is that the EditPart Registry does not
work any more because it is just a Map of model objects to EditParts.

"ming " <aachenzhang@yahoo.de> wrote in message
news:83e5d5d9a5e3d224f9923830f860e0df$1@www.eclipse.org...
> hi,
>
> can anybody tell me, is that possible, that two Editparts
> are just for one model ? if yes. how it works ?
>
> thanks
> ming
>
Previous Topic:resize canvas when things in lightweightsystem change
Next Topic:How can i create orthogonal connections on from existing diagram
Goto Forum:
  


Current Time: Thu Jul 17 02:32:10 EDT 2025

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

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

Back to the top