Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
30,000
TextAttributes () { return resolveAttributes(GroovySyntaxHighlighter.INTERFACE_NAME); }
getInterfaceNameAttributes
30,001
TextAttributes () { return resolveAttributes(GroovySyntaxHighlighter.ENUM_NAME); }
getEnumNameAttributes
30,002
TextAttributes () { return resolveAttributes(GroovySyntaxHighlighter.ANONYMOUS_CLASS_NAME); }
getAnonymousClassNameAttributes
30,003
TextAttributes () { return resolveAttributes(GroovySyntaxHighlighter.ABSTRACT_CLASS_NAME); }
getAbstractClassNameAttributes
30,004
TextAttributes () { return resolveAttributes(GroovySyntaxHighlighter.CLASS_REFERENCE); }
getClassNameAttributes
30,005
TextAttributes () { return resolveAttributes(GroovySyntaxHighlighter.KEYWORD); }
getKeywordAttributes
30,006
TextAttributes () { return resolveAttributes(JavaHighlightingColors.COMMA); }
getCommaAttributes
30,007
TextAttributes () { return resolveAttributes(GroovySyntaxHighlighter.PARAMETER); }
getParameterAttributes
30,008
TextAttributes () { return resolveAttributes(GroovySyntaxHighlighter.TYPE_PARAMETER); }
getTypeParameterNameAttributes
30,009
TextAttributes () { return resolveAttributes(GroovySyntaxHighlighter.STATIC_FIELD); }
getStaticFieldAttributes
30,010
TextAttributes () { return resolveAttributes(GroovySyntaxHighlighter.INSTANCE_FIELD); }
getInstanceFieldAttributes
30,011
TextAttributes () { return resolveAttributes(GroovySyntaxHighlighter.OPERATION_SIGN); }
getOperationSignAttributes
30,012
TextAttributes () { return resolveAttributes(GroovySyntaxHighlighter.LOCAL_VARIABLE); }
getLocalVariableAttributes
30,013
TextAttributes () { return resolveAttributes(GroovySyntaxHighlighter.CONSTRUCTOR_DECLARATION); }
getConstructorDeclarationAttributes
30,014
TextAttributes () { return resolveAttributes(GroovySyntaxHighlighter.METHOD_DECLARATION); }
getMethodDeclarationAttributes
30,015
TextAttributes () { return resolveAttributes(GroovySyntaxHighlighter.PARENTHESES); }
getParenthesesAttributes
30,016
TextAttributes () { return resolveAttributes(JavaHighlightingColors.DOT); }
getDotAttributes
30,017
TextAttributes () { return resolveAttributes(GroovySyntaxHighlighter.BRACKETS); }
getBracketsAttributes
30,018
TextAttributes () { return resolveAttributes(GroovySyntaxHighlighter.METHOD_CALL); }
getMethodCallAttributes
30,019
PsiDocCommentOwner (@NotNull PsiMember member) { if (!(member instanceof PsiMethod) || member.isPhysical()) return null; String data = member.getUserData(ResolveUtil.DOCUMENTATION_DELEGATE_FQN); if (StringUtil.isEmptyOrSpaces(data)) return null; PsiClass clazz = JavaPsiFacade.getInstance(member.getProject()).findClass(data, member.getResolveScope()); return clazz == null ? null : clazz.findMethodBySignature((PsiMethod)member, false); }
computeDocumentationDelegate
30,020
void ( @NotNull StringBuilder buffer, @NotNull TextAttributes attributes, @Nullable String value ) { if (DocumentationSettings.isHighlightingOfQuickDocSignaturesEnabled()) { HtmlSyntaxInfoUtil.appendStyledSpan(buffer, attributes, value, DocumentationSettings.getHighlightingSaturation(false)); } else { buffer.append(value); } }
appendStyledSpan
30,021
void ( @NotNull StringBuilder buffer, @Nullable String value, String @NotNull ... properties ) { if (DocumentationSettings.isHighlightingOfQuickDocSignaturesEnabled()) { HtmlSyntaxInfoUtil.appendStyledSpan(buffer, value, properties); } else { buffer.append(value); } }
appendStyledSpan
30,022
PsiSubstitutor (PsiElement originalElement) { PsiSubstitutor substitutor = PsiSubstitutor.EMPTY; if (originalElement instanceof GrReferenceExpression) { substitutor = ((GrReferenceExpression)originalElement).advancedResolve().getSubstitutor(); } return substitutor; }
calcSubstitutor
30,023
void (PsiElement originalElement, @Nls StringBuilder buffer, PsiVariable variable) { if (variable instanceof PsiField) { final PsiClass parentClass = ((PsiField)variable).getContainingClass(); if (parentClass != null) { appendElementLink(buffer, parentClass, JavaDocUtil.getShortestClassName(parentClass, variable)); newLine(buffer); } generateModifiers(buffer, variable); } final PsiType type = variable instanceof GrVariable ? ((GrVariable)variable).getDeclaredType() : variable.getType(); appendTypeString(buffer, calcSubstitutor(originalElement).substitute(type), originalElement, false); buffer.append(" "); TextAttributes varAttributes = variable instanceof PsiField ? GroovyDocHighlightingManager.getInstance().getFieldDeclarationAttributes((PsiField)variable) : GroovyDocHighlightingManager.getInstance().getLocalVariableAttributes(); appendStyledSpan(buffer, varAttributes, variable.getName()); if (variable instanceof GrVariable) { newLine(buffer); while (originalElement != null) { PsiReference ref = originalElement.getReference(); if (ref != null && ref.resolve() != null) break; originalElement = originalElement.getParent(); } if (originalElement != null) { appendInferredType(originalElement, (GrVariable)variable, buffer, false); } } }
generateVariableInfo
30,024
void (PsiElement originalElement, GrVariable variable, @Nls StringBuilder buffer, boolean isRendered) { PsiType inferredType = null; if (PsiImplUtil.isWhiteSpaceOrNls(originalElement)) { originalElement = PsiTreeUtil.prevLeaf(originalElement); } if (originalElement != null && originalElement.getNode().getElementType() == GroovyTokenTypes.mIDENT) { originalElement = originalElement.getParent(); } if (originalElement instanceof GrReferenceExpression) { inferredType = ((GrReferenceExpression)originalElement).getType(); } else if (originalElement instanceof GrVariableDeclaration) { inferredType = variable.getTypeGroovy(); } else if (originalElement instanceof GrVariable) { inferredType = ((GrVariable)originalElement).getTypeGroovy(); } String typeLabel = inferredType != null ? GroovyBundle.message("documentation.inferred.type.label") : GroovyBundle.message("documentation.cannot.infer.type.label"); appendStyledSpan(buffer, "[" + typeLabel + "]", "color: #909090"); if (inferredType != null) { buffer.append(" "); appendTypeString(buffer, inferredType, originalElement, isRendered); } }
appendInferredType
30,025
void (@Nls StringBuilder buffer, PsiModifierListOwner element) { String modifiers = PsiFormatUtil.formatModifiers(element, PsiFormatUtilBase.JAVADOC_MODIFIERS_ONLY); if (!modifiers.isEmpty()) { appendStyledSpan(buffer, GroovyDocHighlightingManager.getInstance().getKeywordAttributes(), modifiers); buffer.append(" "); } }
generateModifiers
30,026
void (StringBuilder buffer) { buffer.append(LINE_SEPARATOR); }
newLine
30,027
void (@Nls @NotNull StringBuilder buffer, @Nullable PsiType type, PsiElement context, boolean isRendered) { if (type instanceof GrTraitType) { generateTraitType(buffer, ((GrTraitType)type), context, isRendered); } else if (type != null) { JavaDocInfoGeneratorFactory.getBuilder(context.getProject()) .setHighlightingManager(GroovyDocHighlightingManager.getInstance()) .setIsGenerationForRenderedDoc(isRendered) .create() .generateType(buffer, type, context); } else { appendStyledSpan(buffer, GroovyDocHighlightingManager.getInstance().getKeywordAttributes(), GrModifier.DEF); } }
appendTypeString
30,028
void (@NotNull StringBuilder buffer, @NotNull GrTraitType type, PsiElement context, boolean isRendered) { appendTypeString(buffer, type.getExprType(), context, isRendered); appendStyledSpan(buffer, GroovyDocHighlightingManager.getInstance().getKeywordAttributes(), " as "); // <- Groovy keyword @NotNull List<PsiType> types = type.getTraitTypes(); for (int i = 0; i < types.size(); i++) { PsiType traitType = types.get(i); appendTypeString(buffer, traitType, context, isRendered); if (i != types.size() - 1) { appendStyledSpan(buffer, GroovyDocHighlightingManager.getInstance().getCommaAttributes(), ", "); } } }
generateTraitType
30,029
List<String> (PsiElement element, PsiElement originalElement) { List<String> result = new ArrayList<>(); PsiElement docElement = getDocumentationElement(element, originalElement); if (docElement != null) { ContainerUtil.addIfNotNull(result, docElement.getUserData(NonCodeMembersHolder.DOCUMENTATION_URL)); } List<String> list = JavaDocumentationProvider.getExternalJavaDocUrl(element); if (list != null) { result.addAll(list); } return result.isEmpty() ? null : result; }
getUrlFor
30,030
GroovyDocInfoGenerator (@NotNull PsiElement element, boolean isGenerationForRenderedDoc) { return new GroovyDocInfoGenerator( element, isGenerationForRenderedDoc, DocumentationSettings.isHighlightingOfQuickDocSignaturesEnabled(), DocumentationSettings.isHighlightingOfCodeBlocksEnabled(), DocumentationSettings.getInlineCodeHighlightingMode(), DocumentationSettings.isSemanticHighlightingOfLinksEnabled(), DocumentationSettings.getHighlightingSaturation(isGenerationForRenderedDoc)); }
getDocInfoGenerator
30,031
PsiElement (PsiElement element, PsiElement originalElement) { if (element instanceof GrGdkMethod method) { element = method.getStaticMethod(); } final GrDocComment doc = PsiTreeUtil.getParentOfType(originalElement, GrDocComment.class); if (doc != null) { element = GrDocCommentUtil.findDocOwner(doc); } if (element instanceof GrLightVariable var) { PsiElement navigationElement = var.getNavigationElement(); element = navigationElement; if (element.getContainingFile() instanceof PsiCompiledFile) { navigationElement = element.getNavigationElement(); if (navigationElement != null) { element = navigationElement; } } if (element instanceof GrAccessorMethod method) { element = method.getProperty(); } } if (element instanceof GrPropertyForCompletion property) { element = property.getOriginalAccessor(); } return element; }
getDocumentationElement
30,032
boolean (PsiElement element, PsiElement originalElement) { return CompositeDocumentationProvider.hasUrlsFor(this, element, originalElement); }
hasDocumentationFor
30,033
boolean (PsiElement element) { return false; }
canPromptToConfigureDocumentation
30,034
void (PsiElement element) { }
promptToConfigureDocumentation
30,035
void (@NonNls StringBuilder sb, PsiElement element, String label) { getDocInfoGenerator(element, false) .appendMaybeUnresolvedLink(sb, element, label, element.getProject(), false); }
appendElementLink
30,036
PsiElement (PsiManager psiManager, Object object, PsiElement element) { if (object instanceof GroovyResolveResult) { return ((GroovyResolveResult)object).getElement(); } if (object instanceof NamedArgumentDescriptor) { return ((NamedArgumentDescriptor)object).getNavigationElement(); } if (object instanceof GrPropertyForCompletion) { return ((GrPropertyForCompletion)object).getOriginalAccessor(); } return null; }
getDocumentationElementForLookupItem
30,037
PsiElement (PsiManager psiManager, String link, PsiElement context) { return JavaDocUtil.findReferenceTarget(psiManager, link, context); }
getDocumentationElementForLink
30,038
PsiComment (PsiComment contextElement) { if (contextElement instanceof GrDocComment) { final GrDocCommentOwner owner = GrDocCommentUtil.findDocOwner((GrDocComment)contextElement); if (owner != null) { return owner.getDocComment(); } } return null; }
findExistingDocComment
30,039
String (PsiComment contextComment) { if (!(contextComment instanceof GrDocComment)) { return null; } final GrDocCommentOwner owner = GrDocCommentUtil.findDocOwner((GrDocComment)contextComment); if (owner == null) return null; final CodeDocumentationAwareCommenter commenter = (CodeDocumentationAwareCommenter)LanguageCommenters.INSTANCE.forLanguage(owner.getLanguage()); StringBuilder builder = new StringBuilder(); if (owner instanceof GrMethod method) { JavaDocumentationProvider.generateParametersTakingDocFromSuperMethods(builder, commenter, method); final PsiType returnType = method.getInferredReturnType(); if ((returnType != null || method.getModifierList().hasModifierProperty(GrModifier.DEF)) && !PsiTypes.voidType().equals(returnType)) { builder.append(CodeDocumentationUtil.createDocCommentLine(RETURN_TAG, contextComment.getContainingFile(), commenter)); builder.append(LINE_SEPARATOR); } final PsiClassType[] references = method.getThrowsList().getReferencedTypes(); for (PsiClassType reference : references) { builder.append(CodeDocumentationUtil.createDocCommentLine(THROWS_TAG, contextComment.getContainingFile(), commenter)); builder.append(reference.getClassName()); builder.append(LINE_SEPARATOR); } } else if (owner instanceof GrTypeDefinition) { final PsiTypeParameterList typeParameterList = ((PsiClass)owner).getTypeParameterList(); if (typeParameterList != null) { JavaDocumentationProvider.createTypeParamsListComment(builder, commenter, typeParameterList); } } return builder.length() > 0 ? builder.toString() : null; }
generateDocumentationContentStub
30,040
void (@NotNull PsiFile file, @NotNull Consumer<? super @NotNull PsiDocCommentBase> sink) { if (!(file instanceof GroovyFile groovyFile)) { return; } List<GrDocCommentOwner> owners = PsiTreeUtil.getChildrenOfTypeAsList(groovyFile, GrDocCommentOwner.class); List<GrDocComment> comments = PsiTreeUtil.getChildrenOfTypeAsList(groovyFile, GrDocComment.class); processDocComments(owners, comments, sink); }
collectDocComments
30,041
void (@NotNull List<GrDocCommentOwner> owners, @NonNls List<GrDocComment> danglingDocComments, @NotNull Consumer<? super @NotNull PsiDocCommentBase> sink) { for (var docComment : danglingDocComments) { if (docComment != null) { sink.accept(docComment); } } for (var owner : owners) { if (owner == null) { continue; } GrDocComment comment = owner.getDocComment(); if (comment != null) { sink.accept(comment); } if (owner instanceof GrTypeDefinition) { var nestedComments = PsiTreeUtil.getChildrenOfTypeAsList(((GrTypeDefinition)owner).getBody(), GrDocComment.class); var nestedOwners = PsiTreeUtil.getChildrenOfTypeAsList(((GrTypeDefinition)owner).getBody(), GrDocCommentOwner.class); processDocComments(nestedOwners, nestedComments, sink); } } }
processDocComments
30,042
boolean (@Nullable PsiElement element) { return element != null && element.getNode().getElementType() == mGDOC_ASTERISKS; }
isLeadingAsterisks
30,043
void (StringBuilder buffer, PsiElement element) { element.accept(new PsiRecursiveElementWalkingVisitor() { @Override public void visitElement(@NotNull PsiElement element) { super.visitElement(element); IElementType type = element.getNode().getElementType(); if (type == mGDOC_TAG_VALUE_LPAREN || type == mGDOC_TAG_VALUE_RPAREN || type == mGDOC_TAG_VALUE_SHARP_TOKEN || type == mGDOC_TAG_VALUE_TOKEN || type == mGDOC_TAG_VALUE_COMMA || type == mGDOC_COMMENT_DATA) { buffer.append(element.getText()); } } }); }
collectElementText
30,044
void (@NotNull PsiElement element) { super.visitElement(element); IElementType type = element.getNode().getElementType(); if (type == mGDOC_TAG_VALUE_LPAREN || type == mGDOC_TAG_VALUE_RPAREN || type == mGDOC_TAG_VALUE_SHARP_TOKEN || type == mGDOC_TAG_VALUE_TOKEN || type == mGDOC_TAG_VALUE_COMMA || type == mGDOC_COMMENT_DATA) { buffer.append(element.getText()); } }
visitElement
30,045
String () { //noinspection DialogTitleCapitalization return GroovyBundle.message("surround.with.closure"); }
getTemplateDescription
30,046
TextRange (GroovyPsiElement element) { element.accept(new MyRestoringVisitor()); assert element instanceof GrMethodCallExpression; final int offset = element.getTextRange().getEndOffset(); return new TextRange(offset, offset); }
getSurroundSelectionRange
30,047
void (@NotNull GrReferenceExpression ref) { if (ref.getQualifierExpression() == null) { //only unqualified references could change their targets final GroovyResolveResult resolveResult = ref.advancedResolve(); ref.putCopyableUserData(REF_RESOLVE_RESULT_KEY, resolveResult); } super.visitReferenceExpression(ref); }
visitReferenceExpression
30,048
void (@NotNull GrReferenceExpression ref) { final GroovyResolveResult oldResult = ref.getCopyableUserData(REF_RESOLVE_RESULT_KEY); if (oldResult != null) { assert ref.getQualifierExpression() == null; final GroovyResolveResult newResult = ref.advancedResolve(); final PsiElement oldElement = oldResult.getElement(); final PsiElement newElement = newResult.getElement(); if (!ref.getManager().areElementsEquivalent(oldElement, newElement) || oldResult.getCurrentFileResolveContext() != newResult.getCurrentFileResolveContext()) { final GrReferenceExpression qualifier = GroovyPsiElementFactory.getInstance(ref.getProject()).createReferenceExpressionFromText("owner"); ref.setQualifier(qualifier); } } super.visitReferenceExpression(ref); }
visitReferenceExpression
30,049
TextRange (GroovyPsiElement element) { assert element instanceof GrForStatement; GrForClause clause = ((GrForStatement) element).getClause(); int endOffset = element.getTextRange().getEndOffset(); if (clause != null) { endOffset = clause.getTextRange().getStartOffset(); clause.getParent().getNode().removeChild(clause.getNode()); } return new TextRange(endOffset, endOffset); }
getSurroundSelectionRange
30,050
String () { return GroovyBundle.message("surround.with.for"); }
getTemplateDescription
30,051
String () { //noinspection DialogTitleCapitalization return GroovyBundle.message("surround.with.try.catch.finally"); }
getTemplateDescription
30,052
TextRange (@NotNull GrExpression expression, PsiElement context) { GrParenthesizedExpression parenthesized = (GrParenthesizedExpression) GroovyPsiElementFactory.getInstance(expression.getProject()).createExpressionFromText("((Type)a)", context); GrTypeCastExpression typeCast = (GrTypeCastExpression) parenthesized.getOperand(); replaceToOldExpression(typeCast.getOperand(), expression); GrTypeElement typeElement = typeCast.getCastTypeElement(); int endOffset = typeElement.getTextRange().getStartOffset() + expression.getTextRange().getStartOffset(); parenthesized = (GrParenthesizedExpression) expression.replaceWithExpression(parenthesized, false); final GrTypeCastExpression newTypeCast = (GrTypeCastExpression)parenthesized.getOperand(); final GrTypeElement newTypeElement = newTypeCast.getCastTypeElement(); newTypeElement.delete(); return new TextRange(endOffset, endOffset); }
surroundExpression
30,053
String () { //noinspection DialogTitleCapitalization return GroovyBundle.message("surround.with.cast"); }
getTemplateDescription
30,054
String () { return "with(a){\n}"; }
getReplacementTokens
30,055
String () { return GroovyBundle.message("surround.with.with"); }
getTemplateDescription
30,056
TextRange (@NotNull GrExpression expression, PsiElement context) { GrParenthesizedExpression result = (GrParenthesizedExpression) GroovyPsiElementFactory.getInstance(expression.getProject()).createExpressionFromText("(a)", context); replaceToOldExpression(result.getOperand(), expression); result = (GrParenthesizedExpression) expression.replaceWithExpression(result, true); return new TextRange(result.getTextRange().getEndOffset(), result.getTextRange().getEndOffset()); }
surroundExpression
30,057
String () { //noinspection DialogTitleCapitalization return GroovyBundle.message("surround.with.parentheses"); }
getTemplateDescription
30,058
String () { return "shouldFail(a){\n}"; }
getReplacementTokens
30,059
String () { //noinspection DialogTitleCapitalization return GroovyBundle.message("surround.with.shouldFail"); }
getTemplateDescription
30,060
TextRange (GroovyPsiElement element) { assert element instanceof GrIfStatement; GrCondition condition = ((GrIfStatement)element).getCondition(); int endOffset = element.getTextRange().getEndOffset(); if (condition != null) { PsiElement child = condition.getFirstChild(); assert child != null; endOffset = child.getTextRange().getStartOffset(); condition.getParent().getNode().removeChild(condition.getNode()); } return new TextRange(endOffset, endOffset); }
getSurroundSelectionRange
30,061
String () { return GroovyBundle.message("surround.with.if"); }
getTemplateDescription
30,062
TextRange (@NotNull GrExpression expression, @Nullable PsiElement context) { final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(expression.getProject()); final GrUnaryExpression template = (GrUnaryExpression)factory.createExpressionFromText("!(a)", context); assert template.getOperand() != null; GroovyExpressionSurrounder.replaceToOldExpression(((GrParenthesizedExpression)template.getOperand()).getOperand(), expression); final GrExpression result = expression.replaceWithExpression(template, true); final int endOffset = result.getTextRange().getEndOffset(); return new TextRange(endOffset, endOffset); }
surroundExpression
30,063
String () { return "!(expr)"; }
getTemplateDescription
30,064
TextRange (@NotNull GrExpression expression, PsiElement context) { GrWhileStatement whileStatement = (GrWhileStatement) GroovyPsiElementFactory.getInstance(expression.getProject()).createStatementFromText("while(a){4\n}", context); replaceToOldExpression(whileStatement.getCondition(), expression); whileStatement = expression.replaceWithStatement(whileStatement); GrStatement body = whileStatement.getBody(); assert body instanceof GrBlockStatement; GrStatement[] statements = ((GrBlockStatement) body).getBlock().getStatements(); assert statements.length > 0; GrStatement statement = statements[0]; int offset = statement.getTextRange().getStartOffset(); statement.getNode().getTreeParent().removeChild(statement.getNode()); return new TextRange(offset, offset); }
surroundExpression
30,065
String () { //noinspection DialogTitleCapitalization return GroovyBundle.message("surround.with.while.expr"); }
getTemplateDescription
30,066
String () { return "{}"; }
getTemplateDescription
30,067
TextRange (GroovyPsiElement element) { final int offset = element.getTextRange().getEndOffset(); return new TextRange(offset, offset); }
getSurroundSelectionRange
30,068
TextRange (GroovyPsiElement element) { assert element instanceof GrMethodCallExpression; GrMethodCallExpression withCall = (GrMethodCallExpression) element; GrCondition condition = withCall.getExpressionArguments()[0]; int endOffset = condition.getTextRange().getStartOffset(); condition.getParent().getNode().removeChild(condition.getNode()); return new TextRange(endOffset, endOffset); }
getSurroundSelectionRange
30,069
TextRange (GroovyPsiElement element) { assert element instanceof GrWhileStatement; GrCondition condition = ((GrWhileStatement) element).getCondition(); int endOffset = element.getTextRange().getEndOffset(); if (condition != null) { endOffset = condition.getTextRange().getStartOffset(); condition.getParent().getNode().removeChild(condition.getNode()); } return new TextRange(endOffset, endOffset); }
getSurroundSelectionRange
30,070
String () { //noinspection DialogTitleCapitalization return GroovyBundle.message("surround.with.while"); }
getTemplateDescription
30,071
boolean (PsiElement @NotNull [] elements) { if (elements.length == 0) return false; for (PsiElement element : elements) { if (!isStatement(element)) return false; } if (elements[0] instanceof GrBlockStatement) { return false; } return true; }
isApplicable
30,072
boolean (@NotNull PsiElement element) { return ";".equals(element.getText()) || element instanceof PsiComment || StringUtil.isEmptyOrSpaces(element.getText()) || PsiUtil.isExpressionStatement(element); }
isStatement
30,073
boolean () { return false; }
isExclusive
30,074
TextRange (@NotNull GrExpression expression, PsiElement context) { GrMethodCallExpression call = (GrMethodCallExpression) GroovyPsiElementFactory.getInstance(expression.getProject()).createStatementFromText("with(a){4\n}", context); replaceToOldExpression(call.getExpressionArguments()[0], expression); call = expression.replaceWithStatement(call); GrClosableBlock block = call.getClosureArguments()[0]; GrStatement statementInBody = block.getStatements()[0]; int offset = statementInBody.getTextRange().getStartOffset(); statementInBody.getParent().getNode().removeChild(statementInBody.getNode()); return new TextRange(offset, offset); }
surroundExpression
30,075
String () { //noinspection DialogTitleCapitalization return GroovyBundle.message("surround.with.with.expr"); }
getTemplateDescription
30,076
String () { //noinspection DialogTitleCapitalization return GroovyBundle.message("surround.with.try.finally"); }
getTemplateDescription
30,077
boolean (@NotNull PsiElement element) { if (!GroovyManyStatementsSurrounder.isStatement(element) || !(element instanceof GrExpression)) return false; PsiType type = ((GrExpression)element).getType(); return PsiTypes.booleanType().equals(type) || PsiTypes.booleanType().equals(PsiPrimitiveType.getUnboxedType(type)); }
isApplicable
30,078
TextRange (@NotNull GrExpression expression, PsiElement context) { GrIfStatement ifStatement = (GrIfStatement) GroovyPsiElementFactory.getInstance(expression.getProject()).createStatementFromText("if(a){4\n} else{\n}", context); replaceToOldExpression(ifStatement.getCondition(), expression); ifStatement = expression.replaceWithStatement(ifStatement); GrStatement psiElement = ifStatement.getThenBranch(); assert psiElement instanceof GrBlockStatement; GrStatement[] statements = ((GrBlockStatement) psiElement).getBlock().getStatements(); assert statements.length > 0; GrStatement statement = statements[0]; int endOffset = statement.getTextRange().getStartOffset(); statement.getNode().getTreeParent().removeChild(statement.getNode()); return new TextRange(endOffset, endOffset); }
surroundExpression
30,079
String () { //noinspection DialogTitleCapitalization return GroovyBundle.message("surround.with.if.else.expr"); }
getTemplateDescription
30,080
TextRange (@NotNull GrExpression expression, PsiElement context) { GrIfStatement ifStatement = (GrIfStatement) GroovyPsiElementFactory.getInstance(expression.getProject()).createStatementFromText("if(a){4\n}", context); replaceToOldExpression(ifStatement.getCondition(), expression); ifStatement = expression.replaceWithStatement(ifStatement); GrStatement thenBranch = ifStatement.getThenBranch(); assert thenBranch instanceof GrBlockStatement; GrStatement[] statements = ((GrBlockStatement) thenBranch).getBlock().getStatements(); assert statements.length > 0; GrStatement statement = statements[0]; int endOffset = statement.getTextRange().getStartOffset(); statement.getNode().getTreeParent().removeChild(statement.getNode()); return new TextRange(endOffset, endOffset); }
surroundExpression
30,081
String () { //noinspection DialogTitleCapitalization return GroovyBundle.message("surround.with.if.expr"); }
getTemplateDescription
30,082
TextRange (GroovyPsiElement element) { assert element instanceof GrTryCatchStatement; int endOffset = element.getTextRange().getEndOffset(); GrTryCatchStatement tryCatchStatement = (GrTryCatchStatement) element; GrCatchClause[] catchClauses = tryCatchStatement.getCatchClauses(); if (catchClauses.length > 0) { GrParameter parameter = catchClauses[0].getParameter(); if (parameter == null) { GrOpenBlock block = catchClauses[0].getBody(); assert block != null; endOffset = block.getTextRange().getEndOffset(); } else { endOffset = parameter.getTextRange().getStartOffset(); parameter.getParent().getNode().removeChild(parameter.getNode()); } } else { GrOpenBlock block = tryCatchStatement.getTryBlock(); if (block != null) { GrStatement[] statements = block.getStatements(); if (statements.length > 0) { endOffset = statements[0].getTextRange().getStartOffset(); } } } return new TextRange(endOffset, endOffset); }
getSurroundSelectionRange
30,083
String () { //noinspection DialogTitleCapitalization return GroovyBundle.message("surround.with.try"); }
getTemplateDescription
30,084
boolean (@NotNull PsiElement element) { return element instanceof GrExpression; }
isApplicable
30,085
boolean (PsiElement @NotNull [] elements) { return elements.length == 1 && isApplicable(elements[0]); }
isApplicable
30,086
void (GrExpression oldExpr, GrExpression replacement) { oldExpr.replaceWithExpression(replacement, false); }
replaceToOldExpression
30,087
String () { //noinspection DialogTitleCapitalization return GroovyBundle.message("surround.with.try.catch"); }
getTemplateDescription
30,088
String () { //noinspection DialogTitleCapitalization return GroovyBundle.message("surround.with.if.else"); }
getTemplateDescription
30,089
void (@NotNull GroovyFile file, @NotNull GroovyScriptRunConfiguration configuration, Location location) { }
tuneConfiguration
30,090
GroovyScriptRunner () { return null; }
getRunner
30,091
boolean (@NotNull GroovyScriptRunConfiguration existing, @NotNull Location location) { return true; }
isConfigurationByLocation
30,092
void (@NotNull GroovyMapContentProvider contentProvider, @NotNull GrExpression qualifier, @Nullable PsiElement resolve, @NotNull CompletionResultSet result) { for (String key : contentProvider.getKeyVariants(qualifier, resolve)) { LookupElement lookup = LookupElementBuilder.create(key); lookup = PrioritizedLookupElement.withPriority(lookup, 1); result.addElement(lookup); } }
addKeyVariants
30,093
boolean (@NotNull String runtimeName) { return false; }
isAppropriateRuntimeName
30,094
String (@NotNull ReferenceType refType, @NotNull final String runtimeName) { return null; }
getOriginalScriptName
30,095
boolean (@NotNull GroovyFile scriptFile) { return false; }
isAppropriateScriptFile
30,096
String (@NotNull GroovyFile groovyFile) { return null; }
getRuntimeScriptName
30,097
PsiFile (@NotNull ReferenceType refType, @NotNull String runtimeName, @NotNull Project project, @NotNull GlobalSearchScope scope) { return null; }
getExtraScriptIfNotFound
30,098
String (@NotNull PsiClass psiClass) { return null; }
customizeClassName
30,099
boolean (@NotNull final String runtimeName) { return true; }
isAppropriateRuntimeName