• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ITrackedNodePosition类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition的典型用法代码示例。如果您正苦于以下问题:Java ITrackedNodePosition类的具体用法?Java ITrackedNodePosition怎么用?Java ITrackedNodePosition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ITrackedNodePosition类属于org.eclipse.jdt.core.dom.rewrite包,在下文中一共展示了ITrackedNodePosition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getOffset

import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition; //导入依赖的package包/类
@Override
public int getOffset() {
	int minStart= Integer.MAX_VALUE;
	for (ITrackedNodePosition node : fPos) {
		minStart= Math.min(minStart, node.getStartPosition());
	}
	return minStart == Integer.MAX_VALUE ? -1 : minStart;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:9,代码来源:LinkedProposalPositionGroup.java


示例2: getLength

import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition; //导入依赖的package包/类
@Override
public int getLength() {
	int minStart= Integer.MAX_VALUE;
	int maxEnd= 0;
	for (ITrackedNodePosition node : fPos) {
		minStart= Math.min(minStart, node.getStartPosition());
		maxEnd= Math.max(maxEnd, node.getStartPosition() + node.getLength());
	}
	return minStart == Integer.MAX_VALUE ? 0 : maxEnd - getOffset();
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:11,代码来源:LinkedProposalPositionGroup.java


示例3: getOffset

import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition; //导入依赖的package包/类
@Override
public int getOffset() {
  int minStart = Integer.MAX_VALUE;
  for (ITrackedNodePosition node : fPos) {
    minStart = Math.min(minStart, node.getStartPosition());
  }
  return minStart == Integer.MAX_VALUE ? -1 : minStart;
}
 
开发者ID:eclipse,项目名称:che,代码行数:9,代码来源:LinkedProposalPositionGroup.java


示例4: getLength

import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition; //导入依赖的package包/类
@Override
public int getLength() {
  int minStart = Integer.MAX_VALUE;
  int maxEnd = 0;
  for (ITrackedNodePosition node : fPos) {
    minStart = Math.min(minStart, node.getStartPosition());
    maxEnd = Math.max(maxEnd, node.getStartPosition() + node.getLength());
  }
  return minStart == Integer.MAX_VALUE ? 0 : maxEnd - getOffset();
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:LinkedProposalPositionGroup.java


示例5: createPlaceholderForProtectedTypeDeclaration

import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition; //导入依赖的package包/类
protected static BodyDeclaration createPlaceholderForProtectedTypeDeclaration(final BodyDeclaration bodyDeclaration, final CompilationUnit declaringCuNode, final ICompilationUnit declaringCu, final ASTRewrite rewrite, final boolean removeIndentation) throws JavaModelException {
	String text= null;
	try {
		final ASTRewrite rewriter= ASTRewrite.create(bodyDeclaration.getAST());
		ModifierRewrite.create(rewriter, bodyDeclaration).setVisibility(Modifier.PROTECTED, null);
		final ITrackedNodePosition position= rewriter.track(bodyDeclaration);
		final IDocument document= new Document(declaringCu.getBuffer().getText(declaringCuNode.getStartPosition(), declaringCuNode.getLength()));
		rewriter.rewriteAST(document, declaringCu.getJavaProject().getOptions(true)).apply(document, TextEdit.UPDATE_REGIONS);
		text= document.get(position.getStartPosition(), position.getLength());
	} catch (BadLocationException exception) {
		text= getNewText(bodyDeclaration, declaringCu, removeIndentation);
	}
	return (BodyDeclaration) rewrite.createStringPlaceholder(text, ASTNode.TYPE_DECLARATION);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:15,代码来源:HierarchyProcessor.java


示例6: updateReplacementString

import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition; //导入依赖的package包/类
public String updateReplacementString(IDocument document, int offset, ImportRewrite importRewrite,
		boolean snippetStringSupport)
				throws CoreException, BadLocationException {
	Document recoveredDocument= new Document();
	CompilationUnit unit= getRecoveredAST(document, offset, recoveredDocument);
	ImportRewriteContext context = new ContextSensitiveImportRewriteContext(unit, offset, importRewrite);

	ITypeBinding declaringType= null;
	ChildListPropertyDescriptor descriptor= null;
	ASTNode node= NodeFinder.perform(unit, offset, 1);
	node= ASTResolving.findParentType(node);
	String result = null;
	if (node instanceof AnonymousClassDeclaration) {
		declaringType= ((AnonymousClassDeclaration) node).resolveBinding();
		descriptor= AnonymousClassDeclaration.BODY_DECLARATIONS_PROPERTY;
	} else if (node instanceof AbstractTypeDeclaration) {
		AbstractTypeDeclaration declaration= (AbstractTypeDeclaration) node;
		descriptor= declaration.getBodyDeclarationsProperty();
		declaringType= declaration.resolveBinding();
	}
	if (declaringType != null) {
		ASTRewrite rewrite= ASTRewrite.create(unit.getAST());
		IMethodBinding methodToOverride= Bindings.findMethodInHierarchy(declaringType, fMethodName, fParamTypes);
		if (methodToOverride == null && declaringType.isInterface()) {
			methodToOverride= Bindings.findMethodInType(node.getAST().resolveWellKnownType("java.lang.Object"), fMethodName, fParamTypes); //$NON-NLS-1$
		}
		if (methodToOverride != null) {
			CodeGenerationSettings settings = PreferenceManager.getCodeGenerationSettings(fJavaProject.getProject());
			MethodDeclaration stub = StubUtility2.createImplementationStub(fCompilationUnit, rewrite, importRewrite,
					context, methodToOverride, declaringType, settings, declaringType.isInterface(), declaringType,
					snippetStringSupport);
			ListRewrite rewriter= rewrite.getListRewrite(node, descriptor);
			rewriter.insertFirst(stub, null);

			ITrackedNodePosition position= rewrite.track(stub);
			try {
				Map<String, String> options = fJavaProject.getOptions(true);

				rewrite.rewriteAST(recoveredDocument, options).apply(recoveredDocument);

				String generatedCode = recoveredDocument.get(position.getStartPosition(), position.getLength());

				String indentAt = getIndentAt(recoveredDocument, position.getStartPosition(), settings);
				int generatedIndent = IndentManipulation.measureIndentUnits(indentAt, settings.tabWidth,
						settings.indentWidth);
				// Kinda fishy but empirical data shows Override needs to change indent by at
				// least 1
				generatedIndent = Math.max(1, generatedIndent);

				// Cancel generated code indent
				String delimiter = TextUtilities.getDefaultLineDelimiter(document);
				result = IndentManipulation.changeIndent(generatedCode, generatedIndent, settings.tabWidth,
						settings.indentWidth, "", delimiter);

			} catch (MalformedTreeException | BadLocationException exception) {
				JavaLanguageServerPlugin.logException("Unable to compute override proposal", exception);
			}
		}
	}
	return result;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:62,代码来源:OverrideCompletionProposal.java


示例7: setEndPosition

import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition; //导入依赖的package包/类
public void setEndPosition(ITrackedNodePosition position) {
	setEndPosition(LinkedProposalPositionGroup.createPositionInformation(position, 1));
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:4,代码来源:LinkedProposalModel.java


示例8: createPositionInformation

import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition; //导入依赖的package包/类
public static PositionInformation createPositionInformation(ITrackedNodePosition pos, int sequenceRank) {
	return new TrackedNodePosition(pos, sequenceRank);
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:4,代码来源:LinkedProposalPositionGroup.java


示例9: TrackedNodePosition

import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition; //导入依赖的package包/类
public TrackedNodePosition(ITrackedNodePosition pos, int sequenceRank) {
	fPos= pos;
	fSequenceRank= sequenceRank;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:5,代码来源:LinkedProposalPositionGroup.java


示例10: addPosition

import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition; //导入依赖的package包/类
public void addPosition(ITrackedNodePosition position, int sequenceRank) {
	addPosition(createPositionInformation(position, sequenceRank));
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:4,代码来源:LinkedProposalPositionGroup.java


示例11: setEndPosition

import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition; //导入依赖的package包/类
public void setEndPosition(ITrackedNodePosition position) {
  setEndPosition(LinkedProposalPositionGroup.createPositionInformation(position, 1));
}
 
开发者ID:eclipse,项目名称:che,代码行数:4,代码来源:LinkedProposalModel.java


示例12: createPositionInformation

import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition; //导入依赖的package包/类
public static PositionInformation createPositionInformation(
    ITrackedNodePosition pos, int sequenceRank) {
  return new TrackedNodePosition(pos, sequenceRank);
}
 
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:LinkedProposalPositionGroup.java


示例13: TrackedNodePosition

import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition; //导入依赖的package包/类
public TrackedNodePosition(ITrackedNodePosition pos, int sequenceRank) {
  fPos = pos;
  fSequenceRank = sequenceRank;
}
 
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:LinkedProposalPositionGroup.java


示例14: addPosition

import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition; //导入依赖的package包/类
public void addPosition(ITrackedNodePosition position, int sequenceRank) {
  addPosition(createPositionInformation(position, sequenceRank));
}
 
开发者ID:eclipse,项目名称:che,代码行数:4,代码来源:LinkedProposalPositionGroup.java


示例15: getUpdatedMember

import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition; //导入依赖的package包/类
private String getUpdatedMember(IDocument document, BodyDeclaration declaration) throws BadLocationException {
	ITrackedNodePosition trackedPosition= (ITrackedNodePosition) declaration.getProperty(TRACKED_POSITION_PROPERTY);
	return Strings.trimIndentation(document.get(trackedPosition.getStartPosition(), trackedPosition.getLength()), fPreferences.tabWidth, fPreferences.indentWidth, false);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:5,代码来源:MoveStaticMembersProcessor.java


示例16: TrackedNodesPosition

import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition; //导入依赖的package包/类
/**
 * A position that contains all of the given tracked node positions.
 *
 * @param pos the positions
 */
public TrackedNodesPosition(Collection<ITrackedNodePosition> pos) {
	fPos= pos;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:9,代码来源:LinkedProposalPositionGroup.java


示例17: StartPositionInformation

import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition; //导入依赖的package包/类
/**
 * A position for the start of the given tracked node position.
 *
 * @param pos the position
 */
public StartPositionInformation(ITrackedNodePosition pos) {
	fPos= pos;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:9,代码来源:LinkedProposalPositionGroup.java


示例18: addLinkedPosition

import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition; //导入依赖的package包/类
/**
 * Adds a linked position to be shown when the proposal is applied. All
 * positions with the same group id are linked.
 *
 * @param position
 *            The position to add.
 * @param isFirst
 *            If set, the proposal is jumped to first.
 * @param groupID
 *            The id of the group the proposal belongs to. All proposals in
 *            the same group are linked.
 */
public void addLinkedPosition(ITrackedNodePosition position, boolean isFirst, String groupID) {
	getLinkedProposalModel().getPositionGroup(groupID, true).addPosition(position, isFirst);
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:16,代码来源:LinkedCorrectionProposal.java


示例19: setEndPosition

import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition; //导入依赖的package包/类
/**
 * Sets the end position of the linked mode to the end of the passed range.
 *
 * @param position
 *            The position that describes the end position of the linked
 *            mode.
 */
public void setEndPosition(ITrackedNodePosition position) {
	getLinkedProposalModel().setEndPosition(position);
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:11,代码来源:LinkedCorrectionProposal.java


示例20: TrackedNodesPosition

import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition; //导入依赖的package包/类
/**
 * A position that contains all of the given tracked node positions.
 *
 * @param pos the positions
 */
public TrackedNodesPosition(Collection<ITrackedNodePosition> pos) {
  fPos = pos;
}
 
开发者ID:eclipse,项目名称:che,代码行数:9,代码来源:LinkedProposalPositionGroup.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RemotingException类代码示例发布时间:2022-05-22
下一篇:
Java TabSelectedHandler类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap