static boolean tryFlip(PsiElement left, PsiElement right) { final Language language = left.getLanguage(); for (Flipper handler : EXTENSION.allForLanguage(language)) { if (handler.flip(left, right)) { return true; } } return false; }
private static boolean isBrace(@NotNull PsiElement candidate) { final ASTNode node = candidate.getNode(); if (node != null && node.getFirstChildNode() == null) { final PairedBraceMatcher braceMatcher = LanguageBraceMatching.INSTANCE.forLanguage(candidate.getLanguage()); if (braceMatcher != null) { final IElementType elementType = node.getElementType(); for (BracePair pair : braceMatcher.getPairs()) { if (elementType == pair.getLeftBraceType() || elementType == pair.getRightBraceType()) { return true; } } } } return false; }