Skip to main content



      Home
Home » Modeling » TMF (Xtext) » [XText] invalid import file names don't show errors in editor
[XText] invalid import file names don't show errors in editor [message #38493] Tue, 07 April 2009 01:21 Go to next message
Eclipse UserFriend
Hi,

It looks like no error is created in the editor for an import which
specifies a non-existing file. You just see errors for the lines that depend
on its contents. I suppose this should get a bugzilla entry if this is not
known about yet (???) What is the general protocol for this? Mention it to
the group first or just file a bug?

Derek
Re: [XText] invalid import file names don't show errors in editor [message #38692 is a reply to message #38493] Tue, 07 April 2009 03:45 Go to previous messageGo to next message
Eclipse UserFriend
I thought we'd already added a corresponding validator.
It's ok to file a bug immediately.
Please, don't forget to mention the version you're working with.

Thanks,
Sven

Derek Palma schrieb:
> Hi,
>
> It looks like no error is created in the editor for an import which
> specifies a non-existing file. You just see errors for the lines that
> depend on its contents. I suppose this should get a bugzilla entry if
> this is not known about yet (???) What is the general protocol for this?
> Mention it to the group first or just file a bug?
>
> Derek
Re: [XText] invalid import file names don't show errors in editor [message #38779 is a reply to message #38692] Tue, 07 April 2009 04:06 Go to previous messageGo to next message
Eclipse UserFriend
Sven,

actually there is the ImportUriValidator but it's not wired by default.

Cheers,
Heiko

Sven Efftinge schrieb:
> I thought we'd already added a corresponding validator.
> It's ok to file a bug immediately.
> Please, don't forget to mention the version you're working with.
>
> Thanks,
> Sven
>
> Derek Palma schrieb:
>> Hi,
>>
>> It looks like no error is created in the editor for an import which
>> specifies a non-existing file. You just see errors for the lines that
>> depend on its contents. I suppose this should get a bugzilla entry if
>> this is not known about yet (???) What is the general protocol for
>> this? Mention it to the group first or just file a bug?
>>
>> Derek
Re: [XText] invalid import file names don't show errors in editor [message #643399 is a reply to message #38779] Mon, 06 December 2010 13:03 Go to previous message
Eclipse UserFriend
Hi,

I'm sorry for digging up such an old topic, but I'm having the same
issue with Xtext 1.0. I'm not sure if it is a defect or if there's
something missing in my current configuration.
A snippet from my model:

<code>
Import Model.*

.....
.....
refs += Model.ValueA
.....
</code>


If the model import is invalid, for instance - if it's not found on the
classpath, all referenced objects from that resource are marked as
missing (e.g. Model.ValueA), but the import itself appears as valid.

I checked my Abstract DSL Validator and it's annotated with:
@ComposedChecks(validators=
{org.eclipse.xtext.validation.ImportUriValidator.class,
org.eclipse.xtext.validation.NamesAreUniqueValidator.class})

The ImportUriValidator does get called, but this method doesn't return
any errors, since the importUri is null for invalid Import namespaces:

@Check(value=CheckType.FAST)
public void checkImportUriIsValid(EObject object) {
String importURI = getResolver().resolve(object);
if (importURI != null && !EcoreUtil2.isValidUri(object,
URI.createURI(importURI))) {
error("Imported resource could not be found.",
getResolver().getAttribute(object).getFeatureID());
}
}

I tried implementing this sort of validation myself - I gathered all
models of the given supertype from the index (IResourceDescriptions) and
checked if the namespace of the Import object actually exists.
It all works up to a point, where some of my resources turn out to be
missing - they are probably not built yet by the incremental build process.
In this case I get a few errors, mostly from the current project (as
opposed to other projects on the Java build path). The most peculiar
thing is that when I re-validate the file (from the context menu in the
editor), the errors get resolved. If I clean and rebuild the project, I
get the same error markers.
I also tried it the hard way - locating the resource set for the current
model, resolving all elements and then finding all neccessary objects -
but again some of them (a different set actually) are missing :[

Now I really ran out of ideas, so I thought you guys might have a clue
about this :)


Thanks in advance,
Alex



Am 07.04.2009 10:06, schrieb Heiko Behrens:
> Sven,
>
> actually there is the ImportUriValidator but it's not wired by default.
>
> Cheers,
> Heiko
>
> Sven Efftinge schrieb:
>> I thought we'd already added a corresponding validator.
>> It's ok to file a bug immediately.
>> Please, don't forget to mention the version you're working with.
>>
>> Thanks,
>> Sven
>>
>> Derek Palma schrieb:
>>> Hi,
>>>
>>> It looks like no error is created in the editor for an import which
>>> specifies a non-existing file. You just see errors for the lines that
>>> depend on its contents. I suppose this should get a bugzilla entry if
>>> this is not known about yet (???) What is the general protocol for
>>> this? Mention it to the group first or just file a bug?
>>>
>>> Derek
Previous Topic:testing generator
Next Topic:optional rule with enum saves incorrectly from EMF.
Goto Forum:
  


Current Time: Sun May 25 10:54:23 EDT 2025

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

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

Back to the top