Author: joern
Date: Mon Oct 4 07:57:58 2010
New Revision: 1004137
URL: http://svn.apache.org/viewvc?rev=1004137&view=rev
Log:
UIMA-1887 Added support to serialize a CAS in the non Cas Editor Project case.
The error status is now cleared when a document can be loaded successfully in
the non Cas Editor Project case, otherwise a previous error message might be
displayed.
Modified:
uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationDocument.java
uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/DefaultCasDocumentProvider.java
Modified:
uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationDocument.java
URL:
http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationDocument.java?rev=1004137&r1=1004136&r2=1004137&view=diff
==============================================================================
---
uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationDocument.java
(original)
+++
uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationDocument.java
Mon Oct 4 07:57:58 2010
@@ -79,6 +79,10 @@ public class AnnotationDocument extends
set(getText());
}
+ ICasDocument getDocument() {
+ return mDocument;
+ }
+
/**
* Call is forwarded to the set document.
*
Modified:
uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/DefaultCasDocumentProvider.java
URL:
http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/DefaultCasDocumentProvider.java?rev=1004137&r1=1004136&r2=1004137&view=diff
==============================================================================
---
uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/DefaultCasDocumentProvider.java
(original)
+++
uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/DefaultCasDocumentProvider.java
Mon Oct 4 07:57:58 2010
@@ -209,7 +209,9 @@ public class DefaultCasDocumentProvider
AnnotationDocument document = new AnnotationDocument();
document.setDocument(doc);
-
+
+ elementErrorStatus.remove(element);
+
return document;
}
else {
@@ -261,12 +263,29 @@ public class DefaultCasDocumentProvider
fireElementStateChangeFailed(element);
throw e;
}
- } else {
+ } else if (CasEditorPlugin.getNlpModel().
+ findMember(file.getProject()) instanceof INlpElement) {
fireElementStateChangeFailed(element);
return;
}
+ else {
+ if (document instanceof AnnotationDocument) {
+
+ AnnotationDocument annotationDocument = (AnnotationDocument)
document;
+ DocumentUimaImpl documentImpl = (DocumentUimaImpl)
annotationDocument.getDocument();
+
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream(40000);
+ documentImpl.serialize(outStream);
+
+ InputStream stream = new
ByteArrayInputStream(outStream.toByteArray());
+
+ file.setContents(stream, true, false, null);
+ }
+ }
}
+ // tell everyone that the element changed and is not
+ // dirty any longer
fireElementDirtyStateChanged(element, false);
}