boolean (PsiElement other) { PsiElement myContext = getContext(); if (other instanceof DummyHolder) { PsiElement otherContext = other.getContext(); if (myContext == null || otherContext == null) return myContext == otherContext; return JavaPsiFacade.getInstance(myContext.getProject()).arePackagesTheSame(myContext, otherContext); } if (other instanceof PsiJavaFile) { if (myContext != null) return JavaPsiFacade.getInstance(myContext.getProject()).arePackagesTheSame(myContext, other); String packageName = ((PsiJavaFile)other).getPackageName(); return packageName.isEmpty(); } return false; }