Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
31,100 | boolean () { if (myPanel.isMoveToAnotherClass()) { try { myEditor.putUserData(INTRODUCE_RESTART, true); myEditor.putUserData(ACTIVE_INTRODUCE, this); final GrIntroduceConstantHandler constantHandler = new GrIntroduceConstantHandler(); final GrVariable localVariable = getLocalVariable(); constantHandler.getContextAndInv... | performRefactoring |
31,101 | boolean () { return myMoveToAnotherClassJBCheckBox.isSelected(); } | isMoveToAnotherClass |
31,102 | JComponent () { return myRootPane; } | getRootPane |
31,103 | void () { myPreview = getPreviewComponent(); } | createUIComponents |
31,104 | String () { return HelpID.INTRODUCE_CONSTANT; } | getHelpID |
31,105 | void (@NotNull GrExpression selectedExpr) { GrVariable variable = GrIntroduceHandlerBase.resolveLocalVar(selectedExpr); if (variable != null) { checkVariable(variable); } else { selectedExpr.accept(new ConstantChecker(selectedExpr, selectedExpr)); } } | checkExpression |
31,106 | void (PsiElement @NotNull [] occurrences) { if (hasLhs(occurrences)) { throw new GrRefactoringError(GroovyRefactoringBundle.message("selected.variable.is.used.for.write")); } } | checkOccurrences |
31,107 | PsiClass (GrIntroduceContext context) { return (PsiClass)context.getScope(); } | findContainingClass |
31,108 | GrIntroduceDialog<GrIntroduceConstantSettings> (@NotNull GrIntroduceContext context) { return new GrIntroduceConstantDialog(context, findContainingClass(context)); } | getDialog |
31,109 | GrField (@NotNull GrIntroduceContext context, @NotNull GrIntroduceConstantSettings settings) { return new GrIntroduceConstantProcessor(context, settings).run(); } | runRefactoring |
31,110 | GrAbstractInplaceIntroducer<GrIntroduceConstantSettings> (@NotNull GrIntroduceContext context, @NotNull OccurrencesChooser.ReplaceChoice choice) { final Ref<GrIntroduceContext> contextRef = Ref.create(context); if (context.getStringPart() != null) { extractStringPart(contextRef); } return new GrInplaceConstantIntroduce... | getIntroducer |
31,111 | void (@NotNull GrReferenceExpression referenceExpression) { final PsiElement resolved = referenceExpression.resolve(); if (resolved instanceof PsiVariable) { if (!isStaticFinalField((PsiVariable)resolved)) { if (expr instanceof GrClosableBlock) { if (!PsiTreeUtil.isContextAncestor(scope, resolved, true)) { throw new Gr... | visitReferenceExpression |
31,112 | boolean (PsiVariable var) { return var instanceof PsiField && var.hasModifierProperty(PsiModifier.FINAL) && var.hasModifierProperty(PsiModifier.STATIC); } | isStaticFinalField |
31,113 | void (@NotNull GrClosableBlock closure) { if (closure == expr) { super.visitClosure(closure); } else { closure.accept(new ConstantChecker(closure, scope)); } } | visitClosure |
31,114 | LinkedHashSet<String> () { final GrExpression expression = myContext.getExpression(); final GrVariable var = myContext.getVar(); final StringPartInfo stringPart = myContext.getStringPart(); if (expression != null) { return new LinkedHashSet<>(Arrays.asList(GroovyNameSuggestionUtil.suggestVariableNames(expression, myVal... | suggestNames |
31,115 | JComponent () { return myNameField; } | getPreferredFocusedComponent |
31,116 | void (ItemEvent e) { myNameField.requestFocusInWindow(); checkErrors(); if (myReplaceAllOccurrencesCheckBox.isSelected()) { PsiElement anchor = GrIntroduceHandlerBase.findAnchor(myContext.getOccurrences(), myContext.getScope()); if (anchor != null && anchor != myContext.getScope() && anchor != ((GrTypeDefinition)myCont... | itemStateChanged |
31,117 | void () { List<String> errors = new ArrayList<>(); if (myCurrentMethodRadioButton.isSelected() && myDeclareFinalCheckBox.isSelected() && !isInvokedInAlwaysInvokedConstructor) { errors.add(GroovyRefactoringBundle.message("final.field.cant.be.initialized.in.cur.method")); } if (myDeclareFinalCheckBox.isSelected() && myRe... | checkErrors |
31,118 | boolean (@NotNull GrIntroduceContext context) { if (context.getVar() == null && !(context.getExpression() instanceof GrReferenceExpression)) return false; if (GrIntroduceHandlerBase.hasLhs(context.getOccurrences())) return true; return false; } | hasLhsUsages |
31,119 | void () { ButtonGroup visibility = new ButtonGroup(); visibility.add(myPrivateRadioButton); visibility.add(myProtectedRadioButton); visibility.add(myPublicRadioButton); visibility.add(myPropertyRadioButton); if (myContext.getScope() instanceof GroovyScriptClass) { myPropertyRadioButton.setSelected(true); myPrivateRadio... | initVisibility |
31,120 | boolean (@Nullable PsiMethod method, @NotNull PsiClass clazz) { if (method == null) return false; if (!method.isConstructor()) return false; final PsiMethod[] constructors = clazz.getConstructors(); if (constructors.length == 1) return true; final GrConstructorInvocation invocation = PsiImplUtil.getChainingConstructorI... | isAlwaysInvokedConstructor |
31,121 | boolean (PsiElement @NotNull [] occurrences, PsiElement scope) { if (occurrences.length == 0) return true; GrMember container = GrIntroduceFieldHandler.getContainer(occurrences[0], scope); if (container == null) return false; for (int i = 1; i < occurrences.length; i++) { GrMember other = GrIntroduceFieldHandler.getCon... | allOccurrencesInOneMethod |
31,122 | JComponent () { myNameLabel.setLabelFor(myNameField); myTypeLabel.setLabelFor(myTypeComboBox); return myContentPane; } | createCenterPanel |
31,123 | GrIntroduceFieldSettings () { return this; } | getSettings |
31,124 | LinkedHashSet<String> () { return new GrFieldNameSuggester(myContext, new GroovyFieldValidator(myContext), false).suggestNames(); } | suggestNames |
31,125 | void () { final GrExpression expression = myContext.getExpression(); final GrVariable var = myContext.getVar(); final StringPartInfo stringPart = myContext.getStringPart(); List<String> list = new ArrayList<>(); if (var != null) { list.add(var.getName()); } list.addAll(suggestNames()); myNameField = new NameSuggestions... | createUIComponents |
31,126 | boolean () { return myDeclareFinalCheckBox.isSelected(); } | declareFinal |
31,127 | Init () { if (myCurrentMethodRadioButton.isSelected()) return Init.CUR_METHOD; if (myFieldDeclarationRadioButton.isSelected()) return Init.FIELD_DECLARATION; if (myClassConstructorSRadioButton.isSelected()) return Init.CONSTRUCTOR; if (mySetUpMethodRadioButton.isSelected()) return Init.SETUP_METHOD; throw new Incorrect... | initializeIn |
31,128 | String () { if (myPrivateRadioButton.isSelected()) return PsiModifier.PRIVATE; if (myProtectedRadioButton.isSelected()) return PsiModifier.PROTECTED; if (myPublicRadioButton.isSelected()) return PsiModifier.PUBLIC; if (myPropertyRadioButton.isSelected()) return PsiModifier.PACKAGE_LOCAL; throw new IncorrectOperationExc... | getVisibilityModifier |
31,129 | boolean () { return myIsStatic; } | isStatic |
31,130 | boolean () { return myInvokedOnLocalVar != null && myReplaceAllOccurrencesCheckBox.isSelected(); } | removeLocalVar |
31,131 | String () { return myNameField.getEnteredName(); } | getName |
31,132 | boolean () { return myReplaceAllOccurrencesCheckBox.isSelected(); } | replaceAllOccurrences |
31,133 | PsiType () { return myTypeComboBox.getSelectedType(); } | getSelectedType |
31,134 | String (GrExpression expression) { if (expression instanceof GrReferenceExpression) { final PsiElement resolved = ((GrReferenceExpression)expression).resolve(); if (PsiUtil.isLocalVariable(resolved)) { return ((GrVariable)resolved).getName(); } } return null; } | getInvokedOnLocalVar |
31,135 | boolean (@NotNull GrIntroduceContext context, @NotNull PsiClass clazz) { final StringPartInfo part = context.getStringPart(); GrExpression expression = context.getExpression(); if (expression != null) { expression = (GrExpression)PsiUtil.skipParentheses(expression, false); if (expression == null) return false; if (expr... | canBeInitializedOutsideBlock |
31,136 | void (@NotNull GrReferenceExpression refExpr) { super.visitReferenceExpression(refExpr); final PsiElement resolved = refExpr.resolve(); if (!(resolved instanceof GrVariable)) return; if (resolved instanceof GrField && myClass.getManager().areElementsEquivalent(myClass, ((GrField)resolved).getContainingClass())) { retur... | visitReferenceExpression |
31,137 | boolean () { return result; } | isResult |
31,138 | void () { setOKActionEnabled(GroovyNamesUtil.isIdentifier(getName())); } | validateOKAction |
31,139 | void () { final PsiClass clazz = (PsiClass)myContext.getScope(); final String name = getName(); String message = RefactoringBundle.message("field.exists", name, clazz.getQualifiedName()); if (clazz.findFieldByName(name, true) != null && Messages.showYesNoDialog(myContext.getProject(), message, IntroduceFieldHandler.get... | doOKAction |
31,140 | String () { return myName; } | toString |
31,141 | GrVariable () { PsiElement scope = myContext.getScope(); final PsiClass targetClass = scope instanceof GroovyFileBase ? ((GroovyFileBase)scope).getScriptClass() : (PsiClass)scope; if (targetClass == null) return null; final GrVariableDeclaration declaration = insertField(targetClass); final GrVariable field = declarati... | run |
31,142 | List<PsiElement> (@NotNull PsiClass targetClass, @NotNull GrVariable field) { if (myContext.getStringPart() != null) { final GrExpression expr = myContext.getStringPart().replaceLiteralWithConcatenation(field.getName()); final PsiElement occurrence = replaceOccurrence(field, expr, targetClass); updateCaretPosition(occu... | processOccurrences |
31,143 | void (@NotNull PsiElement occurrence) { myContext.getEditor().getCaretModel().moveToOffset(occurrence.getTextRange().getEndOffset()); myContext.getEditor().getSelectionModel().removeSelection(); } | updateCaretPosition |
31,144 | GrVariableDeclaration (@NotNull PsiClass targetClass) { GrVariableDeclaration declaration = createField(targetClass); if (targetClass instanceof GrEnumTypeDefinition) { final GrEnumConstantList enumConstants = ((GrEnumTypeDefinition)targetClass).getEnumConstantList(); return (GrVariableDeclaration)targetClass.addAfter(... | insertField |
31,145 | PsiElement (@NotNull GrTypeDefinition targetClass) { final GrTypeDefinitionBody body = targetClass.getBody(); if (body == null) return null; PsiElement anchor = body.getLBrace(); final GrMembersDeclaration[] declarations = targetClass.getMemberDeclarations(); for (GrMembersDeclaration declaration : declarations) { if (... | getAnchorForDeclaration |
31,146 | void (@NotNull GrVariable field, @Nullable GrStatementOwner container, @Nullable GrStatement anchor, @Nullable PsiElement occurence) { if (!mySettings.replaceAllOccurrences() && PsiUtil.isExpressionStatement(occurence) && Comparing.equal(anchor, occurence)) { generateAssignment(field, anchor, container, occurence); } e... | initializeInMethodInner |
31,147 | void (@NotNull GrVariable field, @NotNull PsiClass scope, @NotNull Collection<PsiElement> replaced) { PsiMethod[] constructors = scope.getConstructors(); if (constructors.length == 0) { constructors = new PsiMethod[]{generateConstructor(scope)}; } for (PsiMethod constructor : constructors) { final GrConstructorInvocati... | initializeInConstructor |
31,148 | PsiMethod (@NotNull PsiClass scope) { final String name = scope.getName(); LOG.assertTrue(name != null, scope.getText()); GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(myContext.getProject()); final GrMethod constructor = factory.createConstructorFromText(name, ArrayUtilRt.EMPTY_STRING_ARRAY, Ar... | generateConstructor |
31,149 | void (@NotNull GrVariable field, @NotNull GrAnonymousClassDefinition scope, @NotNull Collection<PsiElement> replaced) { final GrClassInitializer[] initializers = scope.getInitializers(); GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(myContext.getProject()); final GrClassInitializer initializer =... | initializeInAnonymousClassInitializer |
31,150 | void (@NotNull GrVariable field, @Nullable GrStatement anchor, @Nullable GrStatementOwner defaultContainer, @Nullable PsiElement occurrenceToDelete) { if (myInitializer == null || defaultContainer == null) return; GrAssignmentExpression init = (GrAssignmentExpression)GroovyPsiElementFactory.getInstance(myContext.getPro... | generateAssignment |
31,151 | GrExpression () { assert myLocalVariable != null; return myLocalVariable.getInitializerGroovy(); } | extractVarInitializer |
31,152 | GrStatement (@Nullable final GrCodeBlock block, @NotNull Collection<PsiElement> replaced) { if (block == null) return null; final List<PsiElement> elements = ContainerUtil.findAll(replaced, element -> PsiTreeUtil.isAncestor(block, element, true)); if (elements.isEmpty()) return null; return (GrStatement)GrIntroduceHand... | findAnchorForAssignment |
31,153 | PsiElement (@NotNull GrVariable field, @NotNull PsiElement occurrence, @NotNull PsiClass containingClass) { boolean isOriginal = occurrence == myContext.getExpression(); final GrReferenceExpression newExpr = createRefExpression(field, occurrence, containingClass); final PsiElement replaced; if (occurrence instanceof Gr... | replaceOccurrence |
31,154 | GrReferenceExpression (@NotNull GrVariable field, @NotNull PsiElement place, @NotNull PsiClass containingClass) { final String qname = containingClass instanceof GroovyScriptClass ? null : containingClass.getQualifiedName(); final String prefix = qname != null ? qname + "." : ""; final String refText; if (field.hasModi... | createRefExpression |
31,155 | GrVariableDeclaration (@NotNull PsiClass targetClass) { final String name = mySettings.getName(); final PsiType type = mySettings.getSelectedType(); final String modifier = mySettings.getVisibilityModifier(); List<String> modifiers = new ArrayList<>(); if (targetClass instanceof GroovyScriptClass) { modifiers.add("@" +... | createField |
31,156 | GrExpression () { if (mySettings.removeLocalVar()) { return extractVarInitializer(); } GrExpression expression = myContext.getExpression(); StringPartInfo stringPart = myContext.getStringPart(); if (expression != null) { return expression; } else if (stringPart != null) { return stringPart.createLiteralFromSelected(); ... | getInitializer |
31,157 | String () { return HelpID.INTRODUCE_FIELD; } | getHelpID |
31,158 | void (@NotNull GrExpression selectedExpr) { checkContainingClass(selectedExpr); } | checkExpression |
31,159 | void (PsiElement place) { final PsiClass containingClass = PsiUtil.getContextClass(place); if (containingClass == null) throw new GrRefactoringError(GroovyRefactoringBundle.message("cannot.introduce.field.in.script")); if (containingClass.isInterface()) { throw new GrRefactoringError(GroovyRefactoringBundle.message("ca... | checkContainingClass |
31,160 | void (PsiElement @NotNull [] occurrences) { //nothing to do } | checkOccurrences |
31,161 | GrIntroduceDialog<GrIntroduceFieldSettings> (@NotNull GrIntroduceContext context) { return new GrIntroduceFieldDialog(context); } | getDialog |
31,162 | GrVariable (@NotNull GrIntroduceContext context, @NotNull GrIntroduceFieldSettings settings) { return new GrIntroduceFieldProcessor(context, settings).run(); } | runRefactoring |
31,163 | GrAbstractInplaceIntroducer<GrIntroduceFieldSettings> (@NotNull GrIntroduceContext context, @NotNull OccurrencesChooser.ReplaceChoice choice) { final Ref<GrIntroduceContext> contextRef = Ref.create(context); if (context.getStringPart() != null) { extractStringPart(contextRef); } return new GrInplaceFieldIntroducer(cont... | getIntroducer |
31,164 | GrMember (@Nullable PsiElement place, @Nullable PsiElement scope) { while (place != null && place != scope) { place = place.getParent(); if (place instanceof GrMember) return (GrMember)place; } return null; } | getContainer |
31,165 | boolean (PsiElement expr, PsiElement clazz) { final GrMember method = getContainer(expr, clazz); if (method == null) return false; return method.hasModifierProperty(PsiModifier.STATIC); } | shouldBeStatic |
31,166 | PsiElement () { final GrVariable variable = getVariable(); if (variable instanceof PsiField) { return ((PsiField)getVariable()).getContainingClass(); } else { final PsiFile file = variable.getContainingFile(); if (file instanceof GroovyFile) { return ((GroovyFile)file).getScriptClass(); } else { return null; } } } | checkLocalScope |
31,167 | GrVariable (GrIntroduceContext context, GrIntroduceFieldSettings settings, boolean processUsages) { return refactorInWriteAction(() -> { GrIntroduceFieldProcessor processor = new GrIntroduceFieldProcessor(context, settings); return processUsages ? processor.run() : processor.insertField((PsiClass)context.getScope()).ge... | runRefactoring |
31,168 | GrIntroduceFieldSettings (@NotNull final GrIntroduceContext context, @NotNull final OccurrencesChooser.ReplaceChoice choice, final String[] names) { return new GrIntroduceFieldSettings() { @Override public boolean declareFinal() { return false; } @Override public Init initializeIn() { return Init.FIELD_DECLARATION; } @... | getInitialSettingsForInplace |
31,169 | boolean () { return false; } | declareFinal |
31,170 | Init () { return Init.FIELD_DECLARATION; } | initializeIn |
31,171 | String () { return PsiModifier.PRIVATE; } | getVisibilityModifier |
31,172 | boolean () { boolean hasInstanceInScope = true; PsiClass clazz = (PsiClass)context.getScope(); if (replaceAllOccurrences()) { for (PsiElement occurrence : context.getOccurrences()) { if (!PsiUtil.hasEnclosingInstanceInScope(clazz, occurrence, false)) { hasInstanceInScope = false; break; } } } else if (context.getExpres... | isStatic |
31,173 | boolean () { return myLocalVar != null; } | removeLocalVar |
31,174 | String () { return names[0]; } | getName |
31,175 | boolean () { return context.getVar() != null || choice == OccurrencesChooser.ReplaceChoice.ALL; } | replaceAllOccurrences |
31,176 | PsiType () { GrExpression expression = context.getExpression(); GrVariable var = context.getVar(); StringPartInfo stringPart = context.getStringPart(); return var != null ? var.getDeclaredType() : expression != null ? expression.getType() : stringPart != null ? stringPart.getLiteral().getType() : null; } | getSelectedType |
31,177 | GrIntroduceFieldSettings () { return new GrIntroduceFieldSettings() { @Override public boolean declareFinal() { return myPanel.isFinal(); } @Override public Init initializeIn() { return myPanel.getInitPlace(); } @Override public String getVisibilityModifier() { return PsiModifier.PRIVATE; } @Override public boolean isS... | getSettings |
31,178 | boolean () { return myPanel.isFinal(); } | declareFinal |
31,179 | Init () { return myPanel.getInitPlace(); } | initializeIn |
31,180 | String () { return PsiModifier.PRIVATE; } | getVisibilityModifier |
31,181 | boolean () { return myIsStatic; } | isStatic |
31,182 | boolean () { return myLocalVar != null; } | removeLocalVar |
31,183 | String () { return getInputName(); } | getName |
31,184 | boolean () { return isReplaceAllOccurrences(); } | replaceAllOccurrences |
31,185 | PsiType () { return GrInplaceFieldIntroducer.this.getSelectedType(); } | getSelectedType |
31,186 | String () { return IntroduceFieldHandler.getRefactoringNameText(); } | getActionName |
31,187 | void (@NotNull GrVariable variable) { } | saveSettings |
31,188 | void (@NotNull GrVariable psiField) { myIsStatic = psiField.hasModifierProperty(PsiModifier.STATIC); super.restoreState(psiField); } | restoreState |
31,189 | JComponent () { myPanel = new GrInplaceIntroduceFieldPanel(); return myPanel.getRootPane(); } | getComponent |
31,190 | void (ActionEvent e) { WriteCommandAction.writeCommandAction(myProject).withName(getCommandName()).withGroupId(getCommandName()).run(() -> { PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument()); final GrVariable variable = getVariable(); if (variable != null) { finalListener.perform(myDeclar... | actionPerformed |
31,191 | JPanel () { return myRootPane; } | getRootPane |
31,192 | boolean () { return myDeclareFinalCB.isSelected(); } | isFinal |
31,193 | void () { myPreview = getPreviewComponent(); } | createUIComponents |
31,194 | void (PsiElement toCheck, MultiMap<PsiElement, String> conflicts, String varName) { if (toCheck instanceof GrField && varName.equals(((GrField)toCheck).getName())) { conflicts.putValue(toCheck, GroovyRefactoringBundle.message("field.0.is.already.defined", CommonRefactoringUtil.htmlEmphasize(varName))); } if (toCheck in... | check |
31,195 | void (PsiElement toCheck, MultiMap<PsiElement, String> conflicts, String varName) { if (toCheck instanceof GrVariable && varName.equals(((GrVariable)toCheck).getName())) { conflicts.putValue(toCheck, GroovyRefactoringBundle.message("field.0.is.already.defined", CommonRefactoringUtil.htmlEmphasize(varName))); } if (toCh... | check |
31,196 | boolean () { return myChangeInfo.isNameChanged() || myChangeInfo.isParameterSetOrOrderChanged() || myChangeInfo.isExceptionSetOrOrderChanged(); } | needToChangeCalls |
31,197 | void (MultiMap<PsiElement, String> conflicts) { try { GrMethod prototype; final PsiMethod method = myChangeInfo.getMethod(); if (!(method instanceof GrMethod)) return; PsiManager manager = method.getManager(); GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(manager.getProject()); final CanonicalTy... | addMethodConflicts |
31,198 | String () { return myMethod.getName(); } | getName |
31,199 | List<GrParameterInfo> () { final ArrayList<GrParameterInfo> result = new ArrayList<>(); final GrParameter[] parameters = myMethod.getParameters(); for (int i = 0; i < parameters.length; i++) { GrParameter parameter = parameters[i]; GrParameterInfo info = new GrParameterInfo(parameter, i); result.add(info); } return res... | getParameters |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.