本文整理汇总了Java中com.intellij.usageView.UsageInfo.getRangeInElement方法的典型用法代码示例。如果您正苦于以下问题:Java UsageInfo.getRangeInElement方法的具体用法?Java UsageInfo.getRangeInElement怎么用?Java UsageInfo.getRangeInElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.usageView.UsageInfo
的用法示例。
在下文中一共展示了UsageInfo.getRangeInElement方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindNonJavaReference
import com.intellij.usageView.UsageInfo; //导入方法依赖的package包/类
private static void bindNonJavaReference(PsiElement bindTo, PsiElement element, UsageInfo usage) {
final TextRange range = usage.getRangeInElement();
for (PsiReference reference : element.getReferences()) {
if (reference instanceof JavaClassReference) {
final JavaClassReference classReference = (JavaClassReference)reference;
if (classReference.getRangeInElement().equals(range)) {
classReference.bindToElement(bindTo);
break;
}
}
}
}
示例2: getParentFromUsage
import com.intellij.usageView.UsageInfo; //导入方法依赖的package包/类
private static PsiElement getParentFromUsage(UsageInfo usage) {
ProperTextRange range = usage.getRangeInElement();
assertNotNull(range);
PsiElement element = usage.getElement();
assertNotNull(element);
PsiElement elementAt = element.findElementAt(range.getStartOffset());
assertNotNull(elementAt);
return elementAt.getParent();
}
示例3: serializeMe
import com.intellij.usageView.UsageInfo; //导入方法依赖的package包/类
@Override
public void serializeMe(UsageInfo info, StringBuilder os) throws IOException {
//final SmartPsiElementPointer<?> pointer = info.getSmartPointer();
final GenericElementSignatureProvider provider = new GenericElementSignatureProvider();
final String signature = provider.getSignature(info.getElement());
append(os, info.getFile().getVirtualFile().getPath());
os.append(separator);
append(os, signature);
os.append(separator);
final ProperTextRange rangeInElement = info.getRangeInElement();
if (rangeInElement == null) {
append(os, "-1");
os.append(separator);
append(os, "-1");
os.append(separator);
}
else {
append(os, String.valueOf(rangeInElement.getStartOffset()));
os.append(separator);
append(os, String.valueOf(rangeInElement.getEndOffset()));
os.append(separator);
}
append(os, String.valueOf(info.isNonCodeUsage()));
os.append(separator);
append(os, String.valueOf(info.isDynamicUsage()));
os.append(separator);
final String text = new UsageInfo2UsageAdapter(info).getPlainText();
append(os, text);
os.append(separator);
}
示例4: computeHashCode
import com.intellij.usageView.UsageInfo; //导入方法依赖的package包/类
@Override
public int computeHashCode(SliceUsage object) {
UsageInfo info = object.getUsageInfo();
TextRange range = info.getRangeInElement();
return range == null ? 0 : range.hashCode();
}