Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Unique names validation - Builder required?
Unique names validation - Builder required? [message #906769] Sun, 02 September 2012 13:49 Go to next message
Florian Pirchner is currently offline Florian PirchnerFriend
Messages: 94
Registered: July 2009
Member

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 #907006 is a reply to message #906769] Mon, 03 September 2012 06:12 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
As long as you don't save doc2 its changes shouldn't affect anything in
the "persisted world". Does it show the error in doc2 when saving a the
modified doc1?

Sven

Am 9/2/12 3:49 PM, schrieb flo:
> 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
>


--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Re: Unique names validation - Builder required? [message #907024 is a reply to message #907006] Mon, 03 September 2012 07:06 Go to previous messageGo to next message
Florian Pirchner is currently offline Florian PirchnerFriend
Messages: 94
Registered: July 2009
Member

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 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
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
Re: Unique names validation - Builder required? [message #907500 is a reply to message #907082] Tue, 04 September 2012 06:05 Go to previous message
Florian Pirchner is currently offline Florian PirchnerFriend
Messages: 94
Registered: July 2009
Member

Hi Sebastian,

thanks a lot for the hint. Will try to implement it that way...

Best,
Florian
Previous Topic:Inter grammar communication issue
Next Topic:Strange operation scoping for Numbers and null
Goto Forum:
  


Current Time: Tue Apr 23 17:42:01 GMT 2024

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

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

Back to the top