Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to 'force' loading of uml resource with incorrect reference
How to 'force' loading of uml resource with incorrect reference [message #1824486] Thu, 16 April 2020 06:29 Go to next message
jo ber is currently offline jo berFriend
Messages: 94
Registered: August 2018
Member
Hi

I've an uml resource which contains some errors. When loading the resource programmatically, the resource loading process is stopped because of the error, for example:
Caused by: org.eclipse.emf.ecore.xmi.UnresolvedReferenceException: Unresolved reference 'EAID_29EABB12_178A_4d3d_ADF5_6DDF1E5F3684'.

Even I could resolve these error at the source, I'm wondering if there is a loading option to ignore these error and continue resource loading. I'm asking that, because it looks possible as I'm able to load the resource in the Eclipse View 'UML Model Editor'.

Thank you,
stay healthy.
Re: How to 'force' loading of uml resource with incorrect reference [message #1824487 is a reply to message #1824486] Thu, 16 April 2020 07:06 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
You'll see the following "pattern" in generated editors:
  public void createModel()
  {
    URI resourceURI = EditUIUtil.getURI(getEditorInput(), editingDomain.getResourceSet().getURIConverter());
    Exception exception = null;
    Resource resource = null;
    try
    {
      // Load the resource through the editing domain.
      //
      resource = editingDomain.getResourceSet().getResource(resourceURI, true);
    }
    catch (Exception e)
    {
      exception = e;
      resource = editingDomain.getResourceSet().getResource(resourceURI, false);
    }
In other words, while the getResource(..., true) might well throw an exception, the resource itself is created in the resource set and it is loaded as much as is possible. Note also that all issues with loading are recorded in resource.getErrors() and resource.getWarnings().


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How to 'force' loading of uml resource with incorrect reference [message #1824489 is a reply to message #1824487] Thu, 16 April 2020 07:45 Go to previous message
jo ber is currently offline jo berFriend
Messages: 94
Registered: August 2018
Member
thank you. Your response answered my question.
Previous Topic:[EMF] long loading time
Next Topic:EMF resource load - SAXParser loading map twice
Goto Forum:
  


Current Time: Thu Apr 25 23:40:38 GMT 2024

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

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

Back to the top