当前位置: 首页>>代码示例>>Java>>正文


Java Diagnostic.getMessage方法代码示例

本文整理汇总了Java中org.eclipse.emf.ecore.resource.Resource.Diagnostic.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java Diagnostic.getMessage方法的具体用法?Java Diagnostic.getMessage怎么用?Java Diagnostic.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.emf.ecore.resource.Resource.Diagnostic的用法示例。


在下文中一共展示了Diagnostic.getMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testLoadingBuiltInTypes

import org.eclipse.emf.ecore.resource.Resource.Diagnostic; //导入方法依赖的package包/类
@SuppressWarnings("javadoc")
@Test
public void testLoadingBuiltInTypes() {
	BuiltInTypeScope scope = BuiltInTypeScope.get(resourceSet);
	IEObjectDescription anyType = scope.getSingleElement(QualifiedName.create("any"));
	Assert.assertNotNull(anyType);
	String s = "";
	for (Resource resource : resourceSet.getResources()) {
		if (resource.getErrors().size() > 0) {
			for (Diagnostic d : resource.getErrors()) {
				s += "\n  " + d.getMessage() + " at " + resource.getURI() + ":" + d.getLine();
			}
		}
	}

	Assert.assertEquals("Resources definine built-in types must have no error."
			, "", s);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:BuiltInTypeScopeTest.java

示例2: showErrors

import org.eclipse.emf.ecore.resource.Resource.Diagnostic; //导入方法依赖的package包/类
public void showErrors(XtextResource resource) {
	String error = "";
    if (! resource.getErrors().isEmpty()) {
        error += "### Parse: \n";
        for (Diagnostic d : resource.getErrors()) {
            error += d.getMessage() + " in " + d.getLine()  + "\n";
            
        }
    }
    if ( error.length() == 0 ) {
    	System.out.println("Ok : " + resource.getContents());
    } else {
    	System.out.println(error);
    }
    
}
 
开发者ID:jesusc,项目名称:eclectic,代码行数:17,代码来源:ParseApiDesc.java

示例3: checkErrorAndGetErrorList

import org.eclipse.emf.ecore.resource.Resource.Diagnostic; //导入方法依赖的package包/类
/**
 * To detect if there is error in SysML file, and return a error list
 * 
 * @param file
 *            file is the SysML which is going to test
 * @param resourceSet
 *            resourceSet is the EMF resourceSet
 * @return errorList errorList: a list of errors
 * @throws IOException
 * @throws ParserConfigurationException
 * @throws SAXException
 * @throws TransformerException
 */
public ArrayList<ErrorInfo> checkErrorAndGetErrorList(File file, ResourceSet resourceSet)
		throws IOException, ParserConfigurationException, SAXException, TransformerException {

	String method = "SysMLChecker_getErrorList(): ";
	long startTime = System.currentTimeMillis();
	MyLog.info(method + "start");

	URI uri = URI.createFileURI(file.getPath());
	ArrayList<ErrorInfo> errorLog = new ArrayList<ErrorInfo>();

	// load the resource into memory

	@SuppressWarnings("unused")
	Model umlModel = UML2Util.load(resourceSet, uri, UMLPackage.Literals.MODEL);
	// get all error list
	for (Resource umlResourceImpl : resourceSet.getResources()) {
		if (!umlResourceImpl.getErrors().isEmpty()) {
			for (Diagnostic error : umlResourceImpl.getErrors()) {
				ErrorInfo errorInfo = new ErrorInfo(error.getLine(), error.getColumn(), error.getMessage());
				if (!error.getMessage().contains("org.xml.sax.SAXParseException"))
					// filter the sax exception errors
					errorLog.add(errorInfo);
			}
		}
	}
	umlModel = null;

	MyLog.info(method + "end with " + (System.currentTimeMillis() - startTime) + " millisecond");
	MyLog.info();
	return errorLog;

}
 
开发者ID:ZhengshuaiPENG,项目名称:org.lovian.eaxmireader,代码行数:46,代码来源:SysMLChecker.java

示例4: checkResourceErrors

import org.eclipse.emf.ecore.resource.Resource.Diagnostic; //导入方法依赖的package包/类
private boolean checkResourceErrors(Resource resource) {
	if (resource.getErrors().isEmpty())
	{
		return true;
	}
	else
	{
		boolean valid = true;
		for (Diagnostic error : resource.getErrors())
		{
			// exception: if errors only concern beginning and end of file
			if (error.getMessage() != null 
					&& error.getMessage().equals("missing EOF at '\\r'"))
			{
				// nothing;
			}
			else if (error.getMessage() != null 
					&& error.getMessage().equals("extraneous input '\\r' expecting '§'"))
			{
				// nothing
			}
			else if (error.getMessage() != null 
					&& error.getMessage().equals("mismatched input '<EOF>' expecting '§'"))
			{
				// nothing
			}
			else
			{
				valid = false;
			}
		}
		return valid;
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:35,代码来源:EgyTextEditorPart.java


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