public class BlockUtils
extends java.lang.Object
Constructor and Description |
---|
BlockUtils() |
Modifier and Type | Method and Description |
---|---|
static PsiStatement |
addAfter(PsiStatement anchor,
PsiStatement newStatement)
Add new statement after given anchor statement creating code block, if necessary
|
static PsiStatement |
addBefore(PsiStatement anchor,
PsiStatement... newStatements)
Adds new statements before given anchor statement creating a new code block, if necessary
|
static boolean |
containsConflictingDeclarations(PsiCodeBlock block,
PsiCodeBlock parentBlock) |
static PsiBlockStatement |
createBlockStatement(Project project) |
static <T extends PsiStatement> |
expandSingleStatementToBlockStatement(T statement)
Replaces a statement with a block statement with the statement inside it.
|
static PsiElement |
getBody(PsiElement element) |
static void |
inlineCodeBlock(PsiStatement orig,
PsiCodeBlock codeBlock) |
static void |
unwrapTryBlock(PsiTryStatement tryStatement) |
public static PsiStatement addBefore(PsiStatement anchor, PsiStatement... newStatements)
anchor
- existing statementnewStatements
- the new statements which should be added before the existing onepublic static PsiStatement addAfter(PsiStatement anchor, PsiStatement newStatement)
anchor
- existing statementnewStatement
- a new statement which should be added after an existing onepublic static <T extends PsiStatement> T expandSingleStatementToBlockStatement(T statement)
statement
- the statement to replacepublic static PsiElement getBody(PsiElement element)
public static void unwrapTryBlock(PsiTryStatement tryStatement)
public static boolean containsConflictingDeclarations(PsiCodeBlock block, PsiCodeBlock parentBlock)
public static void inlineCodeBlock(PsiStatement orig, PsiCodeBlock codeBlock)
public static PsiBlockStatement createBlockStatement(Project project)