private void replaceIteratorNext( PsiElement element, String contentVariableName, String iteratorName, PsiElement childToSkip, StringBuilder out, PsiType contentType) { if (isIteratorNext(element, iteratorName, contentType)) { out.append(contentVariableName); } else { final PsiElement[] children = element.getChildren(); if (children.length == 0) { final String text = element.getText(); if (PsiKeyword.INSTANCEOF.equals(text) && out.charAt(out.length() - 1) != ' ') { out.append(' '); } out.append(text); } else { boolean skippingWhiteSpace = false; for (final PsiElement child : children) { if (child.equals(childToSkip)) { skippingWhiteSpace = true; } else if (child instanceof PsiWhiteSpace && skippingWhiteSpace) { // don't do anything } else { skippingWhiteSpace = false; replaceIteratorNext( child, contentVariableName, iteratorName, childToSkip, out, contentType); } } } } }
private void replaceCollectionGetAccess( PsiElement element, String contentVariableName, PsiVariable listVariable, String indexName, PsiElement childToSkip, StringBuilder out) { if (isListGetLookup(element, indexName, listVariable)) { out.append(contentVariableName); } else { final PsiElement[] children = element.getChildren(); if (children.length == 0) { final String text = element.getText(); if (PsiKeyword.INSTANCEOF.equals(text) && out.charAt(out.length() - 1) != ' ') { out.append(' '); } out.append(text); } else { boolean skippingWhiteSpace = false; for (final PsiElement child : children) { if (child.equals(childToSkip)) { skippingWhiteSpace = true; } else if (child instanceof PsiWhiteSpace && skippingWhiteSpace) { // don't do anything } else { skippingWhiteSpace = false; replaceCollectionGetAccess( child, contentVariableName, listVariable, indexName, childToSkip, out); } } } } }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ColorIconRenderer renderer = (ColorIconRenderer) o; if (myElement != null ? !myElement.equals(renderer.myElement) : renderer.myElement != null) return false; return true; }
protected boolean isEnabled( @NotNull HierarchyBrowserBaseEx browser, @NotNull PsiElement element) { return !element.equals(browser.mySmartPsiElementPointer.getElement()) && element.isValid(); }