Search in sources :

Example 1 with MarkerTypeProvider

use of org.eclipse.xtext.ui.validation.MarkerTypeProvider in project xtext-eclipse by eclipse.

the class DerivedResourceMarkerCopier method determinateMarkerTypeByURI.

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);
}
Also used : MarkerTypeProvider(org.eclipse.xtext.ui.validation.MarkerTypeProvider) IResourceServiceProvider(org.eclipse.xtext.resource.IResourceServiceProvider) Issue(org.eclipse.xtext.validation.Issue)

Example 2 with MarkerTypeProvider

use of org.eclipse.xtext.ui.validation.MarkerTypeProvider in project n4js by eclipse.

the class OwnResourceValidatorAwareValidatingEditorCallback method newValidationJob.

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(), 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);
    });
}
Also used : IValidationIssueProcessor(org.eclipse.xtext.ui.editor.validation.IValidationIssueProcessor) MarkerTypeProvider(org.eclipse.xtext.ui.validation.MarkerTypeProvider) IResourceServiceProvider(org.eclipse.xtext.resource.IResourceServiceProvider) IssueResolutionProvider(org.eclipse.xtext.ui.editor.quickfix.IssueResolutionProvider) IResourceValidator(org.eclipse.xtext.validation.IResourceValidator) IAnnotationModel(org.eclipse.jface.text.source.IAnnotationModel) MarkerCreator(org.eclipse.xtext.ui.editor.validation.MarkerCreator) MarkerIssueProcessor(org.eclipse.xtext.ui.editor.validation.MarkerIssueProcessor) IXtextDocument(org.eclipse.xtext.ui.editor.model.IXtextDocument) AnnotationIssueProcessor(org.eclipse.xtext.ui.editor.validation.AnnotationIssueProcessor) ValidationJob(org.eclipse.xtext.ui.editor.validation.ValidationJob)

Aggregations

IResourceServiceProvider (org.eclipse.xtext.resource.IResourceServiceProvider)2 MarkerTypeProvider (org.eclipse.xtext.ui.validation.MarkerTypeProvider)2 IAnnotationModel (org.eclipse.jface.text.source.IAnnotationModel)1 IXtextDocument (org.eclipse.xtext.ui.editor.model.IXtextDocument)1 IssueResolutionProvider (org.eclipse.xtext.ui.editor.quickfix.IssueResolutionProvider)1 AnnotationIssueProcessor (org.eclipse.xtext.ui.editor.validation.AnnotationIssueProcessor)1 IValidationIssueProcessor (org.eclipse.xtext.ui.editor.validation.IValidationIssueProcessor)1 MarkerCreator (org.eclipse.xtext.ui.editor.validation.MarkerCreator)1 MarkerIssueProcessor (org.eclipse.xtext.ui.editor.validation.MarkerIssueProcessor)1 ValidationJob (org.eclipse.xtext.ui.editor.validation.ValidationJob)1 IResourceValidator (org.eclipse.xtext.validation.IResourceValidator)1 Issue (org.eclipse.xtext.validation.Issue)1