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); }); }
@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); }
private void createMarkers(IFile file, List<Issue> list, MarkerCreator markerCreator, MarkerTypeProvider markerTypeProvider) throws CoreException { for (Issue issue : list) { markerCreator.createMarker(issue, file, markerTypeProvider.getMarkerType(issue)); } }
/** * @since 2.3 */ public MarkerIssueProcessor(IResource resource, MarkerCreator markerCreator, MarkerTypeProvider markerTypeProvider) { super(); this.resource = resource; this.markerCreator = markerCreator; this.markerTypeProvider = markerTypeProvider; }
/** * @since 2.3 */ public AddMarkersOperation(IResource resource, List<Issue> issues, Set<String> markerIds, boolean deleteMarkers, MarkerCreator markerCreator, MarkerTypeProvider markerTypeProvider) { super(ResourcesPlugin.getWorkspace().getRuleFactory().markerRule(resource)); this.issues = issues; this.markerTypeProvider = markerTypeProvider; this.markerIds = ImmutableList.copyOf(markerIds); this.resource = resource; this.deleteMarkers = deleteMarkers; this.markerCreator = markerCreator; }
private MarkerTypeProvider getMarkerTypeProvider(Resource resource) { return getService(resource, MarkerTypeProvider.class); }
/** * @since 2.3 */ public Class<? extends MarkerTypeProvider> bindMarkerTypeProvider() { return LanguageAwareMarkerTypeProvider.class; }
/** * @deprecated use {@link MarkerIssueProcessor#MarkerIssueProcessor(IResource, MarkerCreator, MarkerTypeProvider) instead.} */ @Deprecated public MarkerIssueProcessor(IResource resource, MarkerCreator markerCreator) { this(resource, markerCreator, new MarkerTypeProvider()); }
/** * @deprecated use {@link AddMarkersOperation#AddMarkersOperation(IResource, List, Set, boolean, 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()); }
public Class<? extends MarkerTypeProvider> bindMarkerTypeProvider() { return SCTMarkerTypeProvider.class; }