You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by jo...@apache.org on 2009/04/15 11:51:20 UTC
svn commit: r765100 - in
/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor:
CasDocumentProvider.java DefaultCasDocumentProvider.java
Author: joern
Date: Wed Apr 15 09:51:20 2009
New Revision: 765100
URL: http://svn.apache.org/viewvc?rev=765100&view=rev
Log:
UIMA-1329
Modified:
incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java
incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor/DefaultCasDocumentProvider.java
Modified: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java?rev=765100&r1=765099&r2=765100&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java (original)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java Wed Apr 15 09:51:20 2009
@@ -74,6 +74,7 @@
mDocument = null;
}
+ @SuppressWarnings("unchecked")
public Iterator<EclipseAnnotationPeer> getAnnotationIterator() {
return new Iterator<EclipseAnnotationPeer>() {
private Iterator<AnnotationFS> mAnnotations =
Modified: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor/DefaultCasDocumentProvider.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor/DefaultCasDocumentProvider.java?rev=765100&r1=765099&r2=765100&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor/DefaultCasDocumentProvider.java (original)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor/DefaultCasDocumentProvider.java Wed Apr 15 09:51:20 2009
@@ -18,7 +18,7 @@
@Override
protected IDocument createDocument(Object element) throws CoreException {
if (element instanceof FileEditorInput) {
- FileEditorInput fileInput = (FileEditorInput) element;
+ FileEditorInput fileInput = (FileEditorInput) element;
IFile file = fileInput.getFile();
@@ -31,8 +31,6 @@
((DocumentElement) nlpElement).getDocument(true);
AnnotationDocument document = new AnnotationDocument();
- // TODO: fix it
- // document.setProject(nlpElement.getNlpProject());
document.setDocument(workingCopy);
return document;
@@ -65,6 +63,35 @@
@Override
protected void doSaveDocument(IProgressMonitor monitor, Object element,
IDocument document, boolean overwrite) throws CoreException {
+
+ fireElementStateChanging(element);
+
+
+ if (element instanceof FileEditorInput) {
+ FileEditorInput fileInput = (FileEditorInput) element;
+
+ IFile file = fileInput.getFile();
+
+ INlpElement nlpElement = org.apache.uima.caseditor.CasEditorPlugin.getNlpModel().findMember(file);
+
+ if (nlpElement instanceof DocumentElement) {
+ DocumentElement documentElement = (DocumentElement) nlpElement;
+
+ try {
+ documentElement.saveDocument();
+ }
+ catch (CoreException e) {
+ fireElementStateChangeFailed(element);
+ throw e;
+ }
+ }
+ else {
+ fireElementStateChangeFailed(element);
+ return;
+ }
+ }
+
+ fireElementDirtyStateChanged(element, false);
}
private INlpElement getNlpElement(Object element) {