当前位置: 首页>>代码示例>>Java>>正文


Java LinkedPosition.getLength方法代码示例

本文整理汇总了Java中org.eclipse.jface.text.link.LinkedPosition.getLength方法的典型用法代码示例。如果您正苦于以下问题:Java LinkedPosition.getLength方法的具体用法?Java LinkedPosition.getLength怎么用?Java LinkedPosition.getLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jface.text.link.LinkedPosition的用法示例。


在下文中一共展示了LinkedPosition.getLength方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doExit

import org.eclipse.jface.text.link.LinkedPosition; //导入方法依赖的package包/类
@Override
public ExitFlags doExit(LinkedModeModel model, VerifyEvent event, int offset, int length) {
	if (length == 0 && (event.character == SWT.BS || event.character == SWT.DEL)) {
		LinkedPosition position= model.findPosition(new LinkedPosition(fDocument, offset, 0, LinkedPositionGroup.NO_STOP));
		if (position != null) {
			if (event.character == SWT.BS) {
				if (offset - 1 < position.getOffset()) {
					//skip backspace at beginning of linked position
					event.doit= false;
				}
			} else /* event.character == SWT.DEL */ {
				if (offset + 1 > position.getOffset() + position.getLength()) {
					//skip delete at end of linked position
					event.doit= false;
				}
			}
		}
	}

	return null; // don't change behavior
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:22,代码来源:LinkedNamesAssistProposal.java

示例2: doExit

import org.eclipse.jface.text.link.LinkedPosition; //导入方法依赖的package包/类
public ExitFlags doExit(LinkedModeModel model, VerifyEvent event, int offset, int length) {
	showPreview = (event.stateMask & SWT.CTRL) != 0 && (event.character == SWT.CR || event.character == SWT.LF);
	if (length == 0 && (event.character == SWT.BS || event.character == SWT.DEL)) {
		LinkedPosition position = model.findPosition(new LinkedPosition(document, offset, 0,
				LinkedPositionGroup.NO_STOP));
		if (position != null) {
			if (event.character == SWT.BS) {
				if (offset - 1 < position.getOffset()) {
					// skip backspace at beginning of linked position
					event.doit = false;
				}
			} else /* event.character == SWT.DEL */{
				if (offset + 1 > position.getOffset() + position.getLength()) {
					// skip delete at end of linked position
					event.doit = false;
				}
			}
		}
	}
	return null; // don't change behavior
}
 
开发者ID:cplutte,项目名称:bts,代码行数:22,代码来源:RenameLinkedMode.java

示例3: doExit

import org.eclipse.jface.text.link.LinkedPosition; //导入方法依赖的package包/类
public ExitFlags doExit(LinkedModeModel model, VerifyEvent event, int offset, int length) {
	if (length == 0 && (event.character == SWT.BS || event.character == SWT.DEL)) {
		LinkedPosition position= model.findPosition(new LinkedPosition(fDocument, offset, 0, LinkedPositionGroup.NO_STOP));
		if (position != null) {
			if (event.character == SWT.BS) {
				if (offset - 1 < position.getOffset()) {
					//skip backspace at beginning of linked position
					event.doit= false;
				}
			} else /* event.character == SWT.DEL */ {
				if (offset + 1 > position.getOffset() + position.getLength()) {
					//skip delete at end of linked position
					event.doit= false;
				}
			}
		}
	}

	return null; // don't change behavior
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:LinkedNamesAssistProposal.java

示例4: findNextPosition

import org.eclipse.jface.text.link.LinkedPosition; //导入方法依赖的package包/类
/**
 * Finds the next position after the given position.
 * 
 * @param position
 *            the current position
 * @return the next position
 */
protected int findNextPosition(int position) {
	ISourceViewer viewer = getSourceViewer();
	int widget = -1;
	int next = position;
	while (next != BreakIterator.DONE && widget == -1) {
		next = fIterator.following(next);
		if (next != BreakIterator.DONE)
			widget = modelOffset2WidgetOffset(viewer, next);
	}

	IDocument document = viewer.getDocument();
	LinkedModeModel model = LinkedModeModel.getModel(document, position);
	if (model != null) {
		LinkedPosition linkedPosition = model.findPosition(new LinkedPosition(document, position, 0));
		if (linkedPosition != null) {
			int linkedPositionEnd = linkedPosition.getOffset() + linkedPosition.getLength();
			if (position != linkedPositionEnd && linkedPositionEnd < next)
				next = linkedPositionEnd;
		} else {
			LinkedPosition nextLinkedPosition = model.findPosition(new LinkedPosition(document, next, 0));
			if (nextLinkedPosition != null) {
				int nextLinkedPositionOffset = nextLinkedPosition.getOffset();
				if (position != nextLinkedPositionOffset && nextLinkedPositionOffset < next)
					next = nextLinkedPositionOffset;
			}
		}
	}

	return next;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:38,代码来源:XtextEditor.java

示例5: findPreviousPosition

import org.eclipse.jface.text.link.LinkedPosition; //导入方法依赖的package包/类
/**
 * Finds the previous position before the given position.
 * 
 * @param position
 *            the current position
 * @return the previous position
 */
protected int findPreviousPosition(int position) {
	ISourceViewer viewer = getSourceViewer();
	int widget = -1;
	int previous = position;
	while (previous != BreakIterator.DONE && widget == -1) { // XXX: optimize
		previous = fIterator.preceding(previous);
		if (previous != BreakIterator.DONE)
			widget = modelOffset2WidgetOffset(viewer, previous);
	}

	IDocument document = viewer.getDocument();
	LinkedModeModel model = LinkedModeModel.getModel(document, position);
	if (model != null) {
		LinkedPosition linkedPosition = model.findPosition(new LinkedPosition(document, position, 0));
		if (linkedPosition != null) {
			int linkedPositionOffset = linkedPosition.getOffset();
			if (position != linkedPositionOffset && previous < linkedPositionOffset)
				previous = linkedPositionOffset;
		} else {
			LinkedPosition previousLinkedPosition = model
					.findPosition(new LinkedPosition(document, previous, 0));
			if (previousLinkedPosition != null) {
				int previousLinkedPositionEnd = previousLinkedPosition.getOffset()
						+ previousLinkedPosition.getLength();
				if (position != previousLinkedPositionEnd && previous < previousLinkedPositionEnd)
					previous = previousLinkedPositionEnd;
			}
		}
	}

	return previous;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:40,代码来源:XtextEditor.java

示例6: findNextPosition

import org.eclipse.jface.text.link.LinkedPosition; //导入方法依赖的package包/类
/**
 * Finds the next position after the given position.
 *
 * @param position the current position
 * @return the next position
 */
protected int findNextPosition(int position) {
	ISourceViewer viewer= getSourceViewer();
	int widget= -1;
	int next= position;
	while (next != BreakIterator.DONE && widget == -1) { // XXX: optimize
		next= fIterator.following(next);
		if (next != BreakIterator.DONE)
			widget= modelOffset2WidgetOffset(viewer, next);
	}

	IDocument document= viewer.getDocument();
	LinkedModeModel model= LinkedModeModel.getModel(document, position);
	if (model != null && next != BreakIterator.DONE) {
		LinkedPosition linkedPosition= model.findPosition(new LinkedPosition(document, position, 0));
		if (linkedPosition != null) {
			int linkedPositionEnd= linkedPosition.getOffset() + linkedPosition.getLength();
			if (position != linkedPositionEnd && linkedPositionEnd < next)
				next= linkedPositionEnd;
		} else {
			LinkedPosition nextLinkedPosition= model.findPosition(new LinkedPosition(document, next, 0));
			if (nextLinkedPosition != null) {
				int nextLinkedPositionOffset= nextLinkedPosition.getOffset();
				if (position != nextLinkedPositionOffset && nextLinkedPositionOffset < next)
					next= nextLinkedPositionOffset;
			}
		}
	}

	return next;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:37,代码来源:JavaEditor.java

示例7: findPreviousPosition

import org.eclipse.jface.text.link.LinkedPosition; //导入方法依赖的package包/类
/**
 * Finds the previous position before the given position.
 *
 * @param position the current position
 * @return the previous position
 */
protected int findPreviousPosition(int position) {
	ISourceViewer viewer= getSourceViewer();
	int widget= -1;
	int previous= position;
	while (previous != BreakIterator.DONE && widget == -1) { // XXX: optimize
		previous= fIterator.preceding(previous);
		if (previous != BreakIterator.DONE)
			widget= modelOffset2WidgetOffset(viewer, previous);
	}

	IDocument document= viewer.getDocument();
	LinkedModeModel model= LinkedModeModel.getModel(document, position);
	if (model != null && previous != BreakIterator.DONE) {
		LinkedPosition linkedPosition= model.findPosition(new LinkedPosition(document, position, 0));
		if (linkedPosition != null) {
			int linkedPositionOffset= linkedPosition.getOffset();
			if (position != linkedPositionOffset && previous < linkedPositionOffset)
				previous= linkedPositionOffset;
		} else {
			LinkedPosition previousLinkedPosition= model.findPosition(new LinkedPosition(document, previous, 0));
			if (previousLinkedPosition != null) {
				int previousLinkedPositionEnd= previousLinkedPosition.getOffset() + previousLinkedPosition.getLength();
				if (position != previousLinkedPositionEnd && previous < previousLinkedPositionEnd)
					previous= previousLinkedPositionEnd;
			}
		}
	}

	return previous;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:37,代码来源:JavaEditor.java

示例8: findNextPosition

import org.eclipse.jface.text.link.LinkedPosition; //导入方法依赖的package包/类
/**
 * Finds the next position after the given position.
 *
 * @param position the current position
 * @return the next position
 */
protected int findNextPosition(int position) {
	ISourceViewer viewer= getSourceViewer();
	int widget= -1;
	int next= position;
	while (next != BreakIterator.DONE && widget == -1) { // XXX: optimize
		next= fIterator.following(next);
		if (next != BreakIterator.DONE)
			widget= modelOffset2WidgetOffset(viewer, next);
	}

	IDocument document= viewer.getDocument();
	LinkedModeModel model= LinkedModeModel.getModel(document, position);
	if (model != null) {
		LinkedPosition linkedPosition= model.findPosition(new LinkedPosition(document, position, 0));
		if (linkedPosition != null) {
			int linkedPositionEnd= linkedPosition.getOffset() + linkedPosition.getLength();
			if (position != linkedPositionEnd && linkedPositionEnd < next)
				next= linkedPositionEnd;
		} else {
			LinkedPosition nextLinkedPosition= model.findPosition(new LinkedPosition(document, next, 0));
			if (nextLinkedPosition != null) {
				int nextLinkedPositionOffset= nextLinkedPosition.getOffset();
				if (position != nextLinkedPositionOffset && nextLinkedPositionOffset < next)
					next= nextLinkedPositionOffset;
			}
		}
	}

	return next;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:37,代码来源:JavaEditor.java

示例9: findPreviousPosition

import org.eclipse.jface.text.link.LinkedPosition; //导入方法依赖的package包/类
/**
 * Finds the previous position before the given position.
 *
 * @param position the current position
 * @return the previous position
 */
protected int findPreviousPosition(int position) {
	ISourceViewer viewer= getSourceViewer();
	int widget= -1;
	int previous= position;
	while (previous != BreakIterator.DONE && widget == -1) { // XXX: optimize
		previous= fIterator.preceding(previous);
		if (previous != BreakIterator.DONE)
			widget= modelOffset2WidgetOffset(viewer, previous);
	}

	IDocument document= viewer.getDocument();
	LinkedModeModel model= LinkedModeModel.getModel(document, position);
	if (model != null) {
		LinkedPosition linkedPosition= model.findPosition(new LinkedPosition(document, position, 0));
		if (linkedPosition != null) {
			int linkedPositionOffset= linkedPosition.getOffset();
			if (position != linkedPositionOffset && previous < linkedPositionOffset)
				previous= linkedPositionOffset;
		} else {
			LinkedPosition previousLinkedPosition= model.findPosition(new LinkedPosition(document, previous, 0));
			if (previousLinkedPosition != null) {
				int previousLinkedPositionEnd= previousLinkedPosition.getOffset() + previousLinkedPosition.getLength();
				if (position != previousLinkedPositionEnd && previous < previousLinkedPositionEnd)
					previous= previousLinkedPositionEnd;
			}
		}
	}

	return previous;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:37,代码来源:JavaEditor.java

示例10: findNextPosition

import org.eclipse.jface.text.link.LinkedPosition; //导入方法依赖的package包/类
/**
 * Finds the next position after the given position.
 *
 * @param position the current position
 * @return the next position
 */
protected int findNextPosition(int position) {
    ISourceViewer viewer = getSourceViewer();
    int widget = -1;
    int next = position;
    while (next != BreakIterator.DONE && widget == -1) { // XXX: optimize
        next = fIterator.following(next);
        if (next != BreakIterator.DONE) {
            widget = modelOffset2WidgetOffset(viewer, next);
        }
    }

    IDocument document = viewer.getDocument();
    LinkedModeModel model = LinkedModeModel.getModel(document, position);
    if (model != null && next != BreakIterator.DONE) {
        LinkedPosition linkedPosition = model.findPosition(new LinkedPosition(document, position, 0));
        if (linkedPosition != null) {
            int linkedPositionEnd = linkedPosition.getOffset() + linkedPosition.getLength();
            if (position != linkedPositionEnd && linkedPositionEnd < next) {
                next = linkedPositionEnd;
            }
        } else {
            LinkedPosition nextLinkedPosition = model.findPosition(new LinkedPosition(document, next, 0));
            if (nextLinkedPosition != null) {
                int nextLinkedPositionOffset = nextLinkedPosition.getOffset();
                if (position != nextLinkedPositionOffset && nextLinkedPositionOffset < next) {
                    next = nextLinkedPositionOffset;
                }
            }
        }
    }

    return next;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:40,代码来源:SubWordActions.java

示例11: findPreviousPosition

import org.eclipse.jface.text.link.LinkedPosition; //导入方法依赖的package包/类
/**
 * Finds the previous position before the given position.
 *
 * @param position the current position
 * @return the previous position
 */
protected int findPreviousPosition(int position) {
    ISourceViewer viewer = getSourceViewer();
    int widget = -1;
    int previous = position;
    while (previous != BreakIterator.DONE && widget == -1) { // XXX: optimize
        previous = fIterator.preceding(previous);
        if (previous != BreakIterator.DONE) {
            widget = modelOffset2WidgetOffset(viewer, previous);
        }
    }

    IDocument document = viewer.getDocument();
    LinkedModeModel model = LinkedModeModel.getModel(document, position);
    if (model != null && previous != BreakIterator.DONE) {
        LinkedPosition linkedPosition = model.findPosition(new LinkedPosition(document, position, 0));
        if (linkedPosition != null) {
            int linkedPositionOffset = linkedPosition.getOffset();
            if (position != linkedPositionOffset && previous < linkedPositionOffset) {
                previous = linkedPositionOffset;
            }
        } else {
            LinkedPosition previousLinkedPosition = model
                    .findPosition(new LinkedPosition(document, previous, 0));
            if (previousLinkedPosition != null) {
                int previousLinkedPositionEnd = previousLinkedPosition.getOffset()
                        + previousLinkedPosition.getLength();
                if (position != previousLinkedPositionEnd && previous < previousLinkedPositionEnd) {
                    previous = previousLinkedPositionEnd;
                }
            }
        }
    }

    return previous;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:42,代码来源:SubWordActions.java

示例12: computeEdits

import org.eclipse.jface.text.link.LinkedPosition; //导入方法依赖的package包/类
public TextEdit computeEdits(int offset, LinkedPosition position, char trigger, int stateMask, LinkedModeModel model) throws CoreException {
	return new ReplaceEdit(position.getOffset(), position.getLength(), fDisplayString);
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:4,代码来源:LinkedProposalPositionGroup.java

示例13: computeEdits

import org.eclipse.jface.text.link.LinkedPosition; //导入方法依赖的package包/类
public TextEdit computeEdits(
    int offset, LinkedPosition position, char trigger, int stateMask, LinkedModeModel model)
    throws CoreException {
  return new ReplaceEdit(position.getOffset(), position.getLength(), fDisplayString);
}
 
开发者ID:eclipse,项目名称:che,代码行数:6,代码来源:LinkedProposalPositionGroup.java


注:本文中的org.eclipse.jface.text.link.LinkedPosition.getLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。