Unique names validation - Builder required? [message #906769] |
Sun, 02 September 2012 13:49 |
|
Hi,
i have implemented a unique name validation based on
http://www.eclipse.org/forums/index.php/mv/msg/267004/767941/#msg_767941.
Works really fine.
But i got the problem, that the error message "Duplicate entity ... in
container" does not automatically show up in document2 after editing
document1.
Example:
initial state:
doc1.entitydsl
entity Huhu {
}
then i add doc2:
doc2.entitydsl
entity Huhu {
}
The error message "Duplicate entity Huhu in container" is immediatelly
shown in doc2, but not in doc1. I have to open doc1 and save it again.
Then the error is also shown in doc1.
Question:
I think i have to invoke some kind of builder at the doc1 after
detecting the error in doc2?! Had a look at the code of xtend, but could
not find any hints about it.
Would be really nice, if someone could give me a hint about this issue.
Thanks,
Florian
|
|
|
|
Re: Unique names validation - Builder required? [message #907024 is a reply to message #907006] |
Mon, 03 September 2012 07:06 |
|
No, saving a modified doc does not affect any other doc. So saving doc1 does only show the errors in doc1.
Btw:
Do i have to call the errror method for all found duplicates or just for the given one? Right now i just call it for the passed type.
Changed it to be called on all found duplicates in lTypes, but did also not change its behaviour.
@Check(CheckType.NORMAL)
public void checkDuplicateType_InProject(LType type) {
List<LType> lTypes = getAllFor(type);
if (lTypes.size() > 1) {
error(String.format("Duplicate type %s in container", qnp
.getFullyQualifiedName(type).toString()), type,
EntitymodelPackage.Literals.LTYPE__NAME,
ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
CODE__DUPLICATE_LTYPE_IN_PROJECT, (String[]) null);
}
}
Best,
Florian
|
|
|
Re: Unique names validation - Builder required? [message #907082 is a reply to message #907024] |
Mon, 03 September 2012 09:02 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Hi Florian,
please make sure that your IResourceDescription.Manager answers
#isAffected with true for changes in resources that export the same
names as the current resource. Otherwise it'll not be touched by the
builder.
Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 03.09.12 09:06, schrieb Florian Pirchner:> No, saving a modified doc
does not affect any other doc. So saving doc1
> does only show the errors in doc1.
>
> Btw: Do i have to call the errror method for all found duplicates or
> just for the given one? Right now i just call it for the passed type.
> Changed it to be called on all found duplicates in lTypes, but did also
> not change its behaviour.
>
>
> @Check(CheckType.NORMAL)
> public void checkDuplicateType_InProject(LType type) {
>
> List<LType> lTypes = getAllFor(type);
> if (lTypes.size() > 1) {
> error(String.format("Duplicate type %s in container", qnp
> .getFullyQualifiedName(type).toString()), type,
> EntitymodelPackage.Literals.LTYPE__NAME,
> ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
> CODE__DUPLICATE_LTYPE_IN_PROJECT, (String[]) null);
> }
> }
>
>
> Best,
> Florian
|
|
|
|
Powered by
FUDForum. Page generated in 0.03164 seconds