Skip to main content


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 MerksFriend
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/
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: Sat Apr 27 03:28:22 GMT 2024

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

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

Back to the top