String (@NotNull final PsiElement element) { StringBuilder buffer = null; for (PsiElement current = element; current != null && !(current instanceof PsiFile); current = current.getParent()) { int length = buffer == null ? 0 : buffer.length(); StringBuilder b = getSignature(current, buffer); if (b == null && buffer != null && current.getParent() instanceof PsiFile && canResolveTopLevelChild(current)) { buffer.append(TYPE_MARKER).append(ELEMENT_TOKENS_SEPARATOR).append(TOP_LEVEL_CHILD_MARKER).append(ELEMENTS_SEPARATOR); break; } buffer = b; if (buffer == null || length >= buffer.length()) { return null; } buffer.append(ELEMENTS_SEPARATOR); } if (buffer == null) { return null; } buffer.setLength(buffer.length() - 1); return buffer.toString(); }