當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。