super(parent, null, SWT.WRAP | SWT.MULTI | SWT.RESIZE);\r
\r
// Set name viewer's text to name cache\r
- this.setDocument(new NameViewerDocument(""), new AnnotationModel());\r
+ AnnotationModel model = new AnnotationModel();\r
+ NameViewerDocument document = new NameViewerDocument("");\r
+ this.setDocument(document, model);\r
+// model.connect(document);\r
\r
// Lay out StyledText\r
StyledText textWidget = this.getTextWidget();\r
\r
this.addPainter(annotationPainter);\r
\r
- this.getTextWidget().getLineCount();\r
- \r
// DocumentUndoManagerRegistry.connect(this.getDocument());\r
// IDocumentUndoManager docUndoManager = DocumentUndoManagerRegistry.getDocumentUndoManager(this.getDocument());\r
\r
\r
}\r
\r
+ /**\r
+ * NOTE: possible solution to problem of one-lined red squigglies:\r
+ * AnnotationPainter uses an internal SquigglesStrategy which draws a \r
+ * polyline consisting of diagonal lines; this assumes one line;\r
+ * re-program to catch more than one lines, using \r
+ * this.getTextWidget().getLocationAtOffset to find linecount.\r
+ * \r
+ * @param hasProblem\r
+ */\r
public void setShowError(boolean hasProblem) {\r
- \r
+ \r
String text = this.getTextWidget().getText();\r
\r
+ logger.warn(this.getTextWidget().getBaseline(0));\r
+ logger.warn(this.getTextWidget().getLocationAtOffset(60));\r
+ \r
+ if (text.length() > 0) {\r
+ logger.warn(this.getTextWidget().getTextBounds(0, text.length()));\r
+ }\r
+ \r
Iterator<Annotation> annotations = this.getAnnotationModel().getAnnotationIterator();\r
while (annotations.hasNext()) {\r
Annotation annotation = annotations.next(); \r
if (annotation.getType().equals(ErrorAnnotation.ERROR_TYPE))\r
+ annotation.markDeleted(true);\r
this.getAnnotationModel().removeAnnotation(annotation);\r
}\r
\r
if (hasProblem && text.length() > 0) {\r
+// this.getAnnotationModel().addAnnotation(\r
+// new ErrorAnnotation(0, text), \r
+// new Position(0, text.length()));\r
+// this.getAnnotationModel().addAnnotation(\r
+// new ErrorAnnotation(0, text), \r
+// new Position(0, 40));\r
this.getAnnotationModel().addAnnotation(\r
- new ErrorAnnotation(0, "Could not parse."), \r
- new Position(0, text.length()));\r
+ new ErrorAnnotation(0, text), \r
+ new Position(39, text.length())); \r
+ \r
}\r
- \r
-// ILineTracker tracker = ((NameViewerDocument) this.getDocument()).getTracker();\r
-// tracker.\r
}\r
\r
public void setLineBreakListener(LineBreakListener lineBreakListener) {\r
}\r
}\r
}\r
+ \r
+// public boolean isMultiLine(Annotation annotation) {\r
+// return true;\r
+// }\r
}\r