org.eclipse.wst.validation.internal.provisional.core.IReporter Java Examples
The following examples show how to use
org.eclipse.wst.validation.internal.provisional.core.IReporter.
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: XmlSourceValidator.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
/** * Validates a given {@link IDocument} if the project has the App Engine Standard facet. */ @Override public void validate(IValidationContext helper, IReporter reporter) throws ValidationException { IProject project = getProject(helper); try { IFacetedProject facetedProject = ProjectFacetsManager.create(project); if (facetedProject != null && AppEngineStandardFacet.hasFacet(facetedProject)) { String encoding = getDocumentEncoding(document); byte[] bytes = document.get().getBytes(encoding); IFile source = getFile(helper); validate(reporter, source, bytes); } } catch (IOException | CoreException ex) { logger.log(Level.SEVERE, ex.getMessage()); } }
Example #2
Source File: XmlSourceValidator.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
/** * Adds an {@link IMessage} to the XML file for every * {@link ElementProblem} found in the file. */ @VisibleForTesting void validate(IReporter reporter, IFile source, byte[] bytes) throws IOException { try { Document document = PositionalXmlScanner.parse(bytes); if (document != null) { List<ElementProblem> problems = helper.checkForProblems(source, document); String encoding = (String) document.getDocumentElement().getUserData("encoding"); Map<ElementProblem, Integer> problemOffsetMap = ValidationUtils.getOffsetMap(bytes, problems, encoding); for (Map.Entry<ElementProblem, Integer> entry : problemOffsetMap.entrySet()) { createMessage(reporter, entry.getKey(), entry.getValue()); } } } catch (SAXException ex) { // Do nothing // Default Eclipse parser flags syntax errors } }
Example #3
Source File: TypeScriptValidationHelper.java From typescript.java with MIT License | 6 votes |
public static void validate(IIDETypeScriptFile tsFile, IReporter reporter, IValidator validator) { try { IIDETypeScriptProject tsProject = (IIDETypeScriptProject) tsFile.getProject(); TypeScriptReporterCollector collector = new TypeScriptReporterCollector(tsFile, reporter, validator); if (tsProject.canSupport(CommandNames.SemanticDiagnosticsSync)) { boolean includeLinePosition = !tsProject.canSupport(CommandCapability.DiagnosticWithCategory); addDiagnostics(tsFile.semanticDiagnosticsSync(includeLinePosition), collector); addDiagnostics(tsFile.syntacticDiagnosticsSync(includeLinePosition), collector); } else { List<DiagnosticEvent> events = tsFile.geterr().get(5000, TimeUnit.MILLISECONDS); for (DiagnosticEvent event : events) { addDiagnostics(event.getBody(), collector); } } } catch (Throwable e) { Trace.trace(Trace.SEVERE, "Error while TypeScript validation.", e); } }
Example #4
Source File: XmlSourceValidator.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
/** * Creates a message from a given {@link ElementProblem}. */ @VisibleForTesting void createMessage(IReporter reporter, ElementProblem problem, int offset) { IMessage message = new LocalizedMessage(problem.getIMessageSeverity(), problem.getMessage()); message.setTargetObject(this); message.setMarkerId(problem.getMarkerId()); // TODO offset by line int lineNumber = problem.getStart().getLineNumber() + 1; message.setLineNo(lineNumber); message.setOffset(offset); message.setLength(problem.getLength()); message.setAttribute(IQuickAssistProcessor.class.getName(), problem.getQuickAssistProcessor()); reporter.addMessage(this, message); }
Example #5
Source File: TypeScriptSourceValidator.java From typescript.java with MIT License | 5 votes |
@Override public void validate(IValidationContext helper, IReporter reporter) throws ValidationException { if (helper == null || document == null) { return; } if ((reporter != null) && (reporter.isCancelled() == true)) { throw new OperationCanceledException(); } // we cannot use helper#getURI() to retrieve the IFile which is // validating, because // this helper is filled by using IStructuredModel (see // ReconcileStepForValidator#getFile()) // and JSDT JavaScript Editor doesn't manage IStructuredModel IFile file = TypeScriptResourceUtil.getFile(document); if (file == null || !TypeScriptResourceUtil.canConsumeTsserver(file)) { return; } try { IIDETypeScriptProject tsProject = TypeScriptResourceUtil.getTypeScriptProject(file.getProject()); IIDETypeScriptFile tsFile = tsProject.openFile(file, document); TypeScriptValidationHelper.validate(tsFile, reporter, this); } catch (Exception e) { Trace.trace(Trace.SEVERE, "Error while TypeScript validation.", e); } }
Example #6
Source File: TypeScriptSourceValidator.java From typescript.java with MIT License | 5 votes |
@Override public void validate(IRegion dirtyRegion, IValidationContext helper, IReporter reporter) { // Never called, because TypeScriptSourceValidator is declared as // "total" (and // not "partial") in the plugin.xml // "org.eclipse.wst.sse.ui.sourcevalidation" extension point. }
Example #7
Source File: ReconcilingStrategy.java From thym with Eclipse Public License 1.0 | 5 votes |
@Override public void validate(IValidationContext helper, IReporter reporter) { ConfigEditor editor = getConfigEditor(helper); if (editor == null) return; editor.getWidgetModel().reloadEditableWidget(); }
Example #8
Source File: XmlSourceValidator.java From google-cloud-eclipse with Apache License 2.0 | 4 votes |
@Override public void cleanup(IReporter reporter) { }
Example #9
Source File: XmlSourceValidator.java From google-cloud-eclipse with Apache License 2.0 | 4 votes |
@Override public void validate(IRegion dirtyRegion, IValidationContext helper, IReporter reporter) { }
Example #10
Source File: TypeScriptValidator.java From typescript.java with MIT License | 4 votes |
@Override public void cleanup(IReporter reporter) { // do nothing }
Example #11
Source File: TypeScriptValidator.java From typescript.java with MIT License | 4 votes |
@Override public void validate(IValidationContext context, IReporter reporter) throws ValidationException { // It seems that it is never called? }
Example #12
Source File: TypeScriptValidator.java From typescript.java with MIT License | 4 votes |
@Override public IStatus validateInJob(IValidationContext helper, IReporter reporter) throws ValidationException { IStatus status = Status.OK_STATUS; validate(helper, reporter); return status; }
Example #13
Source File: TypeScriptReporterCollector.java From typescript.java with MIT License | 4 votes |
public TypeScriptReporterCollector(IIDETypeScriptFile tsFile, IReporter reporter, IValidator validator) { // this.tsProject = tsProject; this.tsFile = tsFile; this.reporter = reporter; this.validator = validator; }
Example #14
Source File: TypeScriptSourceValidator.java From typescript.java with MIT License | 4 votes |
@Override public void cleanup(IReporter reporter) { // don't need to implement }
Example #15
Source File: ReporterMessagePlacementStrategy.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 4 votes |
public ReporterMessagePlacementStrategy(IValidator validator, IReporter reporter) { this.validator = validator; this.reporter = reporter; }
Example #16
Source File: ReconcilingStrategy.java From thym with Eclipse Public License 1.0 | 4 votes |
@Override public void cleanup(IReporter reporter) { }