未验证 提交 cb36c590 编写于 作者: S Serge Rider 提交者: GitHub

Merge pull request #9511 from dbeaver/postgrewar#9182

#9182 postgresql warning message added
......@@ -235,6 +235,17 @@ public class DBeaverUI implements DBPPlatformUI {
});
}
@Override
public void showWarningMessageBox(@NotNull String title, String message) {
UIUtils.syncExec(() -> {
UIUtils.showMessageBox(
UIUtils.getActiveWorkbenchShell(),
title,
message,
SWT.ICON_WARNING);
});
}
@Override
public boolean confirmAction(String title, String message) {
return UIUtils.confirmAction(title, message);
......
......@@ -7,6 +7,7 @@ import org.jkiss.dbeaver.model.runtime.DBRRunnableContext;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.task.DBTTask;
import org.jkiss.dbeaver.registry.task.TaskPreferenceStore;
import org.jkiss.dbeaver.runtime.DBWorkbench;
import org.jkiss.utils.CommonUtils;
import java.io.File;
......@@ -109,4 +110,13 @@ public class PostgreDatabaseRestoreHandler extends PostgreNativeToolHandler<Post
}
}
@Override
public void validateErrorCode(int exitCode) throws IOException {
if (exitCode == 1) {
DBWorkbench.getPlatformUI().showWarningMessageBox("Warning", "Database restore finished with warnings.\nPlease check the error log to see what is wrong.");
} else {
super.validateErrorCode(exitCode);
}
}
}
......@@ -57,6 +57,7 @@ public interface DBPPlatformUI {
UserResponse showError(@NotNull final String title, @Nullable final String message, @NotNull final Throwable e);
UserResponse showError(@NotNull final String title, @Nullable final String message);
void showMessageBox(@NotNull final String title, @Nullable final String message, boolean error);
void showWarningMessageBox(@NotNull final String title, @Nullable final String message);
boolean confirmAction(String title, String message);
UserResponse showErrorStopRetryIgnore(String task, Throwable error, boolean queue);
......
......@@ -68,6 +68,11 @@ public class ConsoleUserInterface implements DBPPlatformUI {
System.out.println(title + (message == null ? "" : ": " + message));
}
@Override
public void showWarningMessageBox(@NotNull String title, @Nullable String message) {
System.out.println(title + (message == null ? "" : ": " + message));
}
@Override
public boolean confirmAction(String title, String message) {
return false;
......
......@@ -178,9 +178,7 @@ public abstract class AbstractNativeToolHandler<SETTINGS extends AbstractNativeT
}
try {
final int exitCode = process.exitValue();
if (exitCode != 0) {
throw new IOException("Process failed (exit code = " + exitCode + "). See error log.");
}
validateErrorCode(exitCode);
} catch (IllegalThreadStateException e) {
// Still running
continue;
......@@ -198,6 +196,12 @@ public abstract class AbstractNativeToolHandler<SETTINGS extends AbstractNativeT
return true;
}
public void validateErrorCode(int exitCode) throws IOException {
if (exitCode != 0) {
throw new IOException("Process failed (exit code = " + exitCode + "). See error log.");
}
}
protected void notifyToolFinish(String toolName, long workTime) {
// Notify agent
if (workTime > DBWorkbench.getPlatformUI().getLongOperationTimeout() * 1000) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册