Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Xtext 2.4.2: What is CancelationIndicator ?(Cancelling a validation ???)
Xtext 2.4.2: What is CancelationIndicator ? [message #1075745] Mon, 29 July 2013 21:29 Go to next message
Eclipse UserFriend
Dear all,

While reading the code of of a validator, I hit the CancelIndicator, and don't understand what is its purpose and how to see its effect.

Can someone provide me with a hint ?

// Initializing code, inside org.eclipse.xtext.validation.NamesAreUniqueValidator{}

Map context = AbstractDeclarativeValidator.getContext();
CancelIndicator cancelIndicator = (CancelIndicator) context.get(CancelableDiagnostician.CANCEL_INDICATOR);
...

// Client code
org.eclipse.xtext.validation.NamesAreUniqueValidationHelper{

	public void checkUniqueNames(Iterable<IEObjectDescription> descriptions, CancelIndicator cancelIndicator, ValidationMessageAcceptor acceptor)
	{
		Iterator iter = descriptions.iterator();
		if (!(iter.hasNext()))
			return;
		Map clusterToNames = Maps.newHashMap();
		while (iter.hasNext())
		{
			IEObjectDescription description = (IEObjectDescription) iter.next();
			checkDescriptionForDuplicatedName(description, clusterToNames, acceptor);
			if ((cancelIndicator != null) && (cancelIndicator.isCanceled()))
				return;
		}
	}

}

[Updated on: Mon, 29 July 2013 21:30] by Moderator

Re: Xtext 2.4.2: What is CancelationIndicator ? [message #1075763 is a reply to message #1075745] Mon, 29 July 2013 22:30 Go to previous messageGo to next message
Eclipse UserFriend
It is used to periodically check if the user (or the system) has
cancelled an operation running in the background.

Look at the source of:

org.eclipse.xtext.util.CancelIndicator

where there is a null implementation (i.e. one that always reports that
operation should not be cancelled).

Hope that helps.

- henrik

On 2013-30-07 3:29, J A wrote:
> Dear all,
>
> While reading the code of of a validator, I hit the CancelIndicator, and
> don't understand what is its purpose and how to see its effect.
>
> Can someone provide me with a hint ?
>
>
> // Initializing code, inside
> org.eclipse.xtext.validation.NamesAreUniqueValidator{}
>
> Map context = AbstractDeclarativeValidator.getContext();
> CancelIndicator cancelIndicator = (CancelIndicator)
> context.get(CancelableDiagnostician.CANCEL_INDICATOR);
> ...
>
> // Client code
> org.eclipse.xtext.validation.NamesAreUniqueValidationHelper{
>
> public void checkUniqueNames(Iterable<IEObjectDescription>
> descriptions, CancelIndicator cancelIndicator, ValidationMessageAcceptor
> acceptor)
> {
> Iterator iter = descriptions.iterator();
> if (!(iter.hasNext()))
> return;
> Map clusterToNames = Maps.newHashMap();
> while (iter.hasNext())
> {
> IEObjectDescription description = (IEObjectDescription)
> iter.next();
> checkDescriptionForDuplicatedName(description,
> clusterToNames, acceptor);
> if ((cancelIndicator != null) &&
> (cancelIndicator.isCanceled()))
> return;
> }
> }
>
> }
>
Re: Xtext 2.4.2: What is CancelationIndicator ? [message #1076311 is a reply to message #1075763] Wed, 31 July 2013 02:35 Go to previous message
Eclipse UserFriend
Thank you Henrik. JA
Previous Topic:Validation speed: only validate what is new ?
Next Topic:Getting value of parser rules during runtime
Goto Forum:
  


Current Time: Tue Jul 01 15:37:57 EDT 2025

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

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

Back to the top