use of org.jkiss.dbeaver.ui.dialogs.StandardErrorDialog in project dbeaver by serge-rider.
the class DBeaverUI method showError.
@Override
public UserResponse showError(@NotNull final String title, @Nullable final String message, @NotNull final IStatus status) {
IStatus rootStatus = status;
for (IStatus s = status; s != null; ) {
if (s.getException() instanceof DBException) {
UserResponse dbErrorResp = showDatabaseError(message, (DBException) s.getException());
if (dbErrorResp != null) {
// If this DB error was handled by some DB-specific way then just don't care about it
return dbErrorResp;
}
break;
}
if (s.getChildren() != null && s.getChildren().length > 0) {
s = rootStatus = s.getChildren()[0];
} else {
break;
}
}
log.error(rootStatus.getMessage(), rootStatus.getException());
// log.debug(message);
Runnable runnable = () -> {
// Display the dialog
StandardErrorDialog dialog = new StandardErrorDialog(UIUtils.getActiveWorkbenchShell(), title, message, status, IStatus.ERROR);
dialog.open();
};
UIUtils.syncExec(runnable);
return UserResponse.OK;
}
use of org.jkiss.dbeaver.ui.dialogs.StandardErrorDialog in project dbeaver by dbeaver.
the class DBeaverUI method showError.
@Override
public UserResponse showError(@NotNull final String title, @Nullable final String message, @NotNull final IStatus status) {
IStatus rootStatus = status;
for (IStatus s = status; s != null; ) {
if (s.getException() instanceof DBException) {
UserResponse dbErrorResp = showDatabaseError(message, (DBException) s.getException());
if (dbErrorResp != null) {
// If this DB error was handled by some DB-specific way then just don't care about it
return dbErrorResp;
}
break;
}
if (s.getChildren() != null && s.getChildren().length > 0) {
s = rootStatus = s.getChildren()[0];
} else {
break;
}
}
log.error(rootStatus.getMessage(), rootStatus.getException());
// log.debug(message);
Runnable runnable = () -> {
// Display the dialog
StandardErrorDialog dialog = new StandardErrorDialog(UIUtils.getActiveWorkbenchShell(), title, message, status, IStatus.ERROR);
dialog.open();
};
UIUtils.syncExec(runnable);
return UserResponse.OK;
}
use of org.jkiss.dbeaver.ui.dialogs.StandardErrorDialog in project dbeaver by serge-rider.
the class UIUtils method showErrorDialog.
public static void showErrorDialog(@Nullable final Shell shell, @NotNull final String title, @Nullable final String message, @NotNull final IStatus status) {
for (IStatus s = status; s != null; ) {
if (s.getException() instanceof DBException) {
if (showDatabaseError(shell, title, message, (DBException) s.getException())) {
// If this DB error was handled by some DB-specific way then just don't care about it
return;
}
break;
}
if (s.getChildren() != null && s.getChildren().length > 0) {
s = s.getChildren()[0];
} else {
break;
}
}
// log.debug(message);
Runnable runnable = new Runnable() {
@Override
public void run() {
// Display the dialog
StandardErrorDialog dialog = new StandardErrorDialog(shell == null ? DBeaverUI.getActiveWorkbenchShell() : shell, title, message, RuntimeUtils.stripStack(status), IStatus.ERROR);
dialog.open();
}
};
DBeaverUI.syncExec(runnable);
}
Aggregations