org.eclipse.xtext.ui.validation.MarkerTypeProvider Java Examples

The following examples show how to use org.eclipse.xtext.ui.validation.MarkerTypeProvider. 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: OwnResourceValidatorAwareValidatingEditorCallback.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
private ValidationJob newValidationJob(final XtextEditor editor) {

		final IXtextDocument document = editor.getDocument();
		final IAnnotationModel annotationModel = editor.getInternalSourceViewer().getAnnotationModel();

		final IssueResolutionProvider issueResolutionProvider = getService(editor, IssueResolutionProvider.class);
		final MarkerTypeProvider markerTypeProvider = getService(editor, MarkerTypeProvider.class);
		final MarkerCreator markerCreator = getService(editor, MarkerCreator.class);

		final IValidationIssueProcessor issueProcessor = new CompositeValidationIssueProcessor(
				new AnnotationIssueProcessor(document, annotationModel, issueResolutionProvider),
				new MarkerIssueProcessor(editor.getResource(), annotationModel, markerCreator, markerTypeProvider));

		return editor.getDocument().modify(resource -> {
			final IResourceServiceProvider serviceProvider = resource.getResourceServiceProvider();
			final IResourceValidator resourceValidator = serviceProvider.getResourceValidator();
			return new ValidationJob(resourceValidator, editor.getDocument(), issueProcessor, ALL);
		});
	}
 
Example #2
Source File: SCTXtextIntegrationModule.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void configure(Binder binder) {
	binder.bind(IResourceValidator.class).to(SCTResourceValidatorImpl.class);
	binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("sct");
	binder.bind(IEncodingProvider.class).to(IEncodingProvider.Runtime.class);
	binder.bind(IQualifiedNameProvider.class).to(StextNameProvider.class);
	binder.bind(org.eclipse.jface.viewers.ILabelProvider.class)
			.annotatedWith(org.eclipse.xtext.ui.resource.ResourceServiceDescriptionLabelProvider.class)
			.to(DefaultDescriptionLabelProvider.class);
	binder.bind(IDefaultResourceDescriptionStrategy.class).to(SCTResourceDescriptionStrategy.class);
	
	binder.bind(MarkerCreator.class).to(SCTMarkerCreator.class);
	binder.bind(MarkerTypeProvider.class).to(SCTMarkerTypeProvider.class);
	binder.bind(IDiagnosticConverter.class).to(SCTDiagnosticConverterImpl.class);
	binder.bind(IURIEditorOpener.class).annotatedWith(LanguageSpecific.class).to(SCTFileEditorOpener.class);
	
	binder.bind(IMarkerContributor.class).to(TaskMarkerContributor.class);
	binder.bind(ITaskFinder.class).to(DomainSpecificTaskFinder.class);
	binder.bind(TaskMarkerCreator.class).to(SCTTaskMarkerCreator.class);
	binder.bind(TaskMarkerTypeProvider.class).to(SCTTaskMarkerTypeProvider.class);
}
 
Example #3
Source File: ResourceUIValidatorExtension.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
private void createMarkers(IResource iResource, List<Issue> list, MarkerCreator markerCreator,
		MarkerTypeProvider markerTypeProvider) throws CoreException {

	for (Issue issue : list) {
		markerCreator.createMarker(issue, iResource, markerTypeProvider.getMarkerType(issue));
	}
}
 
Example #4
Source File: MarkerIssueProcessor.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @deprecated use {@link MarkerIssueProcessor#MarkerIssueProcessor(IResource, IAnnotationModel, MarkerCreator, MarkerTypeProvider)}
 *             instead.
 */
@Deprecated
public MarkerIssueProcessor(IResource resource, MarkerCreator markerCreator, MarkerTypeProvider markerTypeProvider) {
	super();
	this.resource = resource;
	this.markerCreator = markerCreator;
	this.markerTypeProvider = markerTypeProvider;
}
 
Example #5
Source File: MarkerIssueProcessor.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.14
 */
public MarkerIssueProcessor(IResource resource, IAnnotationModel annotationModel, MarkerCreator markerCreator,
		MarkerTypeProvider markerTypeProvider) {
	super();
	this.resource = resource;
	this.annotationModel = annotationModel;
	this.markerCreator = markerCreator;
	this.markerTypeProvider = markerTypeProvider;
}
 
Example #6
Source File: AddMarkersOperation.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.14
 */
public AddMarkersOperation(IResource resource, List<Issue> issues, Set<String> markerIds, boolean deleteMarkers,
		IAnnotationModel annotationModel, MarkerCreator markerCreator, MarkerTypeProvider markerTypeProvider) {
	super(ResourcesPlugin.getWorkspace().getRuleFactory().markerRule(resource));
	this.issues = issues;
	this.annotationModel = annotationModel;
	this.markerTypeProvider = markerTypeProvider;
	this.markerIds = ImmutableList.copyOf(markerIds);
	this.resource = resource;
	this.deleteMarkers = deleteMarkers;
	this.markerCreator = markerCreator;
}
 
Example #7
Source File: DerivedResourceMarkerCopier.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
private String determinateMarkerTypeByURI(SourceRelativeURI resourceURI) {
	IResourceServiceProvider serviceProvider = serviceProviderRegistry.getResourceServiceProvider(resourceURI.getURI());
	if (serviceProvider == null)
		return null;
	MarkerTypeProvider typeProvider = serviceProvider.get(MarkerTypeProvider.class);
	Issue.IssueImpl issue = new Issue.IssueImpl();
	issue.setType(CheckType.NORMAL);
	return typeProvider.getMarkerType(issue);
}
 
Example #8
Source File: ResourceUIValidatorExtension.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
private MarkerTypeProvider getMarkerTypeProvider(Resource resource) {
	return getService(resource, MarkerTypeProvider.class);
}
 
Example #9
Source File: IssueUtil.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @since 2.9
 */
protected MarkerTypeProvider getMarkerTypeProvider() {
	return markerTypeProvider;
}
 
Example #10
Source File: DefaultUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @since 2.3
 */
public Class<? extends MarkerTypeProvider> bindMarkerTypeProvider() {
	return LanguageAwareMarkerTypeProvider.class;
}
 
Example #11
Source File: MarkerIssueProcessor.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @deprecated use {@link MarkerIssueProcessor#MarkerIssueProcessor(IResource, IAnnotationModel, MarkerCreator, MarkerTypeProvider)}
 *             instead.
 */
@Deprecated
public MarkerIssueProcessor(IResource resource, MarkerCreator markerCreator) {
	this(resource, markerCreator, new MarkerTypeProvider());
}
 
Example #12
Source File: AddMarkersOperation.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @deprecated use
 *             {@link AddMarkersOperation#AddMarkersOperation(IResource, List, Set, boolean, IAnnotationModel, MarkerCreator, MarkerTypeProvider)}
 *             instead
 */
@Deprecated
public AddMarkersOperation(IResource resource, List<Issue> issues, Set<String> markerIds, boolean deleteMarkers,
		MarkerCreator markerCreator) {
	this(resource, issues, markerIds, deleteMarkers, markerCreator, new MarkerTypeProvider());
}
 
Example #13
Source File: AddMarkersOperation.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @deprecated use
 *             {@link AddMarkersOperation#AddMarkersOperation(IResource, List, Set, boolean, IAnnotationModel, MarkerCreator, MarkerTypeProvider)}
 *             instead
 */
@Deprecated
public AddMarkersOperation(IResource resource, List<Issue> issues, Set<String> markerIds, boolean deleteMarkers,
		MarkerCreator markerCreator, MarkerTypeProvider markerTypeProvider) {
	this(resource, issues, markerIds, deleteMarkers, null, markerCreator, markerTypeProvider);
}
 
Example #14
Source File: GenericEditorModule.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
public Class<? extends MarkerTypeProvider> bindMarkerTypeProvider() {
	return SCTMarkerTypeProvider.class;
}