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

Java Exceptions类代码示例

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

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



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

示例1: prepareInput

import org.eclipse.xtext.util.Exceptions; //导入依赖的package包/类
@Override
protected Object prepareInput(IProgressMonitor pm) {
	try {
		ResourceNode ancestor = new ResourceNode(file);
		String ancestorContent = getContent(ancestor);
		String leftContent, rightContent;

		leftContent = this.comparisonFailure.getExpected();
		rightContent = this.comparisonFailure.getActual();
		if (!leftContent.equals(ancestorContent))
			getCompareConfiguration().setProperty(ICompareUIConstants.PROP_ANCESTOR_VISIBLE, Boolean.TRUE);
		CompareItem left = new EditableCompareItem("Left", leftContent, file);
		CompareItem right = new CompareItem("Right", rightContent);
		return new DiffNode(null, Differencer.CHANGE | Differencer.DIRECTION_MASK, ancestor, left, right);
	} catch (Throwable t) {
		LOG.error(t.getMessage(), t);
		Exceptions.throwUncheckedException(t);
		return null;
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:N4IDEXpectCompareEditorInput.java


示例2: compile

import org.eclipse.xtext.util.Exceptions; //导入依赖的package包/类
/**
 * Parses, validates and compiles the given source. Calls the given acceptor for each
 * resource which is generated from the source.
 *  
 * @param resourceSet - the {@link ResourceSet} to use
 * @param acceptor gets called once for each file generated in {@link IGenerator}
 */
public void compile(final ResourceSet resourceSet, IAcceptor<Result> acceptor) {
	try {
		List<Resource> resourcesToCheck = newArrayList(resourceSet.getResources());
		if (generatorConfigProvider instanceof GeneratorConfigProvider) {
			GeneratorConfigProvider configProvider = (GeneratorConfigProvider) generatorConfigProvider;
			GeneratorConfig config = generatorConfigProvider.get(null);
			config.setJavaSourceVersion(javaCompiler.getJavaVersion());
			GeneratorConfig existent = configProvider.install(resourceSet, config);
			if (existent != null) {
				existent.setJavaSourceVersion(javaCompiler.getJavaVersion());
				configProvider.install(resourceSet, existent);
			}
		}
		Result result = resultProvider.get();
		result.setJavaCompiler(javaCompiler);
		result.setCheckMode(getCheckMode());
		result.setResources(resourcesToCheck);
		result.setResourceSet(resourceSet);
		result.setOutputConfigurations(getOutputConfigurations());
		result.doGenerate();
		acceptor.accept(result);
	} catch (Exception e) {
		Exceptions.throwUncheckedException(e);
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:33,代码来源:CompilationTestHelper.java


示例3: compile

import org.eclipse.xtext.util.Exceptions; //导入依赖的package包/类
/**
 * Parses, validates and compiles the given source. Calls the given acceptor for each
 * resource which is generated from the source.
 *  
 * @param resourceSet - the {@link ResourceSet} to use
 * @param acceptor gets called once for each file generated in {@link IGenerator}
 */
public void compile(final ResourceSet resourceSet, IAcceptor<Result> acceptor) {
	try {
		List<Resource> resourcesToCheck = newArrayList(resourceSet.getResources());
		//this.javaCompiler = new OnTheFlyJavaCompiler2(new ClassLoader() {}, JavaVersion.JAVA8);
		Result result = resultProvider.get();
		result.setJavaCompiler(javaCompiler);
		result.setCheckMode(getCheckMode());
		result.setResources(resourcesToCheck);
		result.setResourceSet(resourceSet);
		result.setOutputConfigurations(getOutputConfigurations());
		result.doGenerate();
		acceptor.accept(result);
	} catch (Exception e) {
		Exceptions.throwUncheckedException(e);
	}
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:24,代码来源:MyCompilationTestHelper.java


示例4: handleInvocationTargetException

import org.eclipse.xtext.util.Exceptions; //导入依赖的package包/类
protected void handleInvocationTargetException(Throwable targetException, State state) {
	// ignore GuardException, check is just not evaluated if guard is false
	// ignore NullPointerException, as not having to check for NPEs all the time is a convenience feature
	if (!(targetException instanceof GuardException) && !(targetException instanceof NullPointerException))
		Exceptions.throwUncheckedException(targetException);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:7,代码来源:AbstractDeclarativeValidator.java


示例5: ConflictingRegionsException

import org.eclipse.xtext.util.Exceptions; //导入依赖的package包/类
public ConflictingRegionsException(String message, Throwable cause, Collection<RegionTrace> traces) {
	super(message, cause);
	this.traces = traces;
	for (RegionTrace trace : traces)
		Exceptions.addSuppressed(this, trace);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:7,代码来源:ConflictingRegionsException.java


示例6: handleTextError

import org.eclipse.xtext.util.Exceptions; //导入依赖的package包/类
protected Object handleTextError(Object[] params, Throwable e) {
	if(e instanceof NullPointerException) {
		return getDefaultText();
	}
	return Exceptions.throwUncheckedException(e);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:7,代码来源:DeclarativeLabelProvider.java


示例7: handleImageError

import org.eclipse.xtext.util.Exceptions; //导入依赖的package包/类
protected Object handleImageError(Object[] params, Throwable e) {
	if(e instanceof NullPointerException) {
		return getDefaultImage();
	}
	return Exceptions.throwUncheckedException(e);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:7,代码来源:DeclarativeLabelProvider.java


示例8: handleTextError

import org.eclipse.xtext.util.Exceptions; //导入依赖的package包/类
/**
 * Handles error exceptions from polymorphic text dispatcher.
 * 
 * @param params
 *          parameters passed by the dispatcher.
 * @param e
 *          exception encountered by the dispatcher.
 * @return default text for a null value if exception was a NullPointerException, else wraps and throws exception
 */
protected String handleTextError(final Object[] params, final Throwable e) {
  if (e instanceof NullPointerException) {
    return text(null);
  }
  return Exceptions.throwUncheckedException(e);
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:16,代码来源:AbstractTypeLabelProvider.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java MapState类代码示例发布时间:2022-05-23
下一篇:
Java NoMoreDataException类代码示例发布时间: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