本文整理汇总了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();
}
示例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);
}
示例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();
}
}
}
示例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();
}
}
}