本文整理汇总了Java中com.intellij.psi.impl.source.JavaDummyHolder.isSamePackage方法的典型用法代码示例。如果您正苦于以下问题:Java JavaDummyHolder.isSamePackage方法的具体用法?Java JavaDummyHolder.isSamePackage怎么用?Java JavaDummyHolder.isSamePackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.impl.source.JavaDummyHolder
的用法示例。
在下文中一共展示了JavaDummyHolder.isSamePackage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: arePackagesTheSame
import com.intellij.psi.impl.source.JavaDummyHolder; //导入方法依赖的package包/类
@Override
public boolean arePackagesTheSame(@NotNull PsiElement element1, @NotNull PsiElement element2) {
PsiFile file1 = FileContextUtil.getContextFile(element1);
PsiFile file2 = FileContextUtil.getContextFile(element2);
if (Comparing.equal(file1, file2)) return true;
if (file1 instanceof JavaDummyHolder && file2 instanceof JavaDummyHolder) return true;
if (file1 instanceof JavaDummyHolder || file2 instanceof JavaDummyHolder) {
JavaDummyHolder dummyHolder = (JavaDummyHolder) (file1 instanceof JavaDummyHolder ? file1 : file2);
PsiElement other = file1 instanceof JavaDummyHolder ? file2 : file1;
return dummyHolder.isSamePackage(other);
}
if (!(file1 instanceof PsiClassOwner)) return false;
if (!(file2 instanceof PsiClassOwner)) return false;
String package1 = ((PsiClassOwner) file1).getPackageName();
String package2 = ((PsiClassOwner) file2).getPackageName();
return Comparing.equal(package1, package2);
}
示例2: arePackagesTheSame
import com.intellij.psi.impl.source.JavaDummyHolder; //导入方法依赖的package包/类
@Override
public boolean arePackagesTheSame(@NotNull PsiElement element1, @NotNull PsiElement element2)
{
PsiFile file1 = FileContextUtil.getContextFile(element1);
PsiFile file2 = FileContextUtil.getContextFile(element2);
if(Comparing.equal(file1, file2))
{
return true;
}
if(file1 instanceof JavaDummyHolder && file2 instanceof JavaDummyHolder)
{
return true;
}
if(file1 instanceof JavaDummyHolder || file2 instanceof JavaDummyHolder)
{
JavaDummyHolder dummyHolder = (JavaDummyHolder) (file1 instanceof JavaDummyHolder ? file1 : file2);
PsiElement other = file1 instanceof JavaDummyHolder ? file2 : file1;
return dummyHolder.isSamePackage(other);
}
if(!(file1 instanceof PsiClassOwner))
{
return false;
}
if(!(file2 instanceof PsiClassOwner))
{
return false;
}
String package1 = ((PsiClassOwner) file1).getPackageName();
String package2 = ((PsiClassOwner) file2).getPackageName();
return Comparing.equal(package1, package2);
}