public boolean canReference(TwelfFile user, TwelfFile declaration) { boolean declared = false; for (TwelfIdentifierReference member : getMemberFiles()) { if (!declared && member.getCanonicalText().equals(declaration.getName())) { declared = true; } if (member.getCanonicalText().equals(user.getName())) { return declared; } } throw new IllegalArgumentException("Not a member file: " + user.getName()); }
public void annotate(@NotNull PsiElement element, @NotNull final AnnotationHolder holder) { if (element instanceof TwelfBaseElement) { if (element instanceof LfDeclaration) { LfDeclaration declaration = (LfDeclaration) element; annotate(declaration.getNameIdentifier(), declaration, holder); } if (element instanceof LfIdentifierReference) { LfIdentifierReference reference = (LfIdentifierReference) element; Referencing.multiResolveTarget(reference, new MyCodeInsightsHolder(holder)); } if (element instanceof TwelfIdentifierReference) { TwelfIdentifierReference reference = (TwelfIdentifierReference) element; ReferableElement resolve = reference.resolve(); annotate(reference.getIdentifier(), resolve, holder); } if (element instanceof IgnoredDirectiveImpl) { String message = TwelfBundle.message( "warning.directive.ignored", ((TwelfDirective) element).getDirectiveName()); holder.createWarningAnnotation(element, message); } } }