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

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

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

Line.getLineNumber介绍

[英]Get the line number. The last condition in following should always be true:

Line.Set lineSet =  
Line l =  
l.equals (lineSet.getCurrent (l.getLineNumber ()))

[中]获取行号。下面的最后一个条件应始终为真:

Line.Set lineSet =  
Line l =  
l.equals (lineSet.getCurrent (l.getLineNumber ()))

代码示例

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

public int getLineNo() {
  if (line == null) {
    return 0;
  }
  int lineNo = line.getLineNumber();
  // Editor numbers lines from 0!
  lineNo += 1;
  return lineNo;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javascript2-debug-ui

@Override
public int getLineNumber() {
  return line.getLineNumber() + 1;
}

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

/** Composes a human presentable name for the line. The default
* implementation uses the name of data object and the line number
* to create the display name.
*
* @return human presentable name that should identify the line
*/
public String getDisplayName() {
  return getClass().getName() + ":" + getLineNumber(); // NOI18N
}

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

/** Composes a human presentable name for the line. The default
* implementation uses the name of data object and the line number 
* to create the display name.
*
* @return human presentable name that should identify the line
*/
public String getDisplayName () {
  return getClass().getName() + ":" + getLineNumber(); // NOI18N
}

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

/** Composes a human presentable name for the line. The default
* implementation uses the name of data object and the line number 
* to create the display name.
*
* @return human presentable name that should identify the line
*/
public String getDisplayName () {
  return getClass().getName() + ":" + getLineNumber(); // NOI18N
}

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

/** Computes display name for a line produced
 * by this {@link CloneableEditorSupport#getLineSet }. The default
 * implementation reuses messageName and line number of the line.
 *
 * @param line the line object to compute display name for
 * @return display name for the line like "MyFile.java:243"
 *
 * @since 4.3
 */
protected String messageLine(Line line) {
  return NbBundle.getMessage(Line.class, "FMT_CESLineDisplayName", messageName(), line.getLineNumber() + 1);
}

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

private synchronized void update() {
  updatingLine = true;
  try {
    lb.setLineNumber(line.getLineNumber() + 1);
  } finally {
    updatingLine = false;
  }
}

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

private void update(Line l) {
  try {
    int ln;
    synchronized (this) {
      updatingLine = true;
      ln = l.getLineNumber() + 1;
    }
    lb.setLineNumber(ln);
  } finally {
    synchronized (this) {
      updatingLine = false;
    }
  }
}

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

private void update(Line l) {
  try {
    int ln;
    synchronized (this) {
      updatingLine = true;
      ln = l.getLineNumber() + 1;
    }
    lb.setLineNumber(ln);
  } finally {
    synchronized (this) {
      updatingLine = false;
    }
  }
}

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

/** Computes display name for a line produced
 * by this {@link CloneableEditorSupport#getLineSet }. The default
 * implementation reuses messageName and line number of the line.
 *
 * @param line the line object to compute display name for
 * @return display name for the line like "MyFile.java:243"
 *
 * @since 4.3
 */
protected String messageLine (Line line) {
  return NbBundle.getMessage(Line.class, 
    "FMT_CESLineDisplayName",
    messageName (),
    new Integer (line.getLineNumber () + 1) 
  );
}

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

/** Gets the lines with line number whitin the range inclusive.
 * @return <code>List</code> of lines from range inclusive */
private List<Line> getLinesFromRange(int startLineNumber, int endLineNumber) {
  List<Line> linesInRange = new ArrayList<Line>(10);
  synchronized (findWeakHashMap()) {
    for (Line line : findWeakHashMap().keySet()) {
      int lineNumber = line.getLineNumber();
      if ((startLineNumber <= lineNumber) && (lineNumber <= endLineNumber)) {
        linesInRange.add(line);
      }
    }
  }
  return linesInRange;
}

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

@Override
  public void run() {
    Line find = findLine(line);
    if (find != null) {
      ret[0] = listener.getOld(find.getLineNumber());
    } else {
      ret[0] =  -1;
    }
  }
};

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

public int getOriginalLineNumber (Line line) {
  Line find = findLine (line);
  if (find != null) {
    return listener.getOld (find.getLineNumber ());
  } else {
    return -1;
  }
}

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

public int getOriginalLineNumber (Line line) {
  Line find = findLine (line);
  if (find != null) {
    return listener.getOld (find.getLineNumber ());
  } else {
    return -1;
  }
}

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

public int indexOf(Object o) {
  if (o instanceof DocumentLine) {
    Line find = set.findLine((DocumentLine) o);
    if (find != null) {
      int indx = set.listener.getOld(find.getLineNumber());
      if (set.getOriginal(indx).equals(o)) {
        // just to verify that the index really exists
        return indx;
      }
    }
  }
  return -1;
}

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

public int indexOf (Object o) {
  if (o instanceof DocumentLine) {
    Line find = set.findLine ((DocumentLine)o);
    if (find != null) {
      int indx = set.listener.getOld (find.getLineNumber ());
      if (set.getOriginal (indx).equals (o)) {
        // just to verify that the index really exists
        return indx;
      }
    }
  }
  return -1;
}

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

public int indexOf (Object o) {
  if (o instanceof DocumentLine) {
    Line find = set.findLine ((DocumentLine)o);
    if (find != null) {
      int indx = set.listener.getOld (find.getLineNumber ());
      if (set.getOriginal (indx).equals (o)) {
        // just to verify that the index really exists
        return indx;
      }
    }
  }
  return -1;
}

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

/** Computes display name for a line based on the 
 * name of the associated DataObject and the line number.
 *
 * @param line the line object to compute display name for
 * @return display name for the line like "MyFile.java:243"
 *
 * @since 4.3
 */
protected String messageLine (Line line) {
  return NbBundle.getMessage(DataObject.class, "FMT_LineDisplayName2",
    obj.getPrimaryFile().getNameExt(),
    FileUtil.getFileDisplayName(obj.getPrimaryFile()),
    new Integer(line.getLineNumber() + 1));
}

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

@Override
public void run() {
  Line line = myPart.getLine();
  int startOffset = Utilities.getRowStartFromLineOffset(myDocument, 
      line.getLineNumber());
  myOffset = startOffset+myPart.getColumn();
}

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

@Override
  public void run() {
    int dot = comp.getCaret().getDot();
    Annotations annotations = ((BaseDocument) document).getAnnotations();
    Line line = NbEditorUtilities.getLine(document, dot, false);
    if (line == null) {
      return ;
    }
    int lineNumber = line.getLineNumber();
    AnnotationDesc  desc = annotations.getActiveAnnotation(lineNumber);
    values[0] = lineNumber;
    values[1] = desc;
  }
});

相关文章