Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Cloning a resource
Cloning a resource [message #415923] Fri, 11 January 2008 11:47 Go to next message
steve rooks is currently offline steve rooksFriend
Messages: 3
Registered: July 2009
Junior Member
What is the best way to clone the contents of a resource, preserving all
object links?

Today, I've done something really simple, I save the resouce as a duplicate
file, and then open it, however I'm running into UI thread issues when I do
the save (I was trying todo this within a job).

So, is there something like,

cloneResource = originalResource.clone();

If not, how difficult would this be to achieve?

Many thanks,

steve rooks
Re: Cloning a resource [message #415926 is a reply to message #415923] Fri, 11 January 2008 12:50 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33218
Registered: July 2009
Senior Member
Steve,

You can use EcoreUtil.copyAll(resource.getContents()) and then add them
all to a new resource.


steve rooks wrote:
> What is the best way to clone the contents of a resource, preserving all
> object links?
>
> Today, I've done something really simple, I save the resouce as a duplicate
> file, and then open it, however I'm running into UI thread issues when I do
> the save (I was trying todo this within a job).
>
> So, is there something like,
>
> cloneResource = originalResource.clone();
>
> If not, how difficult would this be to achieve?
>
> Many thanks,
>
> steve rooks
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Q: extensible models
Next Topic:Proble when saving a resouce...
Goto Forum:
  


Current Time: Thu Sep 26 07:31:14 GMT 2024

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

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

Back to the top