\r
public abstract void setName(TaxonNameBase name);\r
\r
- protected void calculateErrors() {\r
+ synchronized protected void calculateErrors() {\r
textViewer.clearErrors();\r
\r
TaxonNameBase name = getParsedName() != null ? getParsedName() : getName();\r
\r
- textViewer.setShowParsingErrors(name);\r
+// textViewer.setShowParsingErrors(name);\r
+ textViewer.setShowParsingError(name);\r
}\r
\r
protected void handleSplitText(String text) {\r
\r
// testMarkers();\r
\r
+ if (0 == 0) {\r
+ return;\r
+ }\r
+ \r
for (ParserProblem problem : name.getParsingProblems()) {\r
\r
// boolean hasProblem = name.getHasProblem();\r
}\r
\r
Annotation annotation = null;\r
- if (problem.isWarning()) {\r
- annotation = new WarningAnnotation(0, problem.toString());\r
- }\r
-// if (problem.isError()) {\r
-// annotation = new ErrorAnnotation(0, problem.toString());\r
+// if (problem.isWarning()) {\r
+// annotation = new WarningAnnotation(0, problem.toString());\r
// }\r
+ if (problem.isError()) {\r
+ annotation = new ErrorAnnotation(0, problem.toString());\r
+ }\r
\r
this.getAnnotationModel().addAnnotation(\r
annotation, \r
}\r
}\r
\r
+ public void setShowParsingError(TaxonNameBase<?, ?> name) {\r
+ \r
+// testMarkers();\r
+ \r
+ if (!name.hasProblem()) {\r
+ logger.debug(name.getProblemStarts());\r
+ }\r
+ \r
+ String text = this.getTextWidget().getText();\r
+ \r
+ if (name.hasProblem() && text.length() > 0) {\r
+// logger.warn("Name: " + name.getTitleCache() + ", start: " + name.getProblemStarts()+ ", end: " + name.getProblemEnds());\r
+ int start = name.getProblemStarts();\r
+ int length = name.getProblemEnds() - start;\r
+ \r
+ if (start == -1 || name.getProblemEnds() == -1) {\r
+// logger.warn("Start: " + start + ", End " + name.getProblemEnds());\r
+ return;\r
+ }\r
+ \r
+ // Don't let squigglies try to draw beyond the end of the text\r
+ if (text.length() < start + length) {\r
+ length = text.length() - start;\r
+ }\r
+ \r
+ this.getAnnotationModel().addAnnotation(\r
+ new ErrorAnnotation(0, "Error parsing string '" + text + "'"), \r
+ new Position(start, length));\r
+ }\r
+ }\r
+ \r
public void setShowSecError(Taxon taxon) {\r
\r
// If taxon has no sec, show an annotation\r