Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2015-04-10 06:54:04 +0000
committerHenrik Rentz-Reichert2015-04-17 14:09:56 +0000
commit7cd802923e7efb64bad5fd23250b711ddc4c0c94 (patch)
tree5d9a3ffc32416ab5d440ba7dc56d2c27b4c7326c /plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui
parent509c50bfd19ca15421352ca1fc51182031aa3be2 (diff)
downloadorg.eclipse.etrice-7cd802923e7efb64bad5fd23250b711ddc4c0c94.tar.gz
org.eclipse.etrice-7cd802923e7efb64bad5fd23250b711ddc4c0c94.tar.xz
org.eclipse.etrice-7cd802923e7efb64bad5fd23250b711ddc4c0c94.zip
refactorings for abstract FSM interface
Diffstat (limited to 'plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui')
-rw-r--r--plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/editor/DiagramEditorBase.java51
1 files changed, 29 insertions, 22 deletions
diff --git a/plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/editor/DiagramEditorBase.java b/plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/editor/DiagramEditorBase.java
index 59778920e..87fb2ff0b 100644
--- a/plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/editor/DiagramEditorBase.java
+++ b/plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/editor/DiagramEditorBase.java
@@ -135,30 +135,37 @@ public abstract class DiagramEditorBase extends DiagramEditor implements IInputU
return;
}
- // HOWTO: call serializer to validate the concrete syntax
- // this throws an exception which is caught further up the stack
- // and a dialog will be displayed
- serializer.serialize(xres.getContents().get(0));
-
- List<Issue> result = resourceValidator.validate(res, CheckMode.NORMAL_AND_FAST, new CancelIndicator() {
- public boolean isCanceled() {
- return monitor.isCanceled();
- }
- });
- if (!result.isEmpty()) {
- boolean error = false;
- MultiStatus ms = new MultiStatus(UIBaseActivator.PLUGIN_ID, Status.ERROR, "validation errors during diagram save", null);
- for (Issue issue : result) {
- if (issue.isSyntaxError() || issue.getSeverity()==Severity.ERROR) {
- ms.add(new Status(Status.ERROR, UIBaseActivator.PLUGIN_ID, issue.getMessage()));
- error = true;
+ try {
+ // HOWTO: call serializer to validate the concrete syntax
+ // this throws an exception which is caught further up the stack
+ // and a dialog will be displayed
+ serializer.serialize(xres.getContents().get(0));
+
+ List<Issue> result = resourceValidator.validate(res, CheckMode.NORMAL_AND_FAST, new CancelIndicator() {
+ public boolean isCanceled() {
+ return monitor.isCanceled();
+ }
+ });
+ if (!result.isEmpty()) {
+ boolean error = false;
+ MultiStatus ms = new MultiStatus(UIBaseActivator.PLUGIN_ID, Status.ERROR, "validation errors during diagram save", null);
+ for (Issue issue : result) {
+ if (issue.isSyntaxError() || issue.getSeverity()==Severity.ERROR) {
+ ms.add(new Status(Status.ERROR, UIBaseActivator.PLUGIN_ID, issue.getMessage()));
+ error = true;
+ }
+ }
+ if (error) {
+ MessageDialog.openError(Display.getDefault().getActiveShell(), "ERROR", "Internal error: model is invalid, can't save");
+ UIBaseActivator.getDefault().getLog().log(ms);
+ return;
}
}
- if (error) {
- MessageDialog.openError(Display.getDefault().getActiveShell(), "ERROR", "Internal error: model is invalid, can't save");
- UIBaseActivator.getDefault().getLog().log(ms);
- return;
- }
+ }
+ catch (RuntimeException e) {
+ MessageDialog.openError(Display.getDefault().getActiveShell(), "ERROR", "Internal error: model is invalid, can't save:\n\n"+e.getMessage());
+ UIBaseActivator.getDefault().getLog().log(new Status(Status.ERROR, UIBaseActivator.PLUGIN_ID, e.getMessage()));
+ return;
}
}
}

Back to the top