You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by mb...@apache.org on 2007/08/17 13:34:49 UTC

svn commit: r567021 - in /incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor: action/DeleteFeatureStructureAction.java fsview/FeatureStructureBrowserViewPage.java

Author: mbaessler
Date: Fri Aug 17 04:34:48 2007
New Revision: 567021

URL: http://svn.apache.org/viewvc?view=rev&rev=567021
Log:
UIMA-531

applied patch UIMA-531.patch

JIRA ticket https://issues.apache.org/jira/browse/UIMA-531

Modified:
    incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/action/DeleteFeatureStructureAction.java
    incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/fsview/FeatureStructureBrowserViewPage.java

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/action/DeleteFeatureStructureAction.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/action/DeleteFeatureStructureAction.java?view=diff&rev=567021&r1=567020&r2=567021
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/action/DeleteFeatureStructureAction.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/action/DeleteFeatureStructureAction.java Fri Aug 17 04:34:48 2007
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -21,7 +21,7 @@
 
 
 import org.apache.uima.caseditor.core.IDocument;
-import org.apache.uima.caseditor.editor.AnnotationSelection;
+import org.apache.uima.caseditor.editor.FeatureStructureSelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.actions.BaseSelectionListenerAction;
 
@@ -33,7 +33,7 @@
 
   /**
    * Initializes the current instance.
-   * 
+   *
    * @param document
    */
   public DeleteFeatureStructureAction(IDocument document) {
@@ -46,9 +46,10 @@
 
   @Override
   protected boolean updateSelection(IStructuredSelection selection) {
-    AnnotationSelection annotation = new AnnotationSelection(selection);
+    FeatureStructureSelection featureStructures =
+      new FeatureStructureSelection(selection);
 
-    return annotation.size() > 0;
+    return featureStructures.size() > 0;
   }
 
   /**
@@ -56,8 +57,10 @@
    */
   @Override
   public void run() {
-    AnnotationSelection annotations = new AnnotationSelection(getStructuredSelection());
 
-    mDocument.removeAnnotations(annotations.toList());
+    FeatureStructureSelection featureStructures =
+      new FeatureStructureSelection(getStructuredSelection());
+
+    mDocument.removeFeatureStructures(featureStructures.toList());
   }
 }

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/fsview/FeatureStructureBrowserViewPage.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/fsview/FeatureStructureBrowserViewPage.java?view=diff&rev=567021&r1=567020&r2=567021
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/fsview/FeatureStructureBrowserViewPage.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/fsview/FeatureStructureBrowserViewPage.java Fri Aug 17 04:34:48 2007
@@ -244,6 +244,24 @@
     }
 
     @Override
+    public void added(Collection<FeatureStructure> structres) {
+      final LinkedList<ModelFeatureStructure> featureStrucutreList =
+        new LinkedList<ModelFeatureStructure>();
+
+      for (FeatureStructure structure : structres) {
+        if (structure.getType() == mCurrentType) {
+          featureStrucutreList.add(new ModelFeatureStructure(mDocument, structure));
+        }
+      }
+
+      Display.getDefault().syncExec(new Runnable() {
+        public void run() {
+          mFSList.add(featureStrucutreList.toArray());
+        }
+      });
+    }
+
+    @Override
     protected void removedAnnotation(Collection<AnnotationFS> annotations) {
 
       final LinkedList<ModelFeatureStructure> featureStrucutreList =
@@ -261,6 +279,24 @@
         }
       });
 
+    }
+
+    @Override
+    public void removed(Collection<FeatureStructure> structres) {
+      final LinkedList<ModelFeatureStructure> featureStrucutreList =
+        new LinkedList<ModelFeatureStructure>();
+
+      for (FeatureStructure structure : structres) {
+        if (structure.getType() == mCurrentType) {
+          featureStrucutreList.add(new ModelFeatureStructure(mDocument, structure));
+        }
+      }
+
+      Display.getDefault().syncExec(new Runnable() {
+        public void run() {
+          mFSList.remove(featureStrucutreList.toArray());
+        }
+      });
     }
 
     @Override