本文整理汇总了Java中org.eclipse.wst.validation.internal.core.ValidationException类的典型用法代码示例。如果您正苦于以下问题:Java ValidationException类的具体用法?Java ValidationException怎么用?Java ValidationException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ValidationException类属于org.eclipse.wst.validation.internal.core包,在下文中一共展示了ValidationException类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testValidate_appEngineStandardFacet
import org.eclipse.wst.validation.internal.core.ValidationException; //导入依赖的package包/类
@Test
public void testValidate_appEngineStandardFacet() throws CoreException, ValidationException {
IProject project = appEngineStandardProject.getProject();
IFile file = project.getFile("testdata.xml");
file.create(ValidationTestUtils.stringToInputStream(APPLICATION_XML), 0, null);
IDocument document = ValidationTestUtils.getDocument(file);
// Adds the URI of the file to be validated to the IncrementalHelper.
IncrementalHelper helper = new IncrementalHelper(document, project);
IPath path = file.getFullPath();
helper.setURI(path.toString());
XmlSourceValidator validator = new XmlSourceValidator();
validator.setHelper(new AppEngineWebXmlValidator());
validator.connect(document);
validator.validate(helper, reporter);
assertEquals(1, reporter.getMessages().size());
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:20,代码来源:XmlSourceValidatorTest.java
示例2: testValidate_dynamicWebProject
import org.eclipse.wst.validation.internal.core.ValidationException; //导入依赖的package包/类
@Test
public void testValidate_dynamicWebProject() throws CoreException, ValidationException {
IProject project = dynamicWebProject.getProject();
IFile file = project.getFile("testdata.xml");
file.create(ValidationTestUtils.stringToInputStream(APPLICATION_XML), 0, null);
IDocument document = ValidationTestUtils.getDocument(file);
// Adds the URI of the file to be validated to the IncrementalHelper.
IncrementalHelper helper = new IncrementalHelper(document, project);
IPath path = file.getFullPath();
helper.setURI(path.toString());
XmlSourceValidator validator = new XmlSourceValidator();
validator.setHelper(new AppEngineWebXmlValidator());
validator.connect(document);
validator.validate(helper, reporter);
assertTrue(reporter.getMessages().isEmpty());
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:20,代码来源:XmlSourceValidatorTest.java
示例3: validate
import org.eclipse.wst.validation.internal.core.ValidationException; //导入依赖的package包/类
/**
* 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 (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());
}
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:19,代码来源:XmlSourceValidator.java
示例4: validate
import org.eclipse.wst.validation.internal.core.ValidationException; //导入依赖的package包/类
@Override
public void validate(IValidationContext helper, IReporter reporter)
throws ValidationException {
final String[] uris = helper.getURIs();
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
if (uris.length > 0) {
IFile currentFile = null;
for (int i = 0; i < uris.length && !reporter.isCancelled(); i++) {
// might be called with just project path?
IPath path = new Path(uris[i]);
if (path.segmentCount() > 1) {
currentFile = root.getFile(path);
if (shouldValidate(currentFile, true)) {
validateFile(currentFile, reporter);
}
} else if (uris.length == 1) {
validateProject(helper, reporter);
}
}
} else
validateProject(helper, reporter);
}
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:24,代码来源:JSONSyntaxValidator.java
示例5: validate
import org.eclipse.wst.validation.internal.core.ValidationException; //导入依赖的package包/类
@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);
}
}
开发者ID:angelozerr,项目名称:typescript.java,代码行数:30,代码来源:TypeScriptSourceValidator.java
示例6: validateInJob
import org.eclipse.wst.validation.internal.core.ValidationException; //导入依赖的package包/类
@Override
public IStatus validateInJob(IValidationContext helper, IReporter reporter)
throws ValidationException {
// Exception catching was removed, see
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=123600
IStatus status = Status.OK_STATUS;
validate(helper, reporter);
return status;
}
开发者ID:angelozerr,项目名称:eclipse-wtp-webresources,代码行数:10,代码来源:WebResourcesValidator.java
示例7: validate
import org.eclipse.wst.validation.internal.core.ValidationException; //导入依赖的package包/类
@Override
public void validate(IValidationContext helper, IReporter reporter) throws ValidationException {
// Remove any old validation errors
reporter.removeAllMessages(this);
// TODO: Use DOM model for isConcordionSpec
if (rootElementParser.isConcordionSpec(document)) {
IDOMModel domModel = EclipseUtils.domModelForDocument(document);
if (domModel != null) {
doParseSpec(domModel, reporter, rootElementParser.getNamespacePrefix());
}
}
}
开发者ID:sunix,项目名称:org.concordion.ide.eclipse,代码行数:13,代码来源:ConcordionValidator.java
示例8: validate
import org.eclipse.wst.validation.internal.core.ValidationException; //导入依赖的package包/类
@Override
public void validate(IValidationContext context, IReporter reporter) throws ValidationException {
// It seems that it is never called?
}
开发者ID:angelozerr,项目名称:typescript.java,代码行数:5,代码来源:TypeScriptValidator.java
示例9: validateInJob
import org.eclipse.wst.validation.internal.core.ValidationException; //导入依赖的package包/类
@Override
public IStatus validateInJob(IValidationContext helper, IReporter reporter) throws ValidationException {
IStatus status = Status.OK_STATUS;
validate(helper, reporter);
return status;
}
开发者ID:angelozerr,项目名称:typescript.java,代码行数:7,代码来源:TypeScriptValidator.java
示例10: validate
import org.eclipse.wst.validation.internal.core.ValidationException; //导入依赖的package包/类
/**
* Calls a delegate validator getting and updates it's list of
* ValidationMessages with a good squiggle offset and length.
*
* @param helper
* loads an object.
* @param reporter
* Is an instance of an IReporter interface, which is used for
* interaction with the user.
*/
public void validate(IValidationContext helper, IReporter reporter) throws ValidationException {
String[] delta = helper.getURIs();
if (delta.length > 0) {
// get the file, model and document:
IFile file = getFile(delta[0]);
IJSONModel jsonModel = null;
if (file != null)
jsonModel = getModelForResource(file);
// some problem occurred, abort
if (jsonModel == null)
return;
try {
IJSONDocument document = jsonModel.getDocument();
// store the text in a byte array; make a full copy to ease
// any threading problems
byte[] byteArray;
try {
byteArray = jsonModel.getStructuredDocument().get().getBytes("UTF-8");
}
catch (UnsupportedEncodingException e) {
// Not likely to happen
byteArray = jsonModel.getStructuredDocument().get().getBytes();
}
if (isDelegateValidatorEnabled(file)) {
IValidator validator = getDelegateValidator();
if (validator != null) {
// Validate the file:
IValidationContext vHelper = new MyHelper(new ByteArrayInputStream(byteArray), file);
MyReporter vReporter = new MyReporter();
if (validator instanceof IValidatorJob) {
((IValidatorJob) validator).validateInJob(vHelper, vReporter);
}
else {
validator.validate(vHelper, vReporter);
}
List messages = vReporter.list;
// set the offset and length
updateValidationMessages(messages, document, reporter);
}
}
}
finally {
if (jsonModel != null) {
jsonModel.releaseFromRead();
}
}
}
}
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:65,代码来源:DelegatingSourceValidator.java
示例11: validate
import org.eclipse.wst.validation.internal.core.ValidationException; //导入依赖的package包/类
@Override
public void validate(IValidationContext context, IReporter reporter)
throws ValidationException {
validateInJob(context, reporter);
}
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:6,代码来源:AbstractNestedValidator.java
示例12: validate
import org.eclipse.wst.validation.internal.core.ValidationException; //导入依赖的package包/类
@Override
public void validate(IValidationContext helper, IReporter reporter)
throws ValidationException {
validator.validate(helper, reporter);
removeApexValidationErrors(reporter);
}
开发者ID:forcedotcom,项目名称:idecore,代码行数:7,代码来源:PageValidator.java
注:本文中的org.eclipse.wst.validation.internal.core.ValidationException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论