org.openide.text.Annotation.setInDocument()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中org.openide.text.Annotation.setInDocument()方法的一些代码示例,展示了Annotation.setInDocument()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotation.setInDocument()方法的具体详情如下:
包路径:org.openide.text.Annotation
类名称:Annotation
方法名:setInDocument

Annotation.setInDocument介绍

[英]Setter for the inDocument property
[中]inDocument属性的Setter

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-text

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);
    }
  }
});

代码示例来源:origin: org.netbeans.api/org-openide-text

public void run() {
    synchronized (getAnnotations()) {
      if (anno.isInDocument()) {
        anno.setInDocument(false);
        NbDocument.removeAnnotation(doc, anno);
      }
    }
  }
});

代码示例来源:origin: org.netbeans.api/org-openide-text

public void run() {
    synchronized (getAnnotations()) {
      if (anno.isInDocument()) {
        anno.setInDocument(false);
        NbDocument.removeAnnotation(doc, anno);
      }
    }
  }
});

代码示例来源:origin: org.netbeans.api/org-openide-text

/** 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);
        }
      }
    }
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-text

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);
    }
  }
});

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** 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);
      }
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** 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);
      }
    }
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-text

if (!closing) {
  if (!anno.isInDocument()) {
    anno.setInDocument(true);
    NbDocument.addAnnotation(doc, annoPos, -1, anno);
    anno.setInDocument(false);
    NbDocument.removeAnnotation(doc, anno);

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

if (!closing) {
  if (!anno.isInDocument()) {
    anno.setInDocument(true);
    NbDocument.addAnnotation (doc, annoPos, -1, anno);
    anno.setInDocument(false);
    NbDocument.removeAnnotation(doc, anno);

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

if (!closing) {
  if (!anno.isInDocument()) {
    anno.setInDocument(true);
    NbDocument.addAnnotation (doc, annoPos, -1, anno);
    anno.setInDocument(false);
    NbDocument.removeAnnotation(doc, anno);

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Remove annotation to this Annotatable class
 * @param anno annotation which will be detached from this class  */
protected void removeAnnotation(Annotation anno) {
  super.removeAnnotation(anno);
  StyledDocument doc = pos.getCloneableEditorSupport ().getDocument ();
  
  // document is not opened and so no annotation is attached to it
  if (doc == null)
    return;
  pos.getCloneableEditorSupport().prepareDocument().waitFinished();
  if (anno.isInDocument()) {
    anno.setInDocument(false);
    NbDocument.removeAnnotation(doc, anno);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Remove annotation to this Annotatable class
 * @param anno annotation which will be detached from this class  */
protected void removeAnnotation(Annotation anno) {
  super.removeAnnotation(anno);
  StyledDocument doc = position.getCloneableEditorSupport ().getDocument ();
  // document is not opened and so no annotation is attached to it
  if (doc == null)
    return;
  position.getCloneableEditorSupport().prepareDocument().waitFinished();
  if (anno.isInDocument()) {
    anno.setInDocument(false);
    NbDocument.removeAnnotation(doc, anno);
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-text

anno.setInDocument(false);
NbDocument.removeAnnotation(support.getDocument(), anno);
anno.setInDocument(true);
NbDocument.addAnnotation(support.getDocument(), p, -1, anno);

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Remove annotation to this Annotatable class
 * @param anno annotation which will be detached from this class  */
protected void removeAnnotation(Annotation anno) {
  super.removeAnnotation(anno);
  StyledDocument doc = pos.getCloneableEditorSupport ().getDocument ();
  
  // document is not opened and so no annotation is attached to it
  if (doc == null)
    return;
  pos.getCloneableEditorSupport().prepareDocument().waitFinished();
  if (anno.isInDocument()) {
    anno.setInDocument(false);
    NbDocument.removeAnnotation(doc, anno);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Remove annotation to this Annotatable class
 * @param anno annotation which will be detached from this class  */
protected void removeAnnotation(Annotation anno) {
  super.removeAnnotation(anno);
  StyledDocument doc = position.getCloneableEditorSupport ().getDocument ();
  // document is not opened and so no annotation is attached to it
  if (doc == null)
    return;
  position.getCloneableEditorSupport().prepareDocument().waitFinished();
  if (anno.isInDocument()) {
    anno.setInDocument(false);
    NbDocument.removeAnnotation(doc, anno);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

Annotation anno = (Annotation)annos.get(i);
if (anno.isInDocument()) {
  anno.setInDocument(false);
  NbDocument.removeAnnotation(support.getDocument(), anno);
  anno.setInDocument(true);
  NbDocument.addAnnotation (support.getDocument(), p, -1, anno);

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** 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);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** 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);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** 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);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** 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);
  }
}

相关文章