org.openide.text.Annotation类的使用及代码示例

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

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

Annotation介绍

[英]Description of annotation. The class is extended by modules which creates annotations and defines annotation type and tooltip. The annotation can be attached to Annotatable object. Editors which displays Annotations listen on PropertyChangeListner for changes of annotation type or tooltip text. The tooltip text can be evaluated asynchronously. It means that editors after the getShortDescription call must listen on PropertyChangeListner while the tooltip is visible. If the tooltip text property is changed, the tooltip value must be updated.

See more - description of the way to declare an Annotation.
[中]注释说明。该类由创建注释并定义注释类型和工具提示的模块扩展。注释可以附着到可注释对象。显示注释的编辑器在PropertyChangeListner上侦听注释类型或工具提示文本的更改。可以异步计算工具提示文本。这意味着getShortDescription调用后的编辑器必须在工具提示可见时侦听PropertyChangeListner。如果更改了“工具提示文字”属性,则必须更新工具提示值。
请参阅更多-description of the way to declare an Annotation

代码示例

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-sun-appsrv81

/**
 * Detach error annotation.
 */
public void detachAnnotation() {
  if (errAnnot != null) {
    errAnnot.detach();
  }
}

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

/** Attach annotation to Annotatable object.
 * @param anno annotatable class to which this annotation will be attached */
public final void attach(Annotatable anno) {
  if (attached != null) {
    detach();
  }
  attached = anno;
  attached.addAnnotation(this);
  notifyAttached(attached);
}

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

/** Detach annotation.*/
public final void detach() {
  if (attached != null) {
    attached.removeAnnotation(this);
    Annotatable old = attached;
    attached = null;
    notifyDetached(old);
  }
}

代码示例来源: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.modules/org-netbeans-modules-tomcat5

errAnnot.detach();
errAnnot.attach(errorLine);
errAnnot.moveToFront();
errorLine.show(ShowOpenType.OPEN, ShowVisibilityType.NONE);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-insync

/**
 * Whenever the annotation is attached to the editor, listen for line edits so we can detach the
 * annotation.
 */
protected void notifyAttached(final Annotatable toAnno) {
  super.notifyAttached(toAnno);
  docline.addPropertyChangeListener(this);
}

代码示例来源:origin: hmvictor/radar-netbeans

public Annotation attachAnnotation(RadarIssue radarIssue, FileObject fileObject) throws DataObjectNotFoundException {
  Annotation ann = null;
  EditorCookie editorCookie = getEditorCookie(fileObject);
  if (editorCookie != null) {
    Line line = getLine(editorCookie);
    if (line != null) {
      ann = new SonarQubeEditorAnnotation(radarIssue.severityObject(), radarIssue.message());
      ann.attach(line);
    }
  }
  return ann;
}

代码示例来源: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.modules/org-netbeans-modules-j2ee-sun-appsrv81

errAnnot.detach();
errAnnot.attach(errorLine);
errAnnot.moveToFront();
errorLine.show(ShowOpenType.NONE, ShowVisibilityType.NONE);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-tomcat5

/**
 * Detach error annotation.
 */
public void detachAnnotation() {
  if (errAnnot != null) {
    errAnnot.detach();
  }
}

代码示例来源: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: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Attach annotation to Annotatable object.
 * @param anno annotatable class to which this annotation will be attached */
public final void attach(Annotatable anno) {
  if (attached != null)
    detach();
  
  attached = anno;
  
  attached.addAnnotation(this);
  notifyAttached(attached);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-insync

/**
 * Whenever the annotation is detached from the editor we can stop listening for line edits.
 */
protected void notifyDetached(Annotatable fromAnno) {
  super.notifyDetached(fromAnno);
  docline.removePropertyChangeListener(this);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projectsui

private void removeAnnotation(Annotation annotation) {
  synchronized (annotationToURLLock) {
    String url = annotationToURL.remove (annotation);
    //logger.severe("Removing "+annotation+", URL = "+url+", thread = "+Thread.currentThread().getId());
    //Thread.dumpStack();
    assert url != null;
  }
  annotation.detach ();
  
}

代码示例来源: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: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Attach annotation to Annotatable object.
 * @param anno annotatable class to which this annotation will be attached */
public final void attach(Annotatable anno) {
  if (attached != null)
    detach();
  
  attached = anno;
  
  attached.addAnnotation(this);
  notifyAttached(attached);
}

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

/** Detach annotation.*/
public final void detach() {
  if (attached != null)
  {
    attached.removeAnnotation(this);
    Annotatable old = attached;
    attached = null;
    notifyDetached(old);
  }
}

代码示例来源:origin: dcaoyuan/nbscala

private void removeAnnotations(JPDABreakpoint b) {
  Annotation[] annotations = breakpointToAnnotations.remove(b);
  if (annotations == null) return ;
  for (Annotation a : annotations) {
    a.detach();
  }
}

代码示例来源: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: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Detach annotation.*/
public final void detach() {
  if (attached != null)
  {
    attached.removeAnnotation(this);
    Annotatable old = attached;
    attached = null;
    notifyDetached(old);
  }
}

相关文章