org.eclipse.wst.validation.internal.provisional.core.IValidationContext Java Examples
The following examples show how to use
org.eclipse.wst.validation.internal.provisional.core.IValidationContext.
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: XmlSourceValidatorTest.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
@Test public void testNoErrorOnNonFacetedProject() throws CoreException, ValidationException { IProject project = nonFacetedProject.getProject(); assertNull("project should have not been faceted", ProjectFacetsManager.create(project)); project.getFolder("folder").create(true, true, null); project.getFile("folder/file.ext").create(new ByteArrayInputStream(new byte[0]), true, null); assertTrue(project.getFile("folder/file.ext").exists()); IValidationContext validationContext = mock(IValidationContext.class); when(validationContext.getURIs()).thenReturn( new String[] {project.getName() + "/folder/file.ext"}); new XmlSourceValidator().validate(validationContext, reporter); // Should not throw NPE and exit normally. }
Example #2
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 #3
Source File: ReconcilingStrategy.java From thym with Eclipse Public License 1.0 | 6 votes |
private ConfigEditor getConfigEditor(IValidationContext helper) { String[] path = helper.getURIs(); if (path.length == 0) return null; IFile file = ResourcesPlugin.getWorkspace().getRoot() .getFile(new Path(path[0])); if (file == null) return null; IEditorPart editor = getEditor(new FileEditorInput(file)); if (editor == null) return null; if (!(editor instanceof ConfigEditor)) return null; return (ConfigEditor) editor; }
Example #4
Source File: XmlSourceValidator.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
/** * Returns the underlying IProject from a given IValidationContext or * null if the IValidationContext does not return any files that need * to be validated. */ @VisibleForTesting static IProject getProject(IValidationContext helper) { IFile file = getFile(helper); if (file != null) { return file.getProject(); } return null; }
Example #5
Source File: XmlSourceValidator.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
/** * Returns the IFile for a given URI or null if the file does * not exist in the workspace. */ @VisibleForTesting static IFile getFile(IValidationContext helper) { String[] fileUri = helper.getURIs(); if (fileUri.length > 0) { IFile file = getFile(fileUri[0]); return file; } return null; }
Example #6
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 #7
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 #8
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 #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 validate(IValidationContext context, IReporter reporter) throws ValidationException { // It seems that it is never called? }
Example #11
Source File: TypeScriptValidator.java From typescript.java with MIT License | 4 votes |
@Override public ISchedulingRule getSchedulingRule(IValidationContext context) { return null; }
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; }