本文整理汇总了Java中org.eclipse.jdt.core.IMember.getSourceRange方法的典型用法代码示例。如果您正苦于以下问题:Java IMember.getSourceRange方法的具体用法?Java IMember.getSourceRange怎么用?Java IMember.getSourceRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.IMember
的用法示例。
在下文中一共展示了IMember.getSourceRange方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNameRange
import org.eclipse.jdt.core.IMember; //导入方法依赖的package包/类
private static ISourceRange getNameRange(IJavaElement element) throws JavaModelException {
ISourceRange nameRange = null;
if (element instanceof IMember) {
IMember member = (IMember) element;
nameRange = member.getNameRange();
if ( (!SourceRange.isAvailable(nameRange))) {
nameRange = member.getSourceRange();
}
} else if (element instanceof ITypeParameter || element instanceof ILocalVariable) {
nameRange = ((ISourceReference) element).getNameRange();
} else if (element instanceof ISourceReference) {
nameRange = ((ISourceReference) element).getSourceRange();
}
if (!SourceRange.isAvailable(nameRange) && element.getParent() != null) {
nameRange = getNameRange(element.getParent());
}
return nameRange;
}
示例2: setRange
import org.eclipse.jdt.core.IMember; //导入方法依赖的package包/类
private void setRange(Member member, IMember iMember) throws JavaModelException {
ISourceRange nameRange = iMember.getNameRange();
if (iMember.isBinary()) {
nameRange = iMember.getSourceRange();
}
if (nameRange == null) {
return;
}
member.setFileRegion(convertToRegionDTO(iMember.getSourceRange()));
}
示例3: canEnable
import org.eclipse.jdt.core.IMember; //导入方法依赖的package包/类
@Override
public boolean canEnable() throws JavaModelException {
if (!super.canEnable() || fJavaElements.length == 0) return false;
for (int i = 0; i < fJavaElements.length; i++) {
if (fJavaElements[i] instanceof IMember) {
IMember member = (IMember) fJavaElements[i];
// we can copy some binary members, but not all
if (member.isBinary() && member.getSourceRange() == null) return false;
}
}
return true;
}
示例4: withinSourceRange
import org.eclipse.jdt.core.IMember; //导入方法依赖的package包/类
private static boolean withinSourceRange(IMember member, int offset) throws JavaModelException {
ISourceRange sourceRange = member.getSourceRange();
return offset >= sourceRange.getOffset() && offset <= sourceRange.getOffset()+sourceRange.getLength();
}
示例5: hasSourceAvailable
import org.eclipse.jdt.core.IMember; //导入方法依赖的package包/类
public static boolean hasSourceAvailable(IMember member) throws JavaModelException {
return !member.isBinary()
|| (member.getSourceRange() != null && !fgUnknownRange.equals(member.getSourceRange()));
}