Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Newbie question: Saving resources using factories.
Newbie question: Saving resources using factories. [message #207764] Tue, 09 March 2004 05:32 Go to next message
Eclipse UserFriend
Originally posted by: stoyle0905.hotmail.com

I apologize for this very basic question, but I've searched the news groups
and the faqs, and I cannot find the solution.

I've created a model, and want to save it using the recommended method (in
the book Eclipse Modelling Framework) by creating a resource set and use its
factory mehods to create resources.

The code is very similar to the examples in the book (e.g. on page 30):

Ramproject proj = ...
ResourceSet set = new ResourceSetImpl();
URI uri = URI.createFileURI(new File("ramproject.xmi").getAbsolutePath());
Resource resource = set.createResource(uri);
resource.getContents().add(proj);
try {
resource.save(Collections.EMPTY_MAP);
}
catch (IOException e) {
...
}

Well, it doesn't work. The resource is null. I've tried everything I can
come up with, debugging, changing name/extensions and so on, but the
reference turns out null every time. I've also tried to use the same code
for the tutorial models, and the same thing happens.

It woks if I don't use the factory method, but create "resource" by:

Resource resource = new XMIResourceImpl(uri);

Does anyone know why this happens, and what I can do to correct it? Since I
am using several models, which are referencing each other, I understand that
I should use the factory method approach.

Thanks a lot!

Alf Kristian
Re: Newbie question: Saving resources using factories. [message #207796 is a reply to message #207764] Tue, 09 March 2004 05:38 Go to previous message
Eclipse UserFriend
Originally posted by: stoyle0905.hotmail.com

Sorry wrong group..... *embarrased*!


"Alf Kristian St
Previous Topic:3.0M7 startup problems.
Next Topic:Opening problems view upon errors only
Goto Forum:
  


Current Time: Tue Jul 22 09:14:12 EDT 2025

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

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

Back to the top