public void run() { try { synchronized (getAnnotations()) { if (!anno.isInDocument()) { anno.setInDocument(true); NbDocument.addAnnotation(doc, position.getPosition(), length, anno); } } } catch (IOException ex) { Logger.getLogger(DocumentLine.class.getName()).log(Level.WARNING, null, ex); } } });
@Override public void addError(CsmErrorInfo info) { if (interrupter.cancelled()) { return; } PositionBounds pb = createPositionBounds(dao, info.getStartOffset(), info.getEndOffset()); ErrorDescription desc = null; if( pb != null ) { try { desc = ErrorDescriptionFactory.createErrorDescription( getSeverity(info), info.getMessage(), doc, pb.getBegin().getPosition(), pb.getEnd().getPosition()); } catch (IOException ioe) { Exceptions.printStackTrace(ioe); } descriptions.add(desc); if (TRACE_ANNOTATIONS) System.err.printf("\tadded to a bag %s\n", desc.toString()); } else { if (TRACE_ANNOTATIONS) System.err.printf("\tCan't create PositionBounds for %s\n", info); } } @Override
public void run() { try { synchronized (getAnnotations()) { if (!anno.isInDocument()) { anno.setInDocument(true); // #33165 - find position that is surely at begining of line FindAnnotationPosition fap = new FindAnnotationPosition(doc, pos.getPosition()); doc.render(fap); NbDocument.addAnnotation(doc, fap.getAnnotationPosition(), -1, anno); } } } catch (IOException ex) { Logger.getLogger(DocumentLine.class.getName()).log(Level.WARNING, null, ex); } } });
/** When document is opened or closed the annotations must be added or * removed.*/ void attachDetachAnnotations(StyledDocument doc, boolean closing) { List<? extends Annotation> list = getAnnotations(); synchronized(list) { for (Annotation anno : list) { if (!closing) { try { if (!anno.isInDocument()) { anno.setInDocument(true); NbDocument.addAnnotation(doc, position.getPosition(), getLength(), anno); } } catch (IOException ex) { Logger.getLogger(DocumentLine.class.getName()).log(Level.WARNING, null, ex); } } else { if (anno.isInDocument()) { anno.setInDocument(false); NbDocument.removeAnnotation(doc, anno); } } } } }
/** When document is opened or closed the annotations must be added or * removed.*/ void attachDetachAnnotations(StyledDocument doc, boolean closing) { java.util.List list = getAnnotations(); for (int i=0; i<list.size(); i++) { Annotation anno = (Annotation)list.get(i); if (!closing) { try { if (!anno.isInDocument()) { anno.setInDocument(true); NbDocument.addAnnotation (doc, position.getPosition(), getLength(), anno); } } catch (IOException ex) { ErrorManager.getDefault ().notify ( ErrorManager.EXCEPTION, ex); } } else { if (anno.isInDocument()) { anno.setInDocument(false); NbDocument.removeAnnotation(doc, anno); } } } }
/** When document is opened or closed the annotations must be added or * removed.*/ void attachDetachAnnotations(StyledDocument doc, boolean closing) { java.util.List list = getAnnotations(); for (int i=0; i<list.size(); i++) { Annotation anno = (Annotation)list.get(i); if (!closing) { try { if (!anno.isInDocument()) { anno.setInDocument(true); NbDocument.addAnnotation (doc, position.getPosition(), getLength(), anno); } } catch (IOException ex) { ErrorManager.getDefault ().notify ( ErrorManager.EXCEPTION, ex); } } else { if (anno.isInDocument()) { anno.setInDocument(false); NbDocument.removeAnnotation(doc, anno); } } } }
annoPos = pos.getPosition();
if (!closing) { try { annoPos = pos.getPosition(); FindAnnotationPosition fap = new FindAnnotationPosition(doc, annoPos); doc.render(fap);
if (!closing) { try { annoPos = pos.getPosition(); FindAnnotationPosition fap = new FindAnnotationPosition(doc, annoPos); doc.render(fap);
p = pos.getPosition(); } catch (IOException ex) { Logger.getLogger(DocumentLine.class.getName()).log(Level.WARNING, null, ex); if (annos.size() > 0) { try { p = pos.getPosition(); } catch (IOException e) { throw new IllegalArgumentException(); // should not fail
p = pos.getPosition(); } catch (IOException ex) { ErrorManager.getDefault ().notify ( ErrorManager.EXCEPTION, ex); if (annosSize > 0) { try { p = pos.getPosition(); } catch (IOException e) { throw new IllegalArgumentException(); // should not fail
p = pos.getPosition(); } catch (IOException ex) { ErrorManager.getDefault ().notify ( ErrorManager.EXCEPTION, ex); if (annosSize > 0) { try { p = pos.getPosition(); } catch (IOException e) { throw new IllegalArgumentException(); // should not fail
/** Add annotation to this Annotatable class * @param anno annotation which will be attached to this class */ protected void addAnnotation(Annotation anno) { super.addAnnotation(anno); StyledDocument doc = position.getCloneableEditorSupport ().getDocument (); // document is not opened and so the annotation will be added to document later if (doc == null) return; position.getCloneableEditorSupport().prepareDocument().waitFinished(); try { if (!anno.isInDocument()) { anno.setInDocument(true); NbDocument.addAnnotation(doc, position.getPosition(), length, anno); } } catch (IOException ex) { ErrorManager.getDefault ().notify ( ErrorManager.EXCEPTION, ex); } }
/** Add annotation to this Annotatable class * @param anno annotation which will be attached to this class */ protected void addAnnotation(Annotation anno) { super.addAnnotation(anno); StyledDocument doc = position.getCloneableEditorSupport ().getDocument (); // document is not opened and so the annotation will be added to document later if (doc == null) return; position.getCloneableEditorSupport().prepareDocument().waitFinished(); try { if (!anno.isInDocument()) { anno.setInDocument(true); NbDocument.addAnnotation(doc, position.getPosition(), length, anno); } } catch (IOException ex) { ErrorManager.getDefault ().notify ( ErrorManager.EXCEPTION, ex); } }
/** Add annotation to this Annotatable class * @param anno annotation which will be attached to this class */ protected void addAnnotation(Annotation anno) { super.addAnnotation(anno); StyledDocument doc = pos.getCloneableEditorSupport ().getDocument (); // document is not opened and so the annotation will be added to document later if (doc == null) return; pos.getCloneableEditorSupport().prepareDocument().waitFinished(); try { if (!anno.isInDocument()) { anno.setInDocument(true); // #33165 - find position that is surely at begining of line FindAnnotationPosition fap = new FindAnnotationPosition(doc, pos.getPosition()); doc.render(fap); NbDocument.addAnnotation (doc, fap.getAnnotationPosition(), -1, anno); } } catch (IOException ex) { ErrorManager.getDefault ().notify ( ErrorManager.EXCEPTION, ex); } }
/** Add annotation to this Annotatable class * @param anno annotation which will be attached to this class */ protected void addAnnotation(Annotation anno) { super.addAnnotation(anno); StyledDocument doc = pos.getCloneableEditorSupport ().getDocument (); // document is not opened and so the annotation will be added to document later if (doc == null) return; pos.getCloneableEditorSupport().prepareDocument().waitFinished(); try { if (!anno.isInDocument()) { anno.setInDocument(true); // #33165 - find position that is surely at begining of line FindAnnotationPosition fap = new FindAnnotationPosition(doc, pos.getPosition()); doc.render(fap); NbDocument.addAnnotation (doc, fap.getAnnotationPosition(), -1, anno); } } catch (IOException ex) { ErrorManager.getDefault ().notify ( ErrorManager.EXCEPTION, ex); } }