Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Re: Problem load model
Re: Problem load model [message #627983] Tue, 13 October 2009 04:03
Ed Merks is currently offline Ed Merks
Messages: 26152
Registered: July 2009
Senior Member
Ouakib,

It's best to use the UML newsgroup to ask UML questions. I've added it
to the "to" list of the reply. More comments below.

ouakib wrote:
> Hi ,
> I work on an eclipse application , which the aim is to get from an UML
> model all the classes having the stereotype "entity".
> I have two files : "profile.uml" which contains stereotypes and
> "mymodel.uml" which contains classes and it references "profile.uml"
> . Here is my source code :
> URI uri =
> URI.createFileURI("/projectName/model/mymodel.uml");
This doesn't look like a good file URI to me. Shouldn't you be using
URI.createPlatfromResourceURI?
> ResourceSet resourceSet = new ResourceSetImpl();
> Resource resource = resourceSet.getResource(uri, true);
> EObject value= resource.getContents().get(0);
> String proposal ="";
> for (TreeIterator<EObject> iteratorTree =
> EcoreUtil.getAllContents(value.eContents());
> iteratorTree.hasNext();) {
> EObject content = iteratorTree.next();
> if (content instanceof Class
> )
> { Class ve = (Class) content;
> if(ve.hasStereotype("Entity")) {
> proposal =ve.getName() ;
> ICompletionProposal completionProposal
> =createCompletionProposal(proposal, context);
> acceptor.accept(completionProposal); the file "mymodel.uml"
> was loaded but "profile.uml" wasn't. so the test :
> ve.hasStereotype("Entity") is always false .
> Can you see the problem?
The URI looks questionable.
Previous Topic:Possible to change EMF-Genmodel to UML2-genmodel manually?
Next Topic:UML validation from org.eclipse.emf.validation.examples.general
Goto Forum:
  


Current Time: Thu Oct 30 19:18:32 GMT 2014

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

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