Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Re: MweReader class
Re: MweReader class [message #480661] Tue, 18 August 2009 07:19 Go to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Ouakib,

as the last question is related to EMF, I'll add the respective
newsgroup to this post.
You may want to refer to the Diagnostic API of EMF to get an idea about
navigating and printing them.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 17.08.09 19:05, schrieb ouakib:
> Hi ,
> I manage to generate the model from a string Here is my code :
>
> protected void invokeInternal(WorkflowContext ctx, ProgressMonitor
> monitor, Issues issues) {
> XtextResourceSet set = injector.getInstance(XtextResourceSet.class);
> set.setClasspathURIContext(getClasspathURIContext());
> set.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
>
> Resource resource = set.createResource(URI.createURI("dummy:/mydsl.math"));
> InputStream in = new ByteArrayInputStream("log(1)/".getBytes());
> try {
> resource.load(in, set.getLoadOptions());
> } catch (IOException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> EObject value= resource.getContents().get(0);
> System.out.println(resource.getErrors().get(0).getMessage()) ;
> ctx.set(outputSlot, value);
> registerIssues(set,issues);
> if (validate) {
> Diagnostic diagnostic = Diagnostician.INSTANCE.validate(value,
> getContext());
> registerIssues(diagnostic, issues);
> System.out.println(diagnostic.getMessage());
> System.out.println(diagnostic.getChildren().get(0).getMessag e());
> }
> }
>
>
>
> To get the syntax errors I write :
> resource.getErrors().get(0).getMessage()
> that 's works fine.
> But I have problems to get EMF problems which I make with check validation.
> I write : diagnostic.getChildren().get(0).getMessage()
> but I have as result something like :Diagnosis of
> mailto:math.impl.Model00Impl@1edc4ee{dummy:/mydsl.math#/}
>
Re: MweReader class [message #480679 is a reply to message #480661] Tue, 18 August 2009 08:20 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Diagnostics form a tree structure, so you'll want to visit all of them.


Sebastian Zarnekow wrote:
> Hi Ouakib,
>
> as the last question is related to EMF, I'll add the respective
> newsgroup to this post.
> You may want to refer to the Diagnostic API of EMF to get an idea
> about navigating and printing them.
>
> Regards,
> Sebastian


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Best practices for versioning and migration
Next Topic:DragAndDrop- or Move-Command Issue
Goto Forum:
  


Current Time: Thu Apr 25 15:30:01 GMT 2024

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

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

Back to the top