org.eclipse.jface.text.Position.setOffset()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(118)

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

Position.setOffset介绍

[英]Changes the offset of this position to the given offset.
[中]将此位置的偏移更改为给定偏移。

代码示例

代码示例来源:origin: org.eclipse.xtext/ui

@Override
public void setOffset(int offset) {
  synchronized (fLock) {
    super.setOffset(offset);
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.text

/**
 * Sets the completion offset.
 *
 * @param newOffset the new completion offset
 */
protected void setCompletionOffset(int newOffset) {
  fOriginalOffset= newOffset;
  fPosition.setOffset(newOffset);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * Manipulates the offset of the referenced position.
 *
 * @param offset the new offset of the referenced position
 */
protected void setOffset(int offset) {
  fPosition.setOffset(offset);
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

public void setOffset(int offset) {
  synchronized (fLock) {
    super.setOffset(offset);
  }
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core.manipulation

@Override
public void setOffset(int offset) {
  synchronized (fLock) {
    super.setOffset(offset);
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

/**
 * Manipulates the offset of the referenced position.
 *
 * @param offset the new offset of the referenced position
 */
protected void setOffset(int offset) {
  fPosition.setOffset(offset);
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.text

/**
 * Sets the completion offset.
 *
 * @param newOffset the new completion offset
 */
protected void setCompletionOffset(int newOffset) {
  fOriginalOffset= newOffset;
  fPosition.setOffset(newOffset);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

@Override
public void setOffset(int offset) {
  synchronized (fLock) {
    super.setOffset(offset);
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

public void update(int off, int len) {
  synchronized (fLock) {
    super.setOffset(off);
    super.setLength(len);
  }
}

代码示例来源:origin: org.eclipse.xtext/ui

public void update(int off, int len) {
  synchronized (fLock) {
    super.setOffset(off);
    super.setLength(len);
  }
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core.manipulation

public void update(int off, int len) {
  synchronized (fLock) {
    super.setOffset(off);
    super.setLength(len);
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

public void update(int off, int len) {
  synchronized (fLock) {
    super.setOffset(off);
    super.setLength(len);
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

/**
 * Updates a position with the given information and clears its deletion state.
 *
 * @param position the position to update
 * @param offset the new selection offset
 * @param length the new selection length
 */
private void updatePosition(Position position, int offset, int length) {
  position.setOffset(offset);
  position.setLength(length);
  // http://bugs.eclipse.org/bugs/show_bug.cgi?id=32795
  position.isDeleted= false;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * Updates a position with the given information and clears its deletion state.
 *
 * @param position the position to update
 * @param offset the new selection offset
 * @param length the new selection length
 */
private void updatePosition(Position position, int offset, int length) {
  position.setOffset(offset);
  position.setLength(length);
  // http://bugs.eclipse.org/bugs/show_bug.cgi?id=32795
  position.isDeleted= false;
}

代码示例来源:origin: org.eclipse.recommenders.completion/rcp

position.setOffset(replacementOffset + buffer.length());
position.setLength(argument.length());

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

/**
 * Called before document changes occur. It must be followed by a call to postReplace().
 *
 * @param document the document on which to track the reference position.
 * @param offset the offset
 * @throws BadLocationException if the offset describes an invalid range in this document
 *
 */
public void preReplace(IDocument document, int offset) throws BadLocationException {
  fPosition.setOffset(offset);
  try {
    document.addPositionCategory(CATEGORY);
    document.addPositionUpdater(fPositionUpdater);
    document.addPosition(CATEGORY, fPosition);
  } catch (BadPositionCategoryException e) {
    // should not happen
    JavaPlugin.log(e);
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

/**
 * Called before document changes occur. It must be followed by a call to postReplace().
 *
 * @param document the document on which to track the reference position.
 * @param offset the offset
 * @throws BadLocationException if the offset describes an invalid range in this document 
 *
 */
public void preReplace(IDocument document, int offset) throws BadLocationException {
  fPosition.setOffset(offset);
  try {
    document.addPositionCategory(CATEGORY);
    document.addPositionUpdater(fPositionUpdater);
    document.addPosition(CATEGORY, fPosition);
  } catch (BadPositionCategoryException e) {
    // should not happen
    JavaPlugin.log(e);
  }
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

/**
 * Called before document changes occur. It must be followed by a call to postReplace().
 *
 * @param document the document on which to track the reference position.
 * @param offset the offset
 * @throws BadLocationException if the offset describes an invalid range in this document
 *
 */
public void preReplace(IDocument document, int offset) throws BadLocationException {
  fPosition.setOffset(offset);
  try {
    document.addPositionCategory(CATEGORY);
    document.addPositionUpdater(fPositionUpdater);
    document.addPosition(CATEGORY, fPosition);
  } catch (BadPositionCategoryException e) {
    // should not happen
    JavaPlugin.log(e);
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

@Override
  public void update(DocumentEvent event) {
    int offset= event.getOffset();
    int length= event.getLength();
    int delta= event.getText().length() - length;
    if (offset < fPosition.getOffset())
      fPosition.setOffset(fPosition.getOffset() + delta);
    else if (offset < fPosition.getOffset() + fPosition.getLength())
      fPosition.setLength(fPosition.getLength() + delta);
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

@Override
  public void update(DocumentEvent event) {
    int offset= event.getOffset();
    int length= event.getLength();
    int delta= event.getText().length() - length;
    if (offset < fPosition.getOffset())
      fPosition.setOffset(fPosition.getOffset() + delta);
    else if (offset < fPosition.getOffset() + fPosition.getLength())
      fPosition.setLength(fPosition.getLength() + delta);
  }
}

相关文章