Java Code Examples for org.eclipse.xtext.validation.CheckMode#NORMAL_AND_FAST

The following examples show how to use org.eclipse.xtext.validation.CheckMode#NORMAL_AND_FAST . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ValidatingEditorCallback.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
private ValidationJob newValidationJob(XtextEditor editor) {
	IValidationIssueProcessor issueProcessor;
	if (editor.getResource() == null) {
		issueProcessor = new AnnotationIssueProcessor(editor.getDocument(), editor.getInternalSourceViewer().getAnnotationModel(),
				issueResolutionProvider);
	} else {
		issueProcessor = new MarkerIssueProcessor(editor.getResource(), editor.getInternalSourceViewer().getAnnotationModel(),
				markerCreator, markerTypeProvider);
	}
	ValidationJob validationJob = new ValidationJob(resourceValidator, editor.getDocument(), issueProcessor, CheckMode.NORMAL_AND_FAST);
	return validationJob;
}
 
Example 2
Source File: ErrorToDiagnoticTranslator.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
private CheckType getType(final CheckMode mode) {
	if (mode == CheckMode.FAST_ONLY) {
		return CheckType.FAST;
	} else if (mode == CheckMode.EXPENSIVE_ONLY) {
		return CheckType.EXPENSIVE;
	} else if (mode == CheckMode.ALL) {
		return CheckType.FAST;
	} else if (mode == CheckMode.NORMAL_AND_FAST) {
		return CheckType.FAST;
	} else if (mode == CheckMode.NORMAL_ONLY) {
		return CheckType.NORMAL;
	} else {
		return CheckType.FAST;
	}
}
 
Example 3
Source File: CompilationTestHelper.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @since 2.8
 */
protected CheckMode getCheckMode() {
	return CheckMode.NORMAL_AND_FAST;
}
 
Example 4
Source File: MarkerUpdaterImpl.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
private void processDelta(Delta delta, /* @Nullable */ ResourceSet resourceSet, IProgressMonitor monitor) throws OperationCanceledException {
	URI uri = delta.getUri();
	IResourceUIValidatorExtension validatorExtension = getResourceUIValidatorExtension(uri);
	IMarkerContributor markerContributor = getMarkerContributor(uri);
	CheckMode normalAndFastMode = CheckMode.NORMAL_AND_FAST;

	for (Pair<IStorage, IProject> pair : mapper.getStorages(uri)) {
		if (monitor.isCanceled()) {
			throw new OperationCanceledException();
		}
		if (pair.getFirst() instanceof IFile) {
			IFile file = (IFile) pair.getFirst();
			
			if (EXTERNAL_PROJECT_NAME.equals(file.getProject().getName())) {
				// if the file is found via the source attachment of a classpath entry, which happens
				//  in case of running a test IDE with bundles from the workspace of the development IDE
				//  (the workspace bundles' bin folder is linked to the classpath of bundles in the test IDE),
				// skip the marker processing of that file, as the user can't react on any markers anyway.
				continue;
			}
			
			if (delta.getNew() != null) {
				if (resourceSet == null)
					throw new IllegalArgumentException("resourceSet may not be null for changed resources.");
				
				Resource resource = resourceSet.getResource(uri, true);
				if (validatorExtension != null) {
					validatorExtension.updateValidationMarkers(file, resource, normalAndFastMode, monitor);
				}
				if (markerContributor != null) {
					markerContributor.updateMarkers(file, resource, monitor);
				}
			} else {
				if (validatorExtension != null) {
					validatorExtension.deleteValidationMarkers(file, normalAndFastMode, monitor);
				} else {
					deleteAllValidationMarker(file, normalAndFastMode, monitor);
				}	
				if (markerContributor != null) {
					markerContributor.deleteMarkers(file, monitor);
				} else {
					deleteAllContributedMarkers(file, monitor);
				}
			}
		}
	}
}
 
Example 5
Source File: CompilationTestHelper.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @since 2.8
 */
protected CheckMode getCheckMode() {
	return CheckMode.NORMAL_AND_FAST;
}
 
Example 6
Source File: GamlMarkerUpdater.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void updateMarkers(final Delta delta, final ResourceSet resourceSet, final IProgressMonitor monitor)
		throws OperationCanceledException {

	final URI uri = delta.getUri();
	final IResourceUIValidatorExtension validatorExtension = getResourceUIValidatorExtension(uri);
	final IMarkerContributor markerContributor = getMarkerContributor(uri);
	final CheckMode normalAndFastMode = CheckMode.NORMAL_AND_FAST;

	for (final Pair<IStorage, IProject> pair : mapper.getStorages(uri)) {
		if (monitor.isCanceled()) { throw new OperationCanceledException(); }
		if (pair.getFirst() instanceof IFile) {
			final IFile file = (IFile) pair.getFirst();

			if (delta.getNew() != null) {
				if (resourceSet == null) { throw new IllegalArgumentException(
						"resourceSet may not be null for changed resources."); }

				final Resource resource = resourceSet.getResource(uri, true);

				if (validatorExtension != null) {
					validatorExtension.updateValidationMarkers(file, resource, normalAndFastMode, monitor);
				}
				if (markerContributor != null) {
					markerContributor.updateMarkers(file, resource, monitor);
				}
				// GAMA.getGui().getMetaDataProvider().storeMetadata(file,
				// info.getInfo(resource, file.getModificationStamp()),
				// true);
			} else {
				if (validatorExtension != null) {
					validatorExtension.deleteValidationMarkers(file, normalAndFastMode, monitor);
				} else {
					deleteAllValidationMarker(file, normalAndFastMode, monitor);
				}
				if (markerContributor != null) {
					markerContributor.deleteMarkers(file, monitor);
				} else {
					deleteAllContributedMarkers(file, monitor);
				}
			}
		}
	}

}
 
Example 7
Source File: ValidMarkerUpdateJob.java    From dsl-devkit with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Instantiates a new valid marker update job.
 *
 * @param name
 *          the name
 * @param fileExtensions
 *          the file extensions
 * @param resourceSet
 *          the resource set
 * @param markerCreator
 *          the marker creator
 * @param resourceDescriptions
 *          the resource descriptions
 * @param resourceServiceProvider
 *          the resource service provider
 * @param performExpensiveValidation
 *          true if expensive validation should be performed, false otherwise
 */
public ValidMarkerUpdateJob(final String name, final String fileExtensions, final ResourceSet resourceSet, final MarkerCreator markerCreator, final IResourceDescriptions resourceDescriptions, final IResourceServiceProvider resourceServiceProvider, final boolean performExpensiveValidation, final IStorage2UriMapper storage2UriMapper) {
  super(name + " " + fileExtensions); //$NON-NLS-1$

  this.fileExtensions = fileExtensions;
  this.resourceSet = resourceSet;
  this.markerCreator = markerCreator;
  this.resourceDescriptions = resourceDescriptions;
  this.resourceServiceProvider = resourceServiceProvider;
  this.performExpensiveValidation = performExpensiveValidation;
  this.checkMode = performExpensiveValidation ? CheckMode.ALL : CheckMode.NORMAL_AND_FAST;
  this.storage2UriMapper = storage2UriMapper;
}