提交 e67203d4 编写于 作者: J jurgen

Do not close editor if property save fails

Former-commit-id: 17d3241c
上级 21140a4e
...@@ -212,17 +212,29 @@ public class EntityEditor extends MultiPageDatabaseEditor ...@@ -212,17 +212,29 @@ public class EntityEditor extends MultiPageDatabaseEditor
for (IEditorPart editor : editorMap.values()) { for (IEditorPart editor : editorMap.values()) {
editor.doSave(monitor); editor.doSave(monitor);
if (monitor.isCanceled()) {
return;
}
}
if (monitor.isCanceled()) {
return;
} }
final DBECommandContext commandContext = getCommandContext(); final DBECommandContext commandContext = getCommandContext();
if (commandContext != null && commandContext.isDirty()) { if (commandContext != null && commandContext.isDirty()) {
saveCommandContext(monitor); if (!saveCommandContext(monitor)) {
monitor.setCanceled(true);
return;
}
if (monitor.isCanceled()) {
return;
}
} }
firePropertyChange(IEditorPart.PROP_DIRTY); firePropertyChange(IEditorPart.PROP_DIRTY);
} }
private void saveCommandContext(IProgressMonitor monitor) private boolean saveCommandContext(IProgressMonitor monitor)
{ {
monitor.beginTask(CoreMessages.editors_entity_monitor_preview_changes, 1); monitor.beginTask(CoreMessages.editors_entity_monitor_preview_changes, 1);
int previewResult = showChanges(true); int previewResult = showChanges(true);
...@@ -270,10 +282,14 @@ public class EntityEditor extends MultiPageDatabaseEditor ...@@ -270,10 +282,14 @@ public class EntityEditor extends MultiPageDatabaseEditor
// ok // ok
} }
} }
if (error != null) { if (error == null) {
return true;
} else {
UIUtils.showErrorDialog(getSite().getShell(), "Can't save '" + getDatabaseObject().getName() + "'", null, error); UIUtils.showErrorDialog(getSite().getShell(), "Can't save '" + getDatabaseObject().getName() + "'", null, error);
return false;
} }
} }
return true;
} }
public void revertChanges() public void revertChanges()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册