public LuaSmartEnterProcessor() { final List<SmartEnterProcessorWithFixers.Fixer<LuaSmartEnterProcessor>> ourFixers = Arrays.asList( new LuaIfConditionFixer(), new LuaBlockFixer(), new LuaWhileConditionFixer() ); addFixers(ourFixers.toArray(new Fixer[ourFixers.size()])); addEnterProcessors(new LuaPlainEnterProcessor()); }
public GroovySmartEnterProcessor() { final List<SmartEnterProcessorWithFixers.Fixer<GroovySmartEnterProcessor>> ourFixers = Arrays.asList( new SmartEnterProcessorWithFixers.Fixer<GroovySmartEnterProcessor>() { @Override public void apply(@NotNull Editor editor, @NotNull GroovySmartEnterProcessor processor, @NotNull PsiElement psiElement) { GrCatchClause catchClause = PsiTreeUtil.getParentOfType(psiElement, GrCatchClause.class); if (catchClause == null || catchClause.getBody() != null) return; if (!PsiTreeUtil.isAncestor(catchClause.getParameter(), psiElement, false)) return; final Document doc = editor.getDocument(); PsiElement lBrace = catchClause.getLBrace(); if (lBrace != null) return; PsiElement eltToInsertAfter = catchClause.getRParenth(); String text = "{\n}"; if (eltToInsertAfter == null) { eltToInsertAfter = catchClause.getParameter(); text = "){\n}"; } if (eltToInsertAfter != null) { doc.insertString(eltToInsertAfter.getTextRange().getEndOffset(), text); } } }, new GrClassBodyFixer() , new GrMissingIfStatement(), new GrIfConditionFixer(), new GrLiteralFixer(), new GrMethodCallFixer(), new GrMethodBodyFixer(), new GrMethodParametersFixer(), new GrWhileConditionFixer(), new GrWhileBodyFixer(), new GrForBodyFixer(), new GrSwitchBodyFixer(), new GrSynchronizedFixer(), new GrListFixer(), new GrMethodCallWithSingleClosureArgFixer() ); addFixers(ourFixers.toArray(new Fixer[ourFixers.size()])); addEnterProcessors(new GroovyPlainEnterProcessor()); }
public GroovySmartEnterProcessor() { final List<SmartEnterProcessorWithFixers.Fixer<GroovySmartEnterProcessor>> ourFixers = Arrays.asList( new SmartEnterProcessorWithFixers.Fixer<GroovySmartEnterProcessor>() { @Override public void apply(@NotNull Editor editor, @NotNull GroovySmartEnterProcessor processor, @NotNull PsiElement psiElement) { GrCatchClause catchClause = PsiTreeUtil.getParentOfType(psiElement, GrCatchClause.class); if (catchClause == null || catchClause.getBody() != null) return; if (!PsiTreeUtil.isAncestor(catchClause.getParameter(), psiElement, false)) return; final Document doc = editor.getDocument(); PsiElement lBrace = catchClause.getLBrace(); if (lBrace != null) return; PsiElement eltToInsertAfter = catchClause.getRParenth(); String text = "{\n}"; if (eltToInsertAfter == null) { eltToInsertAfter = catchClause.getParameter(); text = "){\n}"; } if (eltToInsertAfter != null) { doc.insertString(eltToInsertAfter.getTextRange().getEndOffset(), text); } } }, new GrMissingIfStatement(), new GrIfConditionFixer(), new GrLiteralFixer(), new GrMethodCallFixer(), new GrMethodBodyFixer(), new GrMethodParametersFixer(), new GrWhileConditionFixer(), new GrWhileBodyFixer(), new GrForBodyFixer(), new GrSwitchBodyFixer(), new GrSynchronizedFixer(), new GrListFixer(), new GrMethodCallWithSingleClosureArgFixer() ); addFixers(ourFixers.toArray(new Fixer[ourFixers.size()])); addEnterProcessors(new GroovyPlainEnterProcessor()); }