com.intellij.psi.PsiCodeBlock Java Examples
The following examples show how to use
com.intellij.psi.PsiCodeBlock.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractStatement.java From IntelliJDeodorant with MIT License | 5 votes |
public PsiElement getStatement() { PsiElement element = this.statement.getElement(); if (element instanceof PsiStatement || element instanceof PsiCodeBlock) { return element; } else { return null; } }
Example #2
Source File: CodeBlockTranslator.java From java2typescript with Apache License 2.0 | 5 votes |
public static void translate(PsiCodeBlock block, TranslationContext ctx) { ctx.append("{\n"); ctx.increaseIdent(); for (PsiStatement statement : block.getStatements()) { StatementTranslator.translate(statement, ctx); } ctx.decreaseIdent(); ctx.print("}"); }
Example #3
Source File: SneakyThrowsExceptionHandler.java From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public boolean isHandled(@Nullable PsiElement element, @NotNull PsiClassType exceptionType, PsiElement topElement) { if (!(topElement instanceof PsiCodeBlock)) { final PsiMethod psiMethod = PsiTreeUtil.getParentOfType(element, PsiMethod.class); return psiMethod != null && isExceptionHandled(psiMethod, exceptionType); } return false; }
Example #4
Source File: PsiMethodUtil.java From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License | 4 votes |
@NotNull public static PsiCodeBlock createCodeBlockFromText(@NotNull String blockText, @NotNull PsiElement psiElement) { final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(psiElement.getProject()); return elementFactory.createCodeBlockFromText("{" + blockText + "}", psiElement); }