Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » MarkerUtil problem
MarkerUtil problem [message #418604] Mon, 21 April 2008 21:43 Go to next message
Kristian Sons is currently offline Kristian SonsFriend
Messages: 27
Registered: July 2009
Junior Member
Hello!

I want validation failures to be displayed in the ProblemsView. I use an
Editor generated by the ecore genmodel. For a live validation I do the
following:

IStatus status = validator.validate(notification);

if (!status.isOK()) {
if (status.isMultiStatus()) {
status = status.getChildren()[0];
}
try
{
MarkerUtil.createMarkers(status);
}
catch (CoreException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}

This will not create any markers since in:

file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(
new Path(fileResourcePath.toString()));

file is alway null. It seems to me that this function is only for
resources in the workspace. But the getTarget().eResource().getURI() will
return a absoulte path to the file I loaded.


Thanks for help and best regards,
Kristian
Re: MarkerUtil problem [message #418606 is a reply to message #418604] Mon, 21 April 2008 22:04 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Kristian,

IMarkers, being objects associated with IFiles, can only be applied for
workspace resources. It's a basic Eclipse limitation that we can't do
anything about in EMF...


Kristian Sons wrote:
> Hello!
>
> I want validation failures to be displayed in the ProblemsView. I use
> an Editor generated by the ecore genmodel. For a live validation I do
> the following:
>
> IStatus status = validator.validate(notification);
> if (!status.isOK()) {
> if (status.isMultiStatus()) {
> status = status.getChildren()[0];
> }
> try
> {
> MarkerUtil.createMarkers(status);
> }
> catch (CoreException e)
> {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
> This will not create any markers since in:
>
> file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(
> new Path(fileResourcePath.toString()));
>
> file is alway null. It seems to me that this function is only for
> resources in the workspace. But the getTarget().eResource().getURI()
> will return a absoulte path to the file I loaded.
>
>
> Thanks for help and best regards,
> Kristian
>
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:EMF Validation Framework
Next Topic:EMF attributes overriding
Goto Forum:
  


Current Time: Fri Apr 26 18:37:36 GMT 2024

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

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

Back to the top