org.openide.cookies.EditorCookie.getLineSet()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(88)

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

EditorCookie.getLineSet介绍

暂无

代码示例

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

public Line.Set getLineSet() {
  return currentEditorCookie().getLineSet();
}

代码示例来源:origin: org.codehaus.mevenide/nb-project

/** Called when some sort of action is performed on a line.
 * @param ev the event describing the line
 */
public void outputLineAction(OutputEvent ev) {
  cookie.getLineSet().getCurrent(line).show(Line.SHOW_GOTO);
}

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

public Line getLine(EditorCookie editorCookie) {
  Line.Set lineSet = editorCookie.getLineSet();
  int effectiveLineNumber = getLineNumber() <= 0 ? 1 : getLineNumber();
  int index = Math.min(effectiveLineNumber, lineSet.getLines().size()) - 1;
  return lineSet.getCurrent(index);
}

代码示例来源:origin: org.codehaus.mevenide/nb-project

private static void attachAllInFile(EditorCookie cook, CompileAnnotation annot) {
  Set<CompileAnnotation> newSet = null;
  synchronized (hyperlinks) {
    newSet = new HashSet<CompileAnnotation>(hyperlinks);
  }
  Iterator it = newSet.iterator();
  while (it.hasNext()) {
    CompileAnnotation ann = (CompileAnnotation)it.next();
    if (ann.getFile().equals(annot.getFile())) {
      if (ann.getLine() != -1) {
        Line l = cook.getLineSet().getOriginal(ann.getLine() - 1);
        if (! l.isDeleted()) {
          ann.attachAsNeeded(l);
        }
      }
      
    }
  }
}

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

@Override
  public void run() {
    try {
      EditorCookie ed = dob.getLookup().lookup(EditorCookie.class);
      if (ed != null && /* not true e.g. for *_ja.properties */
          file == dob.getPrimaryFile()) {
        if (lineNum == -1) {
          // OK, just open it.
          ed.open();
        } else {
          ed.openDocument();//XXX getLineSet doesn't do it for you
          try {
            Line l = ed.getLineSet().getOriginal(lineNum - 1);
            if (!l.isDeleted()) {
              l.show(ShowOpenType.OPEN, ShowVisibilityType.FOCUS);
            }
          } catch (IndexOutOfBoundsException ioobe) {
            // Probably harmless. Bogus line number.
            ed.open();
          }
        }
      } else {
        java.awt.Toolkit.getDefaultToolkit().beep();
      }
    } catch (Exception ex2) {
      // XXX see above, should not be necessary to call openDocument
      // at all
    }
  }
});

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

Line.Set lineSet = editorCookie.getLineSet();
int line = doc.getParagraphElement(0).getParentElement().getElementIndex(position);
lineObj = lineSet.getCurrent(line);

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

Line errorLine = null;
try {
  errorLine = editorCookie.getLineSet().getCurrent(line - 1);
} catch (IndexOutOfBoundsException iobe) {
  return;

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-java-testrunner-ui

Line l = ed.getLineSet().getOriginal(lineNum - 1);
if (!l.isDeleted()) {
  if (columnNum != Integer.MIN_VALUE) {

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

ed.openDocument();
try {
  Line l = ed.getLineSet().getOriginal(lineNum - 1);
  if (! l.isDeleted()) {
    l.show(Line.ShowOpenType.REUSE, Line.ShowVisibilityType.FOCUS);

代码示例来源:origin: org.codehaus.mevenide/nb-project

ed.openDocument();
try {
  Line l = ed.getLineSet().getOriginal(lineNum - 1);
  if (! l.isDeleted()) {
    l.show(Line.SHOW_GOTO);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

public static Line getCurrentLine() {
EditorCookie e = getCurrentEditorCookie();
if (e == null)
  return null;
JEditorPane ep = getCurrentEditor(e);
if (ep == null)
  return null;
StyledDocument d = e.getDocument();
if (d == null)
  return null;
int lineNo = NbDocument.findLineNumber(d, ep.getCaret().getDot());
// Editor numbers lines from 0!
Line l = null;
try {
  l = e.getLineSet().getCurrent(lineNo + 1);
} catch (IndexOutOfBoundsException x) {
  // 6494346
}
return l;
}

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

Line errorLine = null;
try {
  errorLine = editorCookie.getLineSet().getCurrent(line - 1);
} catch (IndexOutOfBoundsException iobe) {
  return;

相关文章