本文整理匯總了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();
}
}
}