Re: Problem load model [message #627983] |
Tue, 13 October 2009 04:03 |
Ed Merks Messages: 33142 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.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02408 seconds