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


Java ExceptionUtils类代码示例

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


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

示例1: openErrorMessageBox

import it.albertus.util.ExceptionUtils; //导入依赖的package包/类
private static int openErrorMessageBox(final Shell shell, final Throwable throwable) {
	final int style;
	final String message;
	if (throwable instanceof ConfigurationException) {
		final ConfigurationException ce = (ConfigurationException) throwable;
		style = SWT.ICON_WARNING | SWT.YES | SWT.NO;
		String propertyName;
		try {
			propertyName = Preference.forName(ce.getKey()).getLabel();
		}
		catch (final Exception e) {
			logger.log(Level.FINE, e.toString(), e);
			propertyName = ce.getKey();
		}
		message = JFaceMessages.get("err.configuration.invalid", propertyName) + ' ' + Messages.get("lbl.preferences.edit");
	}
	else {
		style = SWT.ICON_ERROR;
		message = ExceptionUtils.getUIMessage(throwable);
	}
	final MessageBox messageBox = new MessageBox(shell, style);
	messageBox.setText(Messages.get("lbl.window.title"));
	messageBox.setMessage(message);
	return messageBox.open();
}
 
开发者ID:Albertus82,项目名称:RouterLogger,代码行数:26,代码来源:RouterLoggerGui.java

示例2: createMultiStatus

import it.albertus.util.ExceptionUtils; //导入依赖的package包/类
public static MultiStatus createMultiStatus(final int severity, final Throwable throwable) {
	final Collection<IStatus> childStatuses = new ArrayList<IStatus>();

	StringReader sr = null;
	BufferedReader br = null;
	try {
		sr = new StringReader(ExceptionUtils.getStackTrace(throwable));
		br = new BufferedReader(sr);
		String line;
		while ((line = br.readLine()) != null) {
			final IStatus status = new Status(severity, throwable.getClass().getName(), line.replace("\t", NESTING_INDENT));
			childStatuses.add(status);
		}
	}
	catch (final IOException e) {
		logger.log(Level.WARNING, e.toString(), e);
	}
	finally {
		IOUtils.closeQuietly(br, sr);
	}

	return new MultiStatus(EnhancedErrorDialog.class.getPackage().getName(), severity, childStatuses.toArray(new IStatus[childStatuses.size()]), throwable.toString(), throwable);
}
 
开发者ID:Albertus82,项目名称:JFaceUtils,代码行数:24,代码来源:EnhancedErrorDialog.java

示例3: widgetSelected

import it.albertus.util.ExceptionUtils; //导入依赖的package包/类
@Override
public void widgetSelected(final SelectionEvent se) {
	MessageBox messageBox = new MessageBox(gui.getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
	messageBox.setText(Messages.get("msg.warning"));
	messageBox.setMessage(Messages.get("msg.reset.overwrite.all"));
	int choose = messageBox.open();
	if (choose == SWT.YES) {
		try {
			reset();
		}
		catch (final Exception e) {
			logger.log(Level.WARNING, e.toString(), e);
			messageBox = new MessageBox(gui.getShell(), SWT.ICON_ERROR);
			messageBox.setText(Messages.get("msg.warning"));
			messageBox.setMessage(Messages.get("err.reset", ExceptionUtils.getUIMessage(e)));
			messageBox.open();
		}
	}
}
 
开发者ID:Albertus82,项目名称:CyclesMod,代码行数:20,代码来源:ResetAllSelectionListener.java

示例4: widgetSelected

import it.albertus.util.ExceptionUtils; //导入依赖的package包/类
@Override
public void widgetSelected(final SelectionEvent se) {
	final BikeType type = BikeType.values()[gui.getTabs().getTabFolder().getSelectionIndex()];
	MessageBox messageBox = new MessageBox(gui.getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
	messageBox.setText(Messages.get("msg.warning"));
	messageBox.setMessage(Messages.get("msg.reset.overwrite.single", type.getDisplacement()));
	int choose = messageBox.open();
	if (choose == SWT.YES) {
		try {
			reset(type);
		}
		catch (final Exception e) {
			logger.log(Level.WARNING, e.toString(), e);
			messageBox = new MessageBox(gui.getShell(), SWT.ICON_ERROR);
			messageBox.setText(Messages.get("msg.warning"));
			messageBox.setMessage(Messages.get("err.reset", ExceptionUtils.getUIMessage(e)));
			messageBox.open();
		}
	}
}
 
开发者ID:Albertus82,项目名称:CyclesMod,代码行数:21,代码来源:ResetSingleSelectionListener.java


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