X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fworkers%2FAnnotationWorker.java;h=98e26b38fada92e5cb1539b7dc12588d9eb16d3e;hb=6a6fb5010c2cd06b14a1e055eabaeb4848e65d2d;hp=8f37f15e7377bba0153d42203846bee11bab188c;hpb=b13d4ee2f7839be680d23ce157aff4e204377a8f;p=jalview.git diff --git a/src/jalview/workers/AnnotationWorker.java b/src/jalview/workers/AnnotationWorker.java index 8f37f15..98e26b3 100644 --- a/src/jalview/workers/AnnotationWorker.java +++ b/src/jalview/workers/AnnotationWorker.java @@ -59,63 +59,41 @@ class AnnotationWorker extends AlignCalcWorker @Override public void run() { - try + if (alignViewport.isClosed()) { - calcMan.notifyStart(this); - - while (!calcMan.notifyWorking(this)) - { - try - { - Thread.sleep(200); - } catch (InterruptedException ex) - { - ex.printStackTrace(); - } - } - if (alignViewport.isClosed()) - { - abortAndDestroy(); - return; - } + abortAndDestroy(); + return; + } - // removeAnnotation(); + // removeAnnotation(); AlignmentI alignment = alignViewport.getAlignment(); - if (alignment != null) + if (alignment != null) + { + try { - try + List anns = counter.calculateAnnotation( + alignment, new FeatureRenderer(alignViewport)); + for (AlignmentAnnotation ann : anns) { - List anns = counter.calculateAnnotation( - alignment, new FeatureRenderer(alignViewport)); - for (AlignmentAnnotation ann : anns) + AlignmentAnnotation theAnn = alignment.findOrCreateAnnotation( + ann.label, ann.description, false, null, null); + theAnn.showAllColLabels = true; + theAnn.graph = AlignmentAnnotation.BAR_GRAPH; + theAnn.scaleColLabel = true; + theAnn.annotations = ann.annotations; + setGraphMinMax(theAnn, theAnn.annotations); + theAnn.validateRangeAndDisplay(); + if (!ourAnnots.contains(theAnn)) { - AlignmentAnnotation theAnn = alignment.findOrCreateAnnotation( - ann.label, ann.description, false, null, null); - theAnn.showAllColLabels = true; - theAnn.graph = AlignmentAnnotation.BAR_GRAPH; - theAnn.scaleColLabel = true; - theAnn.annotations = ann.annotations; - setGraphMinMax(theAnn, theAnn.annotations); - theAnn.validateRangeAndDisplay(); - if (!ourAnnots.contains(theAnn)) - { - ourAnnots.add(theAnn); - } - // alignment.addAnnotation(ann); + ourAnnots.add(theAnn); } - } catch (IndexOutOfBoundsException x) - { - // probable race condition. just finish and return without any fuss. - return; + // alignment.addAnnotation(ann); } + } catch (IndexOutOfBoundsException x) + { + // probable race condition. just finish and return without any fuss. + return; } - } catch (OutOfMemoryError error) - { - ap.raiseOOMWarning("calculating annotations", error); - calcMan.disableWorker(this); - } finally - { - calcMan.workerComplete(this); } if (ap != null)