Creating EMF Model from a bean object [message #30651] |
Thu, 15 April 2004 06:17  |
Eclipse User |
|
|
|
Originally posted by: sibin.exorindia.com
Hi EveryBody,
I am trying to implement the Cut and Paste feature
for the Visual editor.For the same purpose I have created a popup menu
option.When I select an editpart and cut it, the bean object which is
obtained from the EMF model is serialized and kept in a clipBoard.When I
paste it, I need to get the EMF model of the bean Object .Is it possible to
do the conversion by direct coding.Is it possible to create a new editpart
from this created model .
It will be a great help ,if somebody can mention any practical
difficulties in this approach.
Thanks
Sibin
|
|
|
Re: Creating EMF Model from a bean object [message #30825 is a reply to message #30651] |
Thu, 15 April 2004 09:48  |
Eclipse User |
|
|
|
Hi sibin,
> I am trying to implement the Cut and Paste feature
> for the Visual editor.For the same purpose I have created a popup menu
> option.When I select an editpart and cut it, the bean object which is
> obtained from the EMF model is serialized and kept in a clipBoard.When I
> paste it, I need to get the EMF model of the bean Object .Is it possible to
> do the conversion by direct coding.Is it possible to create a new editpart
> from this created model .
How are you serialzing the bean object ? The EMF object that represents
the actual IDE bean is held in the resource used by the editor itself.
I think the approach would be to actually copy this object into a new
EMF resource that you create because you will need to resolve any
references. If they are to properties that aren't shared you can add
them to the new resource (i.e. cascade the copy) and if they point to
external objects you will need to maybe start by stubbing these out.
Then once you have a copy of the object being copied with its properties
and owned objects (and their properties, etc...) you can serialize this
to the clipboard.
On paste you then want to open the clipboard contents into an EMF
resource and have a GEF tool that was able to have it as its target
object. You could look at the one we use on the palette to do drop
which is AnnotedCreationEntry that has a pluggable factory.
> It will be a great help ,if somebody can mention any practical
> difficulties in this approach.
This is something we have wanted to do for a while but never got around
to doing it. It's great that you want to do it yourself - the best
approach might be to use the ve.dev.org mailing list and we can design
and flush this out and find a way for any code you write to get into the
VE as a contribution.
Best regards,
Joe Winchester
|
|
|
Re: Creating EMF Model from a bean object [message #586204 is a reply to message #30651] |
Thu, 15 April 2004 09:48  |
Eclipse User |
|
|
|
Hi sibin,
> I am trying to implement the Cut and Paste feature
> for the Visual editor.For the same purpose I have created a popup menu
> option.When I select an editpart and cut it, the bean object which is
> obtained from the EMF model is serialized and kept in a clipBoard.When I
> paste it, I need to get the EMF model of the bean Object .Is it possible to
> do the conversion by direct coding.Is it possible to create a new editpart
> from this created model .
How are you serialzing the bean object ? The EMF object that represents
the actual IDE bean is held in the resource used by the editor itself.
I think the approach would be to actually copy this object into a new
EMF resource that you create because you will need to resolve any
references. If they are to properties that aren't shared you can add
them to the new resource (i.e. cascade the copy) and if they point to
external objects you will need to maybe start by stubbing these out.
Then once you have a copy of the object being copied with its properties
and owned objects (and their properties, etc...) you can serialize this
to the clipboard.
On paste you then want to open the clipboard contents into an EMF
resource and have a GEF tool that was able to have it as its target
object. You could look at the one we use on the palette to do drop
which is AnnotedCreationEntry that has a pluggable factory.
> It will be a great help ,if somebody can mention any practical
> difficulties in this approach.
This is something we have wanted to do for a while but never got around
to doing it. It's great that you want to do it yourself - the best
approach might be to use the ve.dev.org mailing list and we can design
and flush this out and find a way for any code you write to get into the
VE as a contribution.
Best regards,
Joe Winchester
|
|
|
Powered by
FUDForum. Page generated in 0.02586 seconds