use of com.intellij.psi.PsiSwitchStatement in project intellij-community by JetBrains.
the class MissingSwitchBodyFixer method apply.
@Override
public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException {
if (!(psiElement instanceof PsiSwitchStatement))
return;
PsiSwitchStatement switchStatement = (PsiSwitchStatement) psiElement;
final Document doc = editor.getDocument();
final PsiCodeBlock body = switchStatement.getBody();
if (body != null)
return;
final PsiJavaToken rParenth = switchStatement.getRParenth();
assert rParenth != null;
doc.insertString(rParenth.getTextRange().getEndOffset(), "{}");
}
Aggregations