JAL-2068 deleting user-defined annotation removes the worker
[jalview.git] / src / jalview / workers / AnnotationWorker.java
index fbf7531..901b6fc 100644 (file)
@@ -31,8 +31,8 @@ import java.util.List;
 
 /**
  * A class to create and update one or more alignment annotations, given a
- * 'calculator'.
- * 
+ * 'calculator'. Intended to support a 'plug-in' annotation worker which
+ * implements the AnnotationProviderI interface.
  */
 class AnnotationWorker extends AlignCalcWorker
 {
@@ -102,7 +102,7 @@ class AnnotationWorker extends AlignCalcWorker
     } catch (OutOfMemoryError error)
     {
       ap.raiseOOMWarning("calculating annotations", error);
-      calcMan.workerCannotRun(this);
+      calcMan.disableWorker(this);
     } finally
     {
       calcMan.workerComplete(this);
@@ -133,4 +133,15 @@ class AnnotationWorker extends AlignCalcWorker
   {
     // do nothing
   }
+
+  /**
+   * Answers true to indicate that if this worker's annotation is deleted from
+   * the display, the worker should also be removed. This prevents it running
+   * and recreating the annotation when the alignment changes.
+   */
+  @Override
+  public boolean isDeletable()
+  {
+    return true;
+  }
 }