Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
29,300
void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { final String text = invokeImpl(element); final GrExpression newExpr = GroovyPsiElementFactory.getInstance(context.project()).createExpressionFromText(text); ((GrExpression)element).replaceWithExpression(newExpr, true); ...
processIntention
29,301
PsiElementPredicate () { return new PsiElementPredicate() { @Override public boolean satisfiedBy(@NotNull PsiElement element) { return element instanceof GrLiteral && !element.getText().equals(invokeImpl(element)); } }; }
getElementPredicate
29,302
boolean (@NotNull PsiElement element) { return element instanceof GrLiteral && !element.getText().equals(invokeImpl(element)); }
satisfiedBy
29,303
String (PsiElement element) { final String text = element.getText(); final String quote = GrStringUtil.getStartQuote(text); if (!("'".equals(quote) || "\"".equals(quote))) return text; if (!text.contains("\\n")) return text; String value = GrStringUtil.removeQuotes(text); StringBuilder buffer = new StringBuilder(); if ...
invokeImpl
29,304
void (PsiElement element, String quote, StringBuilder buffer) { final ASTNode node = element.getNode(); for (ASTNode child = node.getFirstChildNode(); child != null; child = child.getTreeNext()) { final IElementType type = child.getElementType(); if (type == GroovyTokenTypes.mGSTRING_BEGIN || type == GroovyTokenTypes.m...
processGString
29,305
boolean (ASTNode next) { return next != null && next.getElementType() == GroovyElementTypes.GSTRING_INJECTION; }
isInjection
29,306
void (String quote, String value, StringBuilder buffer) { int prev = 0; for (int pos = value.indexOf("\\n"); pos >= 0; pos = value.indexOf("\\n", prev)) { buffer.append(quote); int end = checkForR(value, pos); buffer.append(value, prev, end); prev = end; buffer.append(quote); buffer.append("+\n"); } buffer.append(quote...
processSimpleString
29,307
int (String value, int pos) { pos += 2; if (value.length() > pos + 2 && "\\r".equals(value.substring(pos, pos + 2))) return pos + 2; return pos; }
checkForR
29,308
void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { final Document document = element.getContainingFile().getViewProvider().getDocument(); final TextRange range = element.getTextRange(); document.replaceString(range.getStartOffset(), range.getEndOffset(), removeUnnecessa...
processIntention
29,309
PsiElementPredicate () { return element -> { if (!(element instanceof GrLiteral)) return false; String text = element.getText(); return GrStringUtil.getStartQuote(text) != null && !removeUnnecessaryEscapeSymbols((GrLiteral)element).equals(text); }; }
getElementPredicate
29,310
String (final GrLiteral literal) { final String text = literal.getText(); final String quote = GrStringUtil.getStartQuote(text); final String value = GrStringUtil.removeQuotes(text); final StringBuilder buffer = new StringBuilder(); buffer.append(quote); switch (quote) { case "'" -> GrStringUtil.escapeAndUnescapeSymbol...
removeUnnecessaryEscapeSymbols
29,311
PsiElementPredicate () { return new ConvertibleGStringLiteralPredicate(); }
getElementPredicate
29,312
void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { final GrLiteral exp = (GrLiteral)element; PsiImplUtil.replaceExpression(convertGStringLiteralToStringLiteral(exp), exp); }
processIntention
29,313
String (GrLiteral literal) { PsiElement child = literal.getFirstChild(); if (child == null) return literal.getText(); String text; ArrayList<String> list = new ArrayList<>(); PsiElement prevSibling = null; PsiElement nextSibling; do { text = child.getText(); nextSibling = child.getNextSibling(); if (child instanceof Gr...
convertGStringLiteralToStringLiteral
29,314
String (GrClosableBlock block) { final GrStatement statement = block.getStatements()[0]; final GrExpression expr; if (statement instanceof GrReturnStatement) { expr = ((GrReturnStatement)statement).getReturnValue(); } else { expr = (GrExpression)statement; } return prepareExpression(expr); }
prepareClosableBlock
29,315
String (GrExpression expr) { if (PsiUtil.isThisOrSuperRef(expr)) return expr.getText(); String text = expr.getText(); final PsiType type = expr.getType(); if (type != null && CommonClassNames.JAVA_LANG_STRING.equals(type.getCanonicalText())) { if (expr instanceof GrBinaryExpression && GroovyTokenTypes.mPLUS.equals(((Gr...
prepareExpression
29,316
String (String text, boolean isFirst, boolean isLast, boolean isBeforeInjection) { if (isFirst) { if (text.startsWith("\"\"\"")) { text = text.substring(3); } else text = StringUtil.trimStart(text, "\""); } if (isLast) { if (text.endsWith("\"\"\"")) { text = text.substring(0, text.length() - 3); } else text = StringUti...
prepareText
29,317
void (ChooseTypeExpression[] paramTypesExpressions, PsiMethod method, PsiClass owner, TypeConstraint[] constraints, boolean isConstructor, @NotNull final PsiElement context) { ParameterNameExpression[] nameExpressions = new ParameterNameExpression[paramTypesExpressions.length]; for (int i = 0; i < nameExpressions.lengt...
createTemplateForMethod
29,318
void (ChooseTypeExpression[] paramTypesExpressions, ParameterNameExpression[] paramNameExpressions, PsiMethod method, PsiClass owner, ChooseTypeExpression returnTypeExpression, boolean isConstructor, @Nullable final PsiElement context) { final Project project = owner.getProject(); PsiTypeElement typeElement = method.ge...
createTemplateForMethod
29,319
void (@NotNull Template template, boolean brokenOff) { ApplicationManager.getApplication().runWriteAction(() -> { PsiDocumentManager.getInstance(project).commitDocument(newEditor.getDocument()); final int offset = newEditor.getCaretModel().getOffset(); PsiMethod method1 = PsiTreeUtil.findElementOfClassAtOffset(targetFi...
templateFinished
29,320
Editor (@NotNull Project project, @NotNull PsiFile targetFile, @NotNull PsiElement element) { int textOffset = element.getTextOffset(); VirtualFile virtualFile = targetFile.getVirtualFile(); if (virtualFile != null) { OpenFileDescriptor descriptor = new OpenFileDescriptor(project, virtualFile, textOffset); return FileE...
positionCursor
29,321
void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { final GrIfStatement ifStatement = (GrIfStatement)element.getParent(); final GrIfStatement elseIf = getElseIf(ifStatement); final GrIfStatement elseIfCopy = (GrIfStatement)elseIf.copy(); elseIf.getCondition().replaceWith...
processIntention
29,322
PsiElementPredicate () { return new PsiElementPredicate() { @Override public boolean satisfiedBy(@NotNull PsiElement element) { if (!element.getNode().getElementType().equals(GroovyTokenTypes.kIF)) return false; final PsiElement parent = element.getParent(); if (!(parent instanceof GrIfStatement ifStatement)) return fa...
getElementPredicate
29,323
boolean (@NotNull PsiElement element) { if (!element.getNode().getElementType().equals(GroovyTokenTypes.kIF)) return false; final PsiElement parent = element.getParent(); if (!(parent instanceof GrIfStatement ifStatement)) return false; final GrIfStatement elseIf = getElseIf(ifStatement); return elseIf != null && check...
satisfiedBy
29,324
GrIfStatement (GrIfStatement ifStatement) { final GrStatement elseBranch = ifStatement.getElseBranch(); if (elseBranch == null) return null; if (elseBranch instanceof GrIfStatement) { return (GrIfStatement)elseBranch; } else { return null; } }
getElseIf
29,325
boolean (GrIfStatement ifStatement) { return ifStatement.getCondition() != null && ifStatement.getThenBranch() != null; }
checkIf
29,326
boolean (@NotNull PsiElement element) { if (!(element instanceof GrConditionalExpression)) { return false; } return !ErrorUtil.containsError(element); }
satisfiedBy
29,327
void (PsiElement element, final Project project, Editor editor, List<GrMethod> constructors) { final GrField field = PsiTreeUtil.getParentOfType(element, GrField.class); if (constructors.isEmpty()) return; if (ApplicationManager.getApplication().isUnitTestMode()) { for (GrMethod constructor : constructors) { addParamet...
performForField
29,328
void (PsiElement element, final Project project, Editor editor, List<GrField> candidates) { final GrMethod constructor = PsiTreeUtil.getParentOfType(element, GrMethod.class); if (candidates.isEmpty()) return; if (ApplicationManager.getApplication().isUnitTestMode()) { for (GrField candidate : candidates) { addParameter...
performForConstructor
29,329
void (final GrField selectedValue, final GrMethod constructor, final Project project) { List<GrParameterInfo> parameters = new ArrayList<>(); GrParameter[] constructorParameters = constructor.getParameters(); for (int i = 0; i < constructorParameters.length; i++) { parameters.add(new GrParameterInfo(constructorParamete...
addParameter
29,330
void (UsageInfo @NotNull [] usages) { super.performRefactoring(usages); final GrOpenBlock block = constructor.getBlock(); LOG.assertTrue(block != null); final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(project); final String text; if (StringUtil.equals(selectedValue.getName(), finalParameterN...
performRefactoring
29,331
boolean () { return false; }
startInWriteAction
29,332
PsiElementPredicate () { return new MyPredicate(); }
getElementPredicate
29,333
boolean (@NotNull PsiElement element) { final List<GrField> candidates = findFieldCandidates(element); if (candidates != null && !candidates.isEmpty()) return true; final List<GrMethod> constructors = findConstructorCandidates(element); return constructors != null && !constructors.isEmpty(); }
satisfiedBy
29,334
List<GrField> (PsiElement element) { final GrMethod constructor = PsiTreeUtil.getParentOfType(element, GrMethod.class); if (constructor == null || !constructor.isConstructor()) return null; if (constructor.getBlock() == null) return null; if (PsiTreeUtil.isAncestor(constructor.getBlock(), element, false)) { return null...
findFieldCandidates
29,335
List<GrField> (PsiMethod constructor, final GrTypeDefinition clazz) { final List<GrField> usedFields = new ArrayList<>(); final GrOpenBlock block = constructor instanceof GrMethod ? ((GrMethod)constructor).getBlock() : null; if (block == null) { return usedFields; } final PsiManager manager = clazz.getManager(); block....
findCandidates
29,336
void (@NotNull GrReferenceExpression referenceExpression) { super.visitReferenceExpression(referenceExpression); final PsiElement resolved = referenceExpression.resolve(); if (resolved instanceof GrField && manager.areElementsEquivalent(((GrField)resolved).getContainingClass(), clazz) && PsiUtil.isAccessedForWriting(re...
visitReferenceExpression
29,337
void (@NotNull GrTypeDefinition typeDefinition) { }
visitTypeDefinition
29,338
void (@NotNull GrClosableBlock closure) { }
visitClosure
29,339
List<GrField> (final PsiMethod constructor, final GrTypeDefinition clazz) { final CachedValue<List<GrField>> value = constructor.getUserData(FIELD_CANDIDATES); if (value != null && value.getValue() != null) return value.getValue(); final CachedValue<List<GrField>> cachedValue = CachedValuesManager.getManager(constructo...
findCandidatesCached
29,340
List<GrMethod> (PsiElement element) { final GrField field = PsiTreeUtil.getParentOfType(element, GrField.class); if (field == null) return null; PsiClass containingClass = field.getContainingClass(); if (!(containingClass instanceof GrTypeDefinition)) return null; return findConstructorCandidates(field, (GrTypeDefiniti...
findConstructorCandidates
29,341
List<GrMethod> (@NotNull final GrField field, @NotNull GrTypeDefinition psiClass) { final List<GrMethod> result = new ArrayList<>(); final PsiMethod[] constructors = psiClass.getConstructors(); final PsiManager manager = field.getManager(); for (PsiMethod constructor : constructors) { final List<GrField> fields = findC...
findConstructorCandidates
29,342
PsiElementPredicate () { return new ExpandBooleanPredicate(); }
getElementPredicate
29,343
void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { final GrStatement containingStatement = (GrStatement)element; if (ExpandBooleanPredicate.isBooleanAssignment(containingStatement)) { final GrAssignmentExpression assignmentExpression = (GrAssignmentExpression)containing...
processIntention
29,344
void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { GrConditionalExpression parentTernary = findTernary(element); GroovyPsiElementFactory groovyPsiElementFactory = GroovyPsiElementFactory.getInstance(context.project()); GrReturnStatement parentReturn = (GrReturnStatement...
processIntention
29,345
PsiElementPredicate () { return element -> { GrConditionalExpression ternary = findTernary(element); return ternary != null && ternary.getThenBranch() != null && ternary.getElseBranch() != null && ternary.getParent() instanceof GrReturnStatement; }; }
getElementPredicate
29,346
GrConditionalExpression (PsiElement element) { GrConditionalExpression ternary = PsiTreeUtil.getParentOfType(element, GrConditionalExpression.class); if (ternary == null) { GrReturnStatement ret = PsiTreeUtil.getParentOfType(element, GrReturnStatement.class); if (ret != null && ret.getReturnValue() instanceof GrConditi...
findTernary
29,347
void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { PsiElement parent = element.getParent(); if (!"if".equals(element.getText()) || !(parent instanceof GrIfStatement parentIf)) { throw new IncorrectOperationException("Not invoked on an if"); } GroovyPsiElementFactory gro...
processIntention
29,348
boolean (@Nullable GrStatement thenBranch) { return thenBranch != null && !(thenBranch instanceof GrBlockStatement && ((GrBlockStatement)thenBranch).getBlock().getStatements().length == 0); }
isNotEmpty
29,349
void (@NotNull GrIfStatement ifStatement, @NotNull GrIfStatement newIf) { final GrStatement thenBranch = newIf.getThenBranch(); assert thenBranch != null; GrStatement elseBranch = ifStatement.getElseBranch(); if (elseBranch != null) { thenBranch.replaceWithStatement(elseBranch); return; } PsiElement parent = ifStatemen...
generateElseBranchTextAndRemoveTailStatements
29,350
boolean (@NotNull GrIfStatement ifStatement, @NotNull GrStatementOwner owner) { final GrControlFlowOwner flowOwner = ControlFlowUtils.findControlFlowOwner(ifStatement); if (flowOwner == null) return false; final Instruction[] flow = flowOwner.getControlFlow(); final GrStatement[] statements = owner.getStatements(); fin...
isTailAfterIf
29,351
GrExpression (GrExpression operand) { while (operand instanceof GrParenthesizedExpression) { GrExpression innerExpression = ((GrParenthesizedExpression)operand).getOperand(); if (innerExpression == null) { break; } operand = innerExpression; } return operand; }
stripParenthesis
29,352
PsiElementPredicate () { return new PsiElementPredicate() { @Override public boolean satisfiedBy(@NotNull PsiElement element) { PsiElement parent = element.getParent(); if (!(parent instanceof GrIfStatement)) return false; if (((GrIfStatement)parent).getCondition() == null) return false; if (!"if".equals(element.getTex...
getElementPredicate
29,353
boolean (@NotNull PsiElement element) { PsiElement parent = element.getParent(); if (!(parent instanceof GrIfStatement)) return false; if (((GrIfStatement)parent).getCondition() == null) return false; if (!"if".equals(element.getText())) return false; return true; }
satisfiedBy
29,354
void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { final GrIfStatement ifStatement = (GrIfStatement)element.getParent(); final PsiElement thenBranch = skipBlock(ifStatement.getThenBranch()); final PsiElement elseBranch = skipBlock(ifStatement.getElseBranch()); Project p...
processIntention
29,355
void (GrConditionalExpression conditional, GrExpression condition, GrExpression then, GrExpression elze) { conditional.getCondition().replaceWithExpression(condition, true); conditional.getThenBranch().replaceWithExpression(then, true); conditional.getElseBranch().replaceWithExpression(elze, true); }
replaceConditional
29,356
PsiElementPredicate () { return e -> { if (!e.getNode().getElementType().equals(GroovyTokenTypes.kIF)) return false; if (!(e.getParent() instanceof GrIfStatement ifStatement)) return false; final PsiElement thenBranch = skipBlock(ifStatement.getThenBranch()); final PsiElement elseBranch = skipBlock(ifStatement.getElseB...
getElementPredicate
29,357
PsiElement (PsiElement e) { if (e instanceof GrBlockStatement block && block.getBlock().getStatements().length == 1) { return block.getBlock().getStatements()[0]; } else { return e; } }
skipBlock
29,358
boolean (@NotNull PsiElement element) { if (!(element instanceof GrStatement statement)) { return false; } return isBooleanReturn(statement) || isBooleanAssignment(statement); }
satisfiedBy
29,359
boolean (GrStatement statement) { if (!(statement instanceof GrReturnStatement returnStatement)) { return false; } final GrExpression returnValue = returnStatement.getReturnValue(); if (returnValue == null) { return false; } if (returnValue instanceof GrLiteral) { return false; } final PsiType returnType = returnValue....
isBooleanReturn
29,360
boolean (GrStatement expression) { if (!(expression instanceof GrAssignmentExpression assignment)) { return false; } final GrExpression rhs = assignment.getRValue(); if (rhs == null) { return false; } if (rhs instanceof GrLiteral) { return false; } final PsiType assignmentType = rhs.getType(); if (assignmentType == nul...
isBooleanAssignment
29,361
PsiElementPredicate () { return new MergeElseIfPredicate(); }
getElementPredicate
29,362
void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { final GrIfStatement parentStatement = (GrIfStatement) element; GrBlockStatement elseBlockStatement = (GrBlockStatement) parentStatement.getElseBranch(); assert elseBlockStatement != null; final GrOpenBlock elseBranch = ...
processIntention
29,363
PsiElementPredicate () { return new MergeIfAndPredicate(); }
getElementPredicate
29,364
void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { final GrIfStatement parentStatement = (GrIfStatement) element; final GrStatement parentThenBranch = parentStatement.getThenBranch(); final GrIfStatement childStatement = (GrIfStatement) ConditionalUtils.stripBraces(pare...
processIntention
29,365
boolean (@NotNull PsiElement element) { if (!(element instanceof GrIfStatement ifStatement)) { return false; } final GrStatement thenBranch = ifStatement.getThenBranch(); if (thenBranch == null) { return false; } final GrStatement elseBranch = ifStatement.getElseBranch(); return elseBranch instanceof GrIfStatement; }
satisfiedBy
29,366
void (@NotNull PsiElement andElement, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { GrBinaryExpression binaryExpression = (GrBinaryExpression) andElement.getParent(); GrIfStatement ifStatement = (GrIfStatement) binaryExpression.getParent(); GrExpression leftOperand = binaryExpression.getLeftOperand(...
processIntention
29,367
PsiElementPredicate () { return element -> element.getParent() instanceof GrBinaryExpression binOp && binOp.getRightOperand() != null && binOp.getParent() instanceof GrIfStatement ifStatement && ifStatement.getElseBranch() == null && "&&".equals(element.getText()); }
getElementPredicate
29,368
boolean (@NotNull PsiElement element) { if (element instanceof final GrBinaryExpression expression) { final IElementType tokenType = expression.getOperationTokenType(); return (tokenType.equals(GroovyTokenTypes.mLAND) || tokenType.equals(GroovyTokenTypes.mLOR)) && !ErrorUtil.containsError(element); } return false; }
satisfiedBy
29,369
String (@NotNull PsiElement element) { final GrBinaryExpression binaryExpression = (GrBinaryExpression)element; final IElementType tokenType = binaryExpression.getOperationTokenType(); if (GroovyTokenTypes.mLAND.equals(tokenType)) { return GroovyIntentionsBundle.message("demorgans.intention.name1"); } else { return Gro...
getText
29,370
PsiElementPredicate () { return new ConjunctionPredicate(); }
getElementPredicate
29,371
void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { GrBinaryExpression exp = (GrBinaryExpression)element; final IElementType tokenType = exp.getOperationTokenType(); PsiElement parent = exp.getParent(); while (isConjunctionExpression(parent, tokenType)) { exp = (GrBinary...
processIntention
29,372
String (GrBinaryExpression exp, IElementType tokenType) { final GrExpression lhs = exp.getLeftOperand(); final String lhsText; if (isConjunctionExpression(lhs, tokenType)) { lhsText = convertConjunctionExpression((GrBinaryExpression)lhs, tokenType); } else { lhsText = convertLeafExpression(lhs); } final GrExpression rh...
convertConjunctionExpression
29,373
String (GrExpression condition) { if (BoolUtils.isNegation(condition)) { final GrExpression negated = BoolUtils.getNegated(condition); if (ParenthesesUtils.getPrecedence(negated) > ParenthesesUtils.OR_PRECEDENCE) { return '(' + negated.getText() + ')'; } return negated.getText(); } else if (ComparisonUtils.isComparison...
convertLeafExpression
29,374
boolean (PsiElement exp, IElementType conjunctionType) { if (!(exp instanceof GrBinaryExpression binExp)) return false; final IElementType tokenType = binExp.getOperationTokenType(); return conjunctionType.equals(tokenType); }
isConjunctionExpression
29,375
String (@NotNull PsiElement element) { final GrBinaryExpression binaryExpression = (GrBinaryExpression) element; final IElementType tokenType = binaryExpression.getOperationTokenType(); final String comparison = ComparisonUtils.getStringForComparison(tokenType); final String flippedComparison = ComparisonUtils.getFlipp...
getText
29,376
PsiElementPredicate () { return new ComparisonPredicate(); }
getElementPredicate
29,377
void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { final GrBinaryExpression exp = (GrBinaryExpression) element; final IElementType tokenType = exp.getOperationTokenType(); final GrExpression lhs = exp.getLeftOperand(); final String lhsText = lhs.getText(); final GrExpre...
processIntention
29,378
boolean (@NotNull PsiElement element) { if (!(element instanceof GrBinaryExpression expression)) { return false; } if (!ComparisonUtils.isComparison(expression)) { return false; } if (expression.getRightOperand() == null) return false; return !ErrorUtil.containsError(element); }
satisfiedBy
29,379
PsiElementPredicate () { return new ConditionalPredicate(); }
getElementPredicate
29,380
void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { final GrConditionalExpression exp = (GrConditionalExpression) element; final GrExpression condition = exp.getCondition(); final GrExpression elseExpression = exp.getElseBranch(); final GrExpression thenExpression = exp....
processIntention
29,381
String (@NotNull PsiElement element) { final GrBinaryExpression binaryExpression = (GrBinaryExpression)element; final IElementType tokenType = binaryExpression.getOperationTokenType(); final String conjunction = getConjunction(tokenType); return GroovyIntentionsBundle.message("flip.smth.intention.name", conjunction); }
getText
29,382
PsiElementPredicate () { return new ConjunctionPredicate(); }
getElementPredicate
29,383
void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { final GrBinaryExpression exp = (GrBinaryExpression)element; final IElementType tokenType = exp.getOperationTokenType(); final GrExpression lhs = exp.getLeftOperand(); final String lhsText = lhs.getText(); final GrExpres...
processIntention
29,384
String (IElementType tokenType) { return tokenType.equals(GroovyTokenTypes.mLAND) ? "&&" : "||"; }
getConjunction
29,385
void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { if (!(element instanceof GrConditionalExpression condExp)) { throw new IncorrectOperationException("Not invoked on a conditional"); } GrExpression thenBranch = condExp.getThenBranch(); GrExpression elseBranch = condExp....
processIntention
29,386
void (ModPsiUpdater updater, GrConditionalExpression condExp, String conditionExpText, String newExp) { int caretOffset = conditionExpText.length() + 2; // after operation sign GrExpression expressionFromText = GroovyPsiElementFactory.getInstance(condExp.getProject()) .createExpressionFromText(newExp, condExp .getConte...
manageReplace
29,387
String (GrExpression expression) { String expressionText = expression.getText(); if (ParenthesesUtils.AND_PRECEDENCE < ParenthesesUtils.getPrecedence(expression)) { expressionText = "(" + expressionText + ")"; } return expressionText; }
getStringToPutIntoAndExpression
29,388
String (GrExpression expression) { String expressionText = expression.getText(); if (ParenthesesUtils.OR_PRECEDENCE < ParenthesesUtils.getPrecedence(expression)) { expressionText = "(" + expressionText + ")"; } return expressionText; }
getStringToPutIntoOrExpression
29,389
PsiElementPredicate () { return element -> { if (!(element instanceof GrConditionalExpression condExp)) { return false; } PsiType condType = condExp.getType(); if (condType == null || !PsiTypes.booleanType().isConvertibleFrom(condType)) { return false; } GrExpression thenBranch = condExp.getThenBranch(); GrExpression e...
getElementPredicate
29,390
void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { final PsiElement parent = element.getParent(); if (!(parent instanceof GrIfStatement)) return; final GrIfStatement ifStatement = GroovyRefactoringUtil.addBlockIntoParent((GrIfStatement)parent); assert ifStatement.getPar...
processIntention
29,391
PsiElement (PsiElement lbrace) { return PsiUtil.skipWhitespaces(lbrace.getNextSibling(), true); }
inferFirst
29,392
PsiElement (PsiElement rbrace) { return PsiUtil.skipWhitespaces(rbrace.getPrevSibling(), false); }
inferLast
29,393
PsiElementPredicate () { return new PsiElementPredicate() { @Override public boolean satisfiedBy(@NotNull PsiElement element) { if (!(element.getNode().getElementType() == GroovyTokenTypes.kELSE)) return false; final PsiElement parent = element.getParent(); if (!(parent instanceof GrIfStatement ifStatement)) return fal...
getElementPredicate
29,394
boolean (@NotNull PsiElement element) { if (!(element.getNode().getElementType() == GroovyTokenTypes.kELSE)) return false; final PsiElement parent = element.getParent(); if (!(parent instanceof GrIfStatement ifStatement)) return false; final GrStatement branch = ifStatement.getThenBranch(); final GrControlFlowOwner flo...
satisfiedBy
29,395
boolean (@NotNull PsiElement element) { if (!(element instanceof GrIfStatement ifStatement)) { return false; } final GrStatement thenBranch = ifStatement.getThenBranch(); if (thenBranch == null) { return false; } final GrStatement elseBranch = ifStatement.getElseBranch(); if (!(elseBranch instanceof GrBlockStatement)) ...
satisfiedBy
29,396
PsiElementPredicate () { return new SplitElseIfPredicate(); }
getElementPredicate
29,397
void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { final GrIfStatement parentStatement = (GrIfStatement) element; final GrStatement elseBranch = parentStatement.getElseBranch(); GrIfStatement ifStatement = (GrIfStatement)parentStatement.copy(); GrBlockStatement blockSta...
processIntention
29,398
boolean (@NotNull PsiElement element) { if (!(element instanceof GrIfStatement ifStatement)) { return false; } if (ErrorUtil.containsError(ifStatement)) { return false; } GrStatement thenBranch = ifStatement.getThenBranch(); if (thenBranch == null) { return false; } thenBranch = ConditionalUtils.stripBraces(thenBranch)...
satisfiedBy
29,399
String (@NotNull PsiElement element) { final GrBinaryExpression binaryExpression = (GrBinaryExpression) element; final IElementType tokenType = binaryExpression.getOperationTokenType(); final String comparison = ComparisonUtils.getStringForComparison(tokenType); final String negatedComparison = ComparisonUtils.getNegat...
getText