org.netbeans.editor.Utilities.getRowStart()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(117)

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

Utilities.getRowStart介绍

[英]Get the starting position of the row.
[中]获取行的起始位置。

代码示例

代码示例来源:origin: net.java.abeille/abeille

public int adjustLimitPos(BaseDocument doc, int limitPos) {
  origLimitPos = limitPos;
  try {
    return Utilities.getRowStart(doc, limitPos);
  } catch (BadLocationException e) {
    return limitPos;
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

public int adjustLimitPos(BaseDocument doc, int limitPos) {
  origLimitPos = limitPos;
  try {
    return Utilities.getRowStart(doc, limitPos);
  } catch (BadLocationException e) {
    return limitPos;
  }
}

代码示例来源:origin: net.java.abeille/abeille

public int adjustStartPos(BaseDocument doc, int startPos) {
  origStartPos = startPos;
  try {
    return Utilities.getRowStart(doc, startPos);
  } catch (BadLocationException e) {
    return startPos;
  }
}

代码示例来源:origin: net.java.abeille/abeille

public int adjustStartPos(BaseDocument doc, int startPos) {
  origStartPos = startPos;
  try {
    return Utilities.getRowStart(doc, startPos);
  } catch (BadLocationException e) {
    return startPos;
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

public int adjustStartPos(BaseDocument doc, int startPos) {
  origStartPos = startPos;
  try {
    return Utilities.getRowStart(doc, startPos);
  } catch (BadLocationException e) {
    return startPos;
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

/** Get the starting position of the row.
* @param doc document to operate on
* @param offset position in document where to start searching
* @return position of the start of the row or -1 for invalid position
*/
public static int getRowStart(BaseDocument doc, int offset)
throws BadLocationException {
  return getRowStart(doc, offset, 0);
}

代码示例来源:origin: net.java.abeille/abeille

/**
 * Get the starting position of the row.
 * 
 * @param c
 *            text component to operate on
 * @param offset
 *            position in document where to start searching
 * @return position of the start of the row or -1 for invalid position
 */
public static int getRowStart(JTextComponent c, int offset) throws BadLocationException {
  return getRowStart((BaseDocument) c.getDocument(), offset, 0);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-spellchecker-bindings-htmlxml

public void setStartOffset(int offset) {
  currentWord = null;
  currentStartOffset = (-1);
  this.ignoreBefore = offset;
  try {
    this.nextSearchOffset = Utilities.getRowStart(doc, offset);
  } catch (BadLocationException ex) {
    Logger.getLogger(AbstractTokenList.class.getName()).log(Level.FINE, null, ex);
    this.nextSearchOffset = offset;
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-spellchecker-bindings-properties

public void setStartOffset (int offset) {
  currentWord = null;
  currentStartOffset = (-1);
  this.ignoreBefore = offset;
  try {
    this.nextSearchOffset = Utilities.getRowStart (doc, offset);
  } catch (BadLocationException ex) {
    Logger.getLogger (AbstractTokenList.class.getName ()).log (Level.FINE, null, ex);
    this.nextSearchOffset = offset;
  }
}

代码示例来源:origin: net.java.abeille/abeille

public static int getFirstNonEmptyRow(BaseDocument doc, int offset, boolean downDir) throws BadLocationException {
  while (offset != -1 && isRowEmpty(doc, offset)) {
    offset = getRowStart(doc, offset, downDir ? +1 : -1);
  }
  return offset;
}

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

private boolean allComments(BaseDocument doc, int startOffset, int lineCount) throws BadLocationException {
  for (int offset = startOffset; lineCount > 0; lineCount--) {
    int firstNonWhitePos = Utilities.getRowFirstNonWhite(doc, offset);
    if (firstNonWhitePos != -1) { // Ignore empty lines
      if (!isLineCommented(doc, firstNonWhitePos)) {
        return false;
      }
    }
    
    offset = Utilities.getRowStart(doc, offset, +1);
  }
  return true;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

/** Reformat the line around the given position. */
public static void reformatLine(BaseDocument doc, int pos)
throws BadLocationException {
  int lineStart = getRowStart(doc, pos);
  int lineEnd = getRowEnd(doc, pos);
  reformat(doc, lineStart, lineEnd);
}

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

public static String getLine(final JTextComponent component, final int offset) {
    final BaseDocument workingDocument=org.netbeans.editor.Utilities.getDocument(component);
    try {
      final int lineStartOffset = org.netbeans.editor.Utilities.getRowStart(workingDocument, offset);
      final int lineEndOffset = org.netbeans.editor.Utilities.getRowEnd(workingDocument, offset);
      return String.valueOf(workingDocument.getChars(lineStartOffset, lineEndOffset - lineStartOffset));
    } catch (BadLocationException ble) {
      return "";
    }
  }
}

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

private void modifyUnderWriteLock(Context context) {
  try {
    context.modifyIndent(Utilities.getRowStart((BaseDocument) context.document(), context.caretOffset()), indentation);
  } catch (BadLocationException ex) {
    Exceptions.printStackTrace(ex);
  }
}

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

public static String getLine(final JTextComponent component, final int offset) {
  final BaseDocument workingDocument = org.netbeans.editor.Utilities.getDocument(component);
  try {
    final int lineStartOffset = org.netbeans.editor.Utilities.getRowStart(workingDocument, offset);
    final int lineEndOffset = org.netbeans.editor.Utilities.getRowEnd(workingDocument, offset);
    return String.valueOf(workingDocument.getChars(lineStartOffset, lineEndOffset - lineStartOffset));
  } catch (BadLocationException ble) {
    return "";
  }
}

代码示例来源:origin: net.java.abeille/abeille

/** Toggle the bookmark for the current line */
public boolean toggleBookmark(int pos) throws BadLocationException {
  pos = Utilities.getRowStart(this, pos);
  boolean marked = bookmarkChain.toggleMark(pos);
  BaseDocumentEvent evt = createDocumentEvent(pos, 0, DocumentEvent.EventType.CHANGE);
  fireChangedUpdate(evt);
  return marked;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

/** Toggle the bookmark for the current line */
public boolean toggleBookmark(int pos) throws BadLocationException {
  pos = Utilities.getRowStart(this, pos);
  boolean marked = bookmarkChain.toggleMark(pos);
  BaseDocumentEvent evt = createDocumentEvent(pos, 0, DocumentEvent.EventType.CHANGE);
  fireChangedUpdate(evt);
  return marked;
}

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

public void run() {
    try {
      final int start=Utilities.getRowStart(doc,offset);
      final int end=Utilities.getRowEnd(doc,offset);
      doc.remove(start,end-start+1);
    } catch (BadLocationException ble) {
      ErrorManager.getDefault().notify(ble);
    }
    RecommentAction.actionPerformed(doc);
  }
});

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

@Override
public void implement() throws Exception {
  int templateOffset = getOffset();
  EditList edits = new EditList(doc);
  edits.replace(templateOffset, oldName.toString().length(), getGeneratedCode(), true, 0); //NOI18N
  edits.apply();
  UiUtils.open(scope.getFileObject(), Utilities.getRowStart(doc, templateOffset));
}

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

@Override
public void implement() throws Exception {
  int templateOffset = getOffset();
  EditList edits = new EditList(doc);
  edits.replace(templateOffset, 0, "\n" + getGeneratedCode(), true, 0); //NOI18N
  edits.apply();
  UiUtils.open(scope.getFileObject(), Utilities.getRowStart(doc, getOffsetRange().getEnd()));
}

相关文章

微信公众号

最新文章

更多