• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ValidationState类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.wst.validation.ValidationState的典型用法代码示例。如果您正苦于以下问题:Java ValidationState类的具体用法?Java ValidationState怎么用?Java ValidationState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ValidationState类属于org.eclipse.wst.validation包,在下文中一共展示了ValidationState类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: validate

import org.eclipse.wst.validation.ValidationState; //导入依赖的package包/类
private List validate(String html) throws CoreException {
	IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("test");
	if (!project.exists()) {
		project.create(new NullProgressMonitor());
		project.open(new NullProgressMonitor());
	}
	// Add tsconfig.json in order to the project has angular nature
	IFile tsconfigJson = project.getFile("tsconfig.json");
	if (!tsconfigJson.exists()) {
		tsconfigJson.create(IOUtils.toInputStream("{}"), 1, new NullProgressMonitor());
	}
	IFile file = project.getFile("test.html");
	if (file.exists()) {
		file.setContents(IOUtils.toInputStream(html), 1, new NullProgressMonitor());
	} else {
		file.create(IOUtils.toInputStream(html), 1, new NullProgressMonitor());
	}

	HTMLValidator validator = new HTMLValidator();
	ValidationResult result = validator.validate(file, 1, new ValidationState(), new NullProgressMonitor());
	IReporter reporter = result.getReporter(new NullProgressMonitor());
	return reporter.getMessages();

}
 
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:25,代码来源:HTMLAngularValidatorTest.java


示例2: validate

import org.eclipse.wst.validation.ValidationState; //导入依赖的package包/类
@Override
public ValidationResult validate(IResource resource, int kind,
		ValidationState state, IProgressMonitor monitor) {
	IDocument document = null;
	// get document
	try {
		final IDocumentProvider provider = new TextFileDocumentProvider();
		provider.connect(resource);
		document = provider.getDocument(resource);
		provider.disconnect(resource);
	} catch (CoreException e) {
		e.printStackTrace();
	}

	ValidationResult result = new ValidationResult();
	if (document != null) {
		// validate definitions names
		List<ElementRegion> definitionNameRegions = tilesXmlParser
				.getDefinitionNameRegions(document);
		validateRegions(resource, document, result, definitionNameRegions,
				DUP_DEFINITION_MESSAGE_TEXT, IMarker.SEVERITY_WARNING);
	}

	return result;
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:26,代码来源:TilesXmlValidator.java


示例3: validate

import org.eclipse.wst.validation.ValidationState; //导入依赖的package包/类
/**
 * Extracts byte[] from XML.
 */
@Override
public ValidationResult validate(ValidationEvent event, ValidationState state,
    IProgressMonitor monitor) {
  IFile file = (IFile) event.getResource();
  try (InputStream in = file.getContents()) {
      byte[] bytes = ByteStreams.toByteArray(in);
      validate(file, bytes);
  } catch (IOException | CoreException ex) {
    logger.log(Level.SEVERE, ex.getMessage());
  }
  return new ValidationResult();
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:16,代码来源:XmlValidator.java


示例4: validationStarting

import org.eclipse.wst.validation.ValidationState; //导入依赖的package包/类
@Override
public void validationStarting(IProject project, ValidationState state, IProgressMonitor monitor) {
	if (project != null && TypeScriptResourceUtil.isTypeScriptProject(project)) {
		startTime = System.currentTimeMillis();
		try {
			IIDETypeScriptProject tsProject = TypeScriptResourceUtil.getTypeScriptProject(project, false);
			state.put(TYPESCRIPT_VALIDATOR_CONTEXT, tsProject);
			super.validationStarting(project, state, monitor);
		} catch (CoreException e) {
			Trace.trace(Trace.SEVERE, "Error while TypeScript start validation.", e);
		}
	}
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:14,代码来源:TypeScriptValidator.java


示例5: validationFinishing

import org.eclipse.wst.validation.ValidationState; //导入依赖的package包/类
@Override
public void validationFinishing(IProject project, ValidationState state, IProgressMonitor monitor) {
	if (project != null && TypeScriptResourceUtil.isTypeScriptProject(project)) {
		super.validationFinishing(project, state, monitor);
		state.put(TYPESCRIPT_VALIDATOR_CONTEXT, null);
		System.err.println("Validated in " + (System.currentTimeMillis() - startTime) + "ms");
	}
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:9,代码来源:TypeScriptValidator.java


示例6: validate

import org.eclipse.wst.validation.ValidationState; //导入依赖的package包/类
@Override
public ValidationResult validate(IResource resource, int kind,
		ValidationState state, IProgressMonitor monitor) {
	if (resource.getType() != IResource.FILE)
		return null;
	ValidationResult result = new ValidationResult();
	IReporter reporter = result.getReporter(monitor);
	try {
		validateDockerFile((IFile) resource, reporter, result);
	} catch (CoreException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return result;
}
 
开发者ID:osswangxining,项目名称:dockerfoundry,代码行数:16,代码来源:DockerfileValidator.java


示例7: getNestedContext

import org.eclipse.wst.validation.ValidationState; //导入依赖的package包/类
/**
 * Get the nested validation context.
 * 
 * @param state
 *            the validation state.
 * @param create
 *            when true, a new context will be created if one is not found
 * @return the nested validation context.
 */
@Override
protected NestedValidatorContext getNestedContext(ValidationState state,
		boolean create) {
	NestedValidatorContext context = null;
	Object o = state.get(JSON_VALIDATOR_CONTEXT);
	if (o instanceof JSONNestedValidatorContext)
		context = (JSONNestedValidatorContext) o;
	else if (create) {
		context = new JSONNestedValidatorContext();
	}
	return context;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:22,代码来源:Validator.java


示例8: validationStarting

import org.eclipse.wst.validation.ValidationState; //导入依赖的package包/类
@Override
public void validationStarting(IProject project, ValidationState state,
		IProgressMonitor monitor) {
	if (project != null) {
		NestedValidatorContext context = getNestedContext(state, false);
		if (context == null) {
			context = getNestedContext(state, true);
			if (context != null)
				context.setProject(project);
			setupValidation(context);
			state.put(JSON_VALIDATOR_CONTEXT, context);
		}
		super.validationStarting(project, state, monitor);
	}
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:16,代码来源:Validator.java


示例9: validationFinishing

import org.eclipse.wst.validation.ValidationState; //导入依赖的package包/类
@Override
public void validationFinishing(IProject project, ValidationState state,
		IProgressMonitor monitor) {
	if (project != null) {
		super.validationFinishing(project, state, monitor);
		NestedValidatorContext context = getNestedContext(state, false);
		if (context != null) {
			teardownValidation(context);
			state.put(JSON_VALIDATOR_CONTEXT, null);
		}
	}
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:13,代码来源:Validator.java


示例10: validate

import org.eclipse.wst.validation.ValidationState; //导入依赖的package包/类
public ValidationResult validate(IResource resource, int kind,
		ValidationState state, IProgressMonitor monitor) {
	if (resource.getType() != IResource.FILE)
		return null;
	ValidationResult result = new ValidationResult();
	fReporter = result.getReporter(monitor);
	validateFile((IFile) resource, fReporter);
	return result;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:10,代码来源:JSONSyntaxValidator.java


示例11: validate

import org.eclipse.wst.validation.ValidationState; //导入依赖的package包/类
/**
 * Perform the validation using version 2 of the validation framework.
 */
@Override
public ValidationResult validate(IResource resource, int kind,
		ValidationState state, IProgressMonitor monitor) {
	ValidationResult result = new ValidationResult();
	IFile file = null;
	if (resource instanceof IFile)
		file = (IFile) resource;
	if (file != null && shouldValidate(file)) {
		IReporter reporter = result.getReporter(monitor);

		NestedValidatorContext nestedcontext = getNestedContext(state,
				false);
		boolean teardownRequired = false;
		if (nestedcontext == null) {
			// validationstart was not called, so manually setup and tear
			// down
			nestedcontext = getNestedContext(state, true);
			nestedcontext.setProject(file.getProject());
			setupValidation(nestedcontext);
			teardownRequired = true;
		} else {
			nestedcontext.setProject(file.getProject());
		}
		validate(file, null, result, reporter, nestedcontext);

		if (teardownRequired)
			teardownValidation(nestedcontext);
	}
	return result;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:34,代码来源:AbstractNestedValidator.java


示例12: validate

import org.eclipse.wst.validation.ValidationState; //导入依赖的package包/类
@Override
public ValidationResult validate(final IResource resource, int kind, ValidationState state,
	IProgressMonitor monitor)
{
	if (resource.getType() != IResource.FILE)
		return null;
	ValidationResult result = new ValidationResult();
	final IReporter reporter = result.getReporter(monitor);
	validateFile((IFile)resource, reporter, result);
	return result;
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:12,代码来源:XmlValidator.java


示例13: validate

import org.eclipse.wst.validation.ValidationState; //导入依赖的package包/类
@Override
public ValidationResult validate(IResource resource, int kind,
		ValidationState state, IProgressMonitor monitor) {
	if (resource.getType() != IResource.FILE)
		return null;
	ValidationResult result = new ValidationResult();
	IReporter reporter = result.getReporter(monitor);
	validateFile(null, reporter, (IFile) resource, result);
	return result;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-webresources,代码行数:11,代码来源:WebResourcesValidator.java


示例14: getNestedContext

import org.eclipse.wst.validation.ValidationState; //导入依赖的package包/类
/**
 * Get the nested validation context.
 * 
 * @param state
 *            the validation state.
 * @param create
 *            when true, a new context will be created if one is not found
 * @return the nested validation context.
 */
protected NestedValidatorContext getNestedContext(ValidationState state,
		boolean create) {
	NestedValidatorContext context = null;
	if (create) {
		context = new NestedValidatorContext();
	}
	return context;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:18,代码来源:AbstractNestedValidator.java



注:本文中的org.eclipse.wst.validation.ValidationState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java App类代码示例发布时间:2022-05-23
下一篇:
Java UCSReader类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap