aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarwa rostren2014-02-10 08:53:28 (EST)
committerEd Willink2014-03-06 10:07:47 (EST)
commit34c7729fb4c3b3f87daa693ac0de57d28f30991e (patch)
tree133dc474b77045218db0cb97efcc834544d5439a
parent179f1d8962ae3bd8ab28373a301395e045312f50 (diff)
downloadorg.eclipse.ocl-34c7729fb4c3b3f87daa693ac0de57d28f30991e.zip
org.eclipse.ocl-34c7729fb4c3b3f87daa693ac0de57d28f30991e.tar.gz
org.eclipse.ocl-34c7729fb4c3b3f87daa693ac0de57d28f30991e.tar.bz2
[425799] Fix exported file and hovering message content.
Change-Id: I7138edb9812678a305711988e2c64b3b5d985535 Signed-off-by: marwa rostren <mrostren@obeo.fr>
-rw-r--r--emfv/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/export/util/AbstractExport.java18
-rw-r--r--emfv/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/export/util/TextExport.java2
-rw-r--r--emfv/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/providers/NodeLabelProvider.java23
3 files changed, 28 insertions, 15 deletions
diff --git a/emfv/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/export/util/AbstractExport.java b/emfv/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/export/util/AbstractExport.java
index 13f5edf..dccbf32 100644
--- a/emfv/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/export/util/AbstractExport.java
+++ b/emfv/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/export/util/AbstractExport.java
@@ -219,13 +219,19 @@ public abstract class AbstractExport implements IValidatorExport {
message.append("null diagnostic message");
} else if (diagnostic instanceof Diagnostic) {
boolean isFirst = true;
- for (Diagnostic child : ((Diagnostic) diagnostic).getChildren()) {
- if (isFirst) {
- message.append(child.getMessage());
- isFirst = false;
- } else {
- message.append("\n" + child.getMessage());
+ List<Diagnostic> diagnosticChildren = ((Diagnostic) diagnostic)
+ .getChildren();
+ if (diagnosticChildren != null && !diagnosticChildren.isEmpty()) {
+ for (Diagnostic child : diagnosticChildren) {
+ if (isFirst) {
+ message.append(child.getMessage());
+ isFirst = false;
+ } else {
+ message.append("\n" + child.getMessage());
+ }
}
+ } else {
+ message.append(((Diagnostic) diagnostic).getMessage());
}
return message.toString();
} else {
diff --git a/emfv/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/export/util/TextExport.java b/emfv/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/export/util/TextExport.java
index 1494e40..8828c59 100644
--- a/emfv/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/export/util/TextExport.java
+++ b/emfv/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/export/util/TextExport.java
@@ -90,7 +90,7 @@ public class TextExport extends AbstractExport {
}
}
}
- if (!validationErrors.isEmpty()) {
+ if (!validationFailures.isEmpty()) {
text.append("- Failures:\n");
for (LeafConstrainingNode failureNode : validationFailures) {
if (loggedConstrainingObjects.add(failureNode.getConstrainingObject())) {
diff --git a/emfv/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/providers/NodeLabelProvider.java b/emfv/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/providers/NodeLabelProvider.java
index 1566394..bc99e2d 100644
--- a/emfv/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/providers/NodeLabelProvider.java
+++ b/emfv/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/providers/NodeLabelProvider.java
@@ -18,6 +18,7 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
+import java.util.List;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.TreeIterator;
@@ -117,15 +118,21 @@ public class NodeLabelProvider extends ColumnLabelProvider
protected void appendResourceDiagnostic(@NonNull Writer s, @NonNull Diagnostic diagnostic) {
boolean isFirst = true;
- for (Diagnostic child : diagnostic.getChildren()) {
- try {
- if (isFirst) {
- s.append(child.getMessage());
- isFirst = false;
- } else {
- s.append("\n" + child.getMessage());
+ List<Diagnostic> children = diagnostic.getChildren();
+ try {
+ if (!children.isEmpty()) {
+ for (Diagnostic child : diagnostic.getChildren()) {
+ if (isFirst) {
+ s.append(child.getMessage());
+ isFirst = false;
+ } else {
+ s.append("\n" + child.getMessage());
+ }
}
- } catch (IOException e) {}
+ } else {
+ s.append(diagnostic.getMessage());
+ }
+ } catch (IOException e) {
}
}