本文整理了Java中org.openide.text.Line.addAnnotation()
方法的一些代码示例,展示了Line.addAnnotation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Line.addAnnotation()
方法的具体详情如下:
包路径:org.openide.text.Line
类名称:Line
方法名:addAnnotation
暂无
代码示例来源:origin: org.netbeans.api/org-openide-text
/** Add annotation to this Annotatable class
* @param anno annotation which will be attached to this class */
@Override
protected void addAnnotation(final Annotation anno) {
super.addAnnotation(anno);
final 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();
doc.render(new Runnable() {
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.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);
}
}
内容来源于网络,如有侵权,请联系作者删除!