|
|
Re: two editpart for one model [message #245496 is a reply to message #245486] |
Mon, 15 September 2008 16:56 |
Eclipse User |
|
|
|
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 #245514 is a reply to message #245500] |
Tue, 16 September 2008 08:30 |
Eclipse User |
|
|
|
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 14:02 |
Eclipse User |
|
|
|
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
>
|
|
|
Powered by
FUDForum. Page generated in 0.03734 seconds