提交 438587ae 编写于 作者: S serge-rider

#1652 ERD error handling


Former-commit-id: 3e356946
上级 ace349e3
......@@ -817,6 +817,10 @@ public class SQLEditor extends SQLEditorBase implements
return resultsSash.getMaximizedControl() != null;
}
public SQLEditorPresentation getExtraPresentation() {
return extraPresentation;
}
public SQLEditorPresentation.ActivationType getExtraPresentationState() {
if (extraPresentation == null) {
return SQLEditorPresentation.ActivationType.HIDDEN;
......
......@@ -578,7 +578,7 @@ public abstract class SQLEditorBase extends BaseTextEditor implements IErrorVisu
}
@Nullable
protected SQLScriptElement extractActiveQuery()
public SQLScriptElement extractActiveQuery()
{
SQLScriptElement element;
ITextSelection selection = (ITextSelection) getSelectionProvider().getSelection();
......
......@@ -138,6 +138,8 @@ public abstract class ERDEditorPart extends GraphicalEditorWithFlyoutPalette
private IPropertyChangeListener configPropertyListener;
private PaletteRoot paletteRoot;
private String errorMessage;
/**
* No-arg constructor
*/
......@@ -180,6 +182,8 @@ public abstract class ERDEditorPart extends GraphicalEditorWithFlyoutPalette
progressControl = new ProgressControl(parent, SWT.SHEET);
progressControl.setShowDivider(true);
contentContainer = progressControl.createContentContainer();
} else {
isLoaded = true;
}
super.createPartControl(contentContainer);
......@@ -362,6 +366,13 @@ public abstract class ERDEditorPart extends GraphicalEditorWithFlyoutPalette
{
GraphicalViewer viewer = createViewer(parent);
viewer.getControl().addPaintListener(e -> {
if (!CommonUtils.isEmpty(errorMessage)) {
e.gc.setForeground(viewer.getControl().getForeground());
UIUtils.drawMessageOverControl(viewer.getControl(), e, errorMessage, 0);
}
});
// hook the viewer into the EditDomain
setGraphicalViewer(viewer);
......@@ -581,7 +592,6 @@ public abstract class ERDEditorPart extends GraphicalEditorWithFlyoutPalette
// the marquee selection tool
controls.add(new MarqueeToolEntry());
if (!isReadOnly()) {
// separator
PaletteSeparator separator = new PaletteSeparator("tools");
......@@ -804,6 +814,10 @@ public abstract class ERDEditorPart extends GraphicalEditorWithFlyoutPalette
return progressControl != null && progressControl.performSearch(searchType);
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
protected abstract void loadDiagram(boolean refreshMetadata);
private class ChangeAttributePresentationAction extends Action {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册