Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to get IResource from EObject?
icon10.gif  How to get IResource from EObject? [message #1404417] Fri, 01 August 2014 08:48 Go to next message
Dat Nguyen is currently offline Dat NguyenFriend
Messages: 34
Registered: July 2014
Member
Hi, i'm a newbie, so i'm sorry if i asked a stupid question!
I want to make my own validation in my EMF Model and display errors into my own view like problem view. I have read about marker: http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2FresAdv_markers.htm and created a new marker to errors of my validation.
My problem is: i have no idea to get IResource (to create marker IResource.createMarker in case of error) from selected EObject element in Editor. its must be org.eclipse.core.resources.IResource not other

thanks advance!!!
Re: How to get IResource from EObject? [message #1404419 is a reply to message #1404417] Fri, 01 August 2014 09:13 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30350
Registered: July 2009
Senior Member
Dat,

eObject.eResource().getURI() gives in combination with
https://wiki.eclipse.org/EMF/FAQ#How_do_I_map_between_an_EMF_Resource_and_an_Eclipse_IFile.3F
should do the trick. You can also use
org.eclipse.emf.edit.ui.util.EditUIMarkerHelper.getFile(Object).

On 01/08/2014 10:48 AM, Dat Nguyen wrote:
> Hi, i'm a newbie, so i'm sorry if i asked a stupid question!
> I want to make my own validation in my EMF Model and display errors
> into my own view like problem view. I have read about marker:
> http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2FresAdv_markers.htm
> and created a new marker to errors of my validation.
> My problem is: i have no idea to get IResource (to create marker
> IResource.createMarker in case of error) from selected EObject element
> in Editor. its must be org.eclipse.core.resources.IResource not other
>
> thanks advance!!!
Re: How to get IResource from EObject? [message #1404423 is a reply to message #1404419] Fri, 01 August 2014 09:43 Go to previous message
Dat Nguyen is currently offline Dat NguyenFriend
Messages: 34
Registered: July 2014
Member
thanks you!
Previous Topic:java.lang.ExceptionInInitializerError
Next Topic:Customizing icons associated with EEnum
Goto Forum:
  


Current Time: Sat Aug 17 15:14:55 GMT 2019

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

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

Back to the top