Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
41,100
PropertyCreationHandler () { return null; }
getPropertyCreationHandler
41,101
String (@NotNull final String value) { return null; }
suggestPropertyKey
41,102
IntentionAction () { return myFix; }
getFix
41,103
OptPane () { return pane(OptPane.stringList("myAdditionalLanguages", JavaI18nBundle.message("dissociate.resource.bundle.quick.fix.options.label"))); }
getOptionsPane
41,104
String () { return JavaI18nBundle.message("dissociate.resource.bundle.quick.fix.name"); }
getFamilyName
41,105
boolean () { return false; }
startInWriteAction
41,106
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { DissociateResourceBundleAction.dissociate(Collections.singleton(myResourceBundle), project); }
applyFix
41,107
boolean (@NotNull Project project, Editor editor, PsiFile file) { PsiModifierListOwner element = getElement(editor, file); if (element == null || (!ApplicationManager.getApplication().isUnitTestMode() && BaseIntentionAction.canModify(element)) || AnnotationUtil.findAnnotation(element, Nls.class.getName()) != null) retu...
isAvailable
41,108
String () { return getFamilyName(); }
getText
41,109
String () { return JavaI18nBundle.message("intention.family.annotate.capitalization.type"); }
getFamilyName
41,110
PopupStep (final Nls.Capitalization selectedValue, boolean finalChoice) { WriteCommandAction.writeCommandAction(project).run(() -> { String nls = Nls.class.getName(); PsiAnnotation annotation = JavaPsiFacade.getInstance(project).getElementFactory() .createAnnotationFromText("@" + nls + "(capitalization = " + nls + ".Ca...
onChosen
41,111
boolean () { return false; }
startInWriteAction
41,112
PsiModifierListOwner (Editor editor, PsiFile file) { PsiElement element = file.findElementAt(editor.getCaretModel().getOffset()); PsiParameter parameter = PsiTreeUtil.getParentOfType(element, PsiParameter.class, false); if (parameter == null) return null; PsiMethod method = PsiTreeUtil.getParentOfType(parameter, PsiMet...
getElement
41,113
void (@NotNull DocumentEvent e) { somethingChanged(); }
documentChanged
41,114
void (HyperlinkEvent e) { final FileTemplateConfigurable configurable = new FileTemplateConfigurable(myProject); final FileTemplate template = FileTemplateManager.getInstance(myProject).getCodeTemplate(templateName); SwingUtilities.invokeLater(() -> configurable.setTemplate(template, null)); boolean ok = ShowSettingsUt...
hyperlinkUpdate
41,115
boolean (PsiFile file) { final Project project = file.getProject(); final String title = JavaI18nBundle.message("i18nize.dialog.error.jdk.title"); try { return ResourceBundleManager.getManager(file) != null; } catch (ResourceBundleManager.ResourceBundleNotFoundException e) { final IntentionAction fix = e.getFix(); if (...
isAvailable
41,116
PropertyCreationHandler () { if (useExistingProperty()) { return JavaI18nUtil.EMPTY_CREATION_HANDLER; } PropertyCreationHandler handler = myResourceBundleManager.getPropertyCreationHandler(); return handler != null ? handler : JavaI18nUtil.DEFAULT_PROPERTY_CREATION_HANDLER; }
getPropertyCreationHandler
41,117
void () { String templateName = getTemplateName(); if (templateName == null) return; if (myShowJavaCodeInfo) { myJavaCodeInfoPanel.setVisible(showResourceBundleTextField(templateName, myProject)); } ReadAction .nonBlocking(() -> JavaI18nUtil.suggestExpressionOfType(myResourceBundleType, myLiteralExpression.getSourcePsi...
suggestAvailableResourceBundleExpressions
41,118
void () { if (myShowJavaCodeInfo) { PropertiesComponent.getInstance(myProject).setValue(RESOURCE_BUNDLE_EXPRESSION_USED, myRBEditorTextField.getText()); } super.doOKAction(); }
doOKAction
41,119
boolean (String templateName, Project project) { FileTemplate template = FileTemplateManager.getInstance(project).getCodeTemplate(templateName); return template.getText().contains("${" + RESOURCE_BUNDLE_OPTION_KEY + "}"); }
showResourceBundleTextField
41,120
void () { if (myShowPreview) { ReadAction .nonBlocking(() -> getI18nizedText()) .finishOnUiThread(ModalityState.stateForComponent(myPreviewLabel), (@NlsSafe String text) -> myPreviewLabel.setText(text)) .submit(myExecutorPool); } super.somethingChanged(); }
somethingChanged
41,121
String () { return myResourceBundleManager.getTemplateName(); }
getTemplateName
41,122
String (String value, @NotNull PsiFile context) { try { ResourceBundleManager manager = ResourceBundleManager.getManager(context); return manager != null ? manager.escapeValue(value) : super.escapeValue(value, context); } catch (ResourceBundleManager.ResourceBundleNotFoundException e) { return super.escapeValue(value, ...
escapeValue
41,123
String (String value) { return myResourceBundleManager.suggestPropertyKey(value); }
defaultSuggestPropertyKey
41,124
List<String> () { return myResourceBundleManager.suggestPropertiesFiles(myContextModules); }
defaultSuggestPropertiesFiles
41,125
String (final I18nizedTextGenerator textGenerator, @NotNull @NlsSafe String propertyKey, final PropertiesFile propertiesFile, final PsiElement context) { return textGenerator.getI18nizedText(propertyKey, propertiesFile, context); }
generateText
41,126
void (final Map<String, String> attributes) { }
addAdditionalAttributes
41,127
String () { return myShowJavaCodeInfo ? myRBEditorTextField.getText() : null; }
getResourceBundleText
41,128
T () { return myLiteralExpression; }
getLiteralExpression
41,129
UExpression[] () { return new UExpression[0]; }
getParameters
41,130
TextRange (Editor editor, @NotNull PsiFile psiFile) { if (editor == null) return null; String selectedText = editor.getSelectionModel().getSelectedText(); if (selectedText != null) { return new TextRange(editor.getSelectionModel().getSelectionStart(), editor.getSelectionModel().getSelectionEnd()); } PsiElement psiEleme...
getSelectedRange
41,131
boolean (@NotNull PsiExpression expression, @Nullable Ref<? super PsiAnnotationMemberValue> resourceBundleRef) { UExpression uExpression = UastContextKt.toUElement(expression, UExpression.class); if (uExpression == null) return false; Ref<UExpression> resourceBundleURef = resourceBundleRef == null ? null : Ref.create()...
mustBePropertyKey
41,132
boolean (@NotNull UExpression expression, @Nullable Ref<? super UExpression> resourceBundleRef) { expression = StringFlowUtil.goUp(expression, false, NlsInfo.factory()); AnnotationContext context = AnnotationContext.fromExpression(expression); return context.allItems().anyMatch(owner -> { PsiAnnotation annotation = own...
mustBePropertyKey
41,133
UExpression (@NotNull UExpression expression, boolean stopAtCall) { while (expression.getUastParent() instanceof UExpression parent) { if (parent instanceof UBlockExpression || parent instanceof UReturnExpression) { break; } if (parent instanceof UIfExpression && UastUtils.isPsiAncestor(((UIfExpression)parent).getCondi...
getTopLevelExpression
41,134
boolean (@NotNull Project project, @NotNull PsiExpression expression, @NotNull String key, @NotNull Ref<? super String> outResourceBundle) { Ref<PsiAnnotationMemberValue> resourceBundleRef = Ref.create(); if (mustBePropertyKey(expression, resourceBundleRef)) { final Object resourceBundleName = resourceBundleRef.get(); ...
isValidPropertyReference
41,135
ResourceBundle (@NotNull final String key, @NotNull final Project project) { final Ref<ResourceBundle> bundleRef = Ref.create(); final boolean r = PropertiesReferenceManager.getInstance(project).processAllPropertiesFiles((baseName, propertiesFile) -> { if (propertiesFile.findPropertyByKey(key) != null) { if (bundleRef....
resolveResourceBundleByKey
41,136
boolean (@NotNull PsiExpression expression, @NotNull String key, @Nullable String resourceBundleName) { if (resourceBundleName == null) { return !PropertiesImplUtil.findPropertiesByKey(expression.getProject(), key).isEmpty(); } List<PropertiesFile> propertiesFiles = I18nUtil.propertiesFilesByBundleName(resourceBundleNa...
isPropertyRef
41,137
Set<String> (final PsiClassType type, final PsiElement context) { PsiVariable[] variables = MacroUtil.getVariablesVisibleAt(context, ""); Set<String> result = new LinkedHashSet<>(); for (PsiVariable var : variables) { PsiType varType = var.getType(); PsiIdentifier identifier = var.getNameIdentifier(); if ((type == null...
suggestExpressionOfType
41,138
void (@NotNull PsiClassType type, @NotNull PsiElement context, @NotNull Collection<? super String> result) { PsiScopesUtil.treeWalkUp((element, state) -> { if (element instanceof PsiMethod method) { PsiType returnType = method.getReturnType(); if (returnType != null && TypeConversionUtil.isAssignable(type, returnType) ...
addAvailableMethodsOfType
41,139
int (@NotNull final String propertyValue) { try { return countFormatParameters(new MessageFormat(propertyValue)); } catch (final IllegalArgumentException e) { return 0; } }
getPropertyValuePlaceholdersCount
41,140
int (@NotNull MessageFormat mf) { Format[] formats = mf.getFormatsByArgumentIndex(); int maxLength = formats.length; for (Format format : formats) { if (format instanceof ChoiceFormat) { for (Object o : ((ChoiceFormat) format).getFormats()) { maxLength = Math.max(maxLength, countFormatParameters(new MessageFormat((Stri...
countFormatParameters
41,141
int (@NotNull final UExpression expression) { final SortedSet<Integer> paramsCount = getPropertyValueParamsCount(expression, null); if (paramsCount.isEmpty()) { return -1; } return paramsCount.last(); }
getPropertyValueParamsMaxCount
41,142
SortedSet<Integer> (@NotNull final PsiExpression expression, @Nullable final String resourceBundleName) { UExpression uExpression = UastContextKt.toUElement(expression, UExpression.class); if (uExpression == null) return new TreeSet<>(); return getPropertyValueParamsCount(uExpression, resourceBundleName); }
getPropertyValueParamsCount
41,143
SortedSet<Integer> (@NotNull final UExpression expression, @Nullable final String resourceBundleName) { final ULiteralExpression literalExpression; if (expression instanceof ULiteralExpression) { literalExpression = (ULiteralExpression)expression; } else if (expression instanceof UReferenceExpression) { final PsiElemen...
getPropertyValueParamsCount
41,144
String (@NotNull UStringConcatenationsFacade cf, @NotNull List<? super UExpression> formatParameters, @NotNull Project project) { return buildUnescapedFormatString(cf, formatParameters, project, false); }
buildUnescapedFormatString
41,145
String (@NotNull UStringConcatenationsFacade cf, @NotNull List<? super UExpression> formatParameters, @NotNull Project project, boolean nested) { StringBuilder result = new StringBuilder(); boolean noEscapingRequired = !nested && SequencesKt.all(cf.getUastOperands(), expression -> expression instanceof ULiteralExpressi...
buildUnescapedFormatString
41,146
boolean (@NotNull UExpression expression, @NotNull List<? super UExpression> formatParameters, @NotNull Project project, @NotNull StringBuilder result) { if (!(expression instanceof UIfExpression)) return false; PsiElement sourcePsi = expression.getSourcePsi(); if (sourcePsi == null) return false; UastCodeGenerationPlu...
addChoicePattern
41,147
String (@NotNull List<? super UExpression> formatParameters, @NotNull Project project, UExpression expression, boolean nested) { String elseStr; if (expression instanceof ULiteralExpression) { Object elseValue = ((ULiteralExpression)expression).getValue(); if (elseValue != null) { elseStr = PsiConcatenationUtil.formatS...
getSideText
41,148
String (@NotNull List<? extends UExpression> args) { return args.stream().map(UExpression::getSourcePsi).filter(Objects::nonNull).map(psi -> psi.getText()).collect(Collectors.joining(",")); }
composeParametersText
41,149
boolean (@NotNull Project project, Editor editor, @NotNull PsiElement element) { if (!element.isValid()) { return false; } // find java code up there, going through injections if necessary return findJavaCodeUpThere(element) != null; }
isAvailable
41,150
PsiElement (PsiElement element) { InjectedLanguageManager injectedManager = InjectedLanguageManager.getInstance(element.getProject()); while (element != null) { if (element.getLanguage() == JavaLanguage.INSTANCE && !injectedManager.isInjectedFragment(element.getContainingFile())) return element; element = element.getCo...
findJavaCodeUpThere
41,151
String () { return AnalysisBundle.message("suppress.inspection.family"); }
getFamilyName
41,152
String () { return JavaI18nBundle.message("intention.text.suppress.with.0.comment", nonNlsCommentPattern); }
getText
41,153
String () { return JavaI18nBundle.message("inspection.i18n.quickfix"); }
getFamilyName
41,154
UInjectionHost (PsiFile file, Editor editor) { return I18nizeAction.getEnclosingStringLiteral(file, editor); }
getEnclosingLiteral
41,155
JavaI18nizeQuickFixDialog<UInjectionHost> (Project project, Editor editor, PsiFile psiFile) { UInjectionHost literalExpression = I18nizeAction.getEnclosingStringLiteral(psiFile, editor); return createDialog(project, psiFile, literalExpression); }
createDialog
41,156
JavaI18nizeQuickFixDialog<UInjectionHost> (Project project, PsiFile context, @NotNull UInjectionHost literalExpression) { String value = getStringToExtract(literalExpression); return new JavaI18nizeQuickFixDialog<>(project, context, literalExpression, value, getCustomization(value), true, true); }
createDialog
41,157
IntentionPreviewInfo (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement element = descriptor.getPsiElement(); UInjectionHost literal = I18nizeAction.getEnclosingStringLiteral(element); if (literal == null) { return IntentionPreviewInfo.EMPTY; } String string = getStringToExtract(literal); re...
generatePreview
41,158
PsiElementVisitor (@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new JavaElementVisitor() { private void handle(@NotNull PsiElement element) { if (IOUtil.isAscii(element.getText())) return; // "Basic Latin" is a proper noun //noinspection DialogTitleCapitalization holder.registerProblem(element, Ja...
buildVisitor
41,159
void (@NotNull PsiElement element) { if (IOUtil.isAscii(element.getText())) return; // "Basic Latin" is a proper noun //noinspection DialogTitleCapitalization holder.registerProblem(element, JavaI18nBundle.message("inspection.non.basic.latin.character.display.name"), new ConvertToBasicLatinFix()); }
handle
41,160
void (@NotNull PsiComment comment) { super.visitComment(comment); handle(comment); }
visitComment
41,161
void (@NotNull PsiLiteralExpression expression) { super.visitLiteralExpression(expression); if (!PsiUtil.isJavaToken(expression.getFirstChild(), ElementType.TEXT_LITERALS)) return; handle(expression); }
visitLiteralExpression
41,162
void (@NotNull PsiFragment fragment) { super.visitFragment(fragment); handle(fragment); }
visitFragment
41,163
void (@NotNull PsiDocComment comment) { super.visitDocComment(comment); handle(comment); }
visitDocComment
41,164
boolean (char ch) { return Character.UnicodeBlock.of(ch) == Character.UnicodeBlock.BASIC_LATIN; }
isBasicLatin
41,165
PsiElement (@NotNull PsiElementFactory factory, @NotNull PsiElement element, @NotNull String newText) { return factory.createExpressionFromText(newText, element.getParent()); }
buildReplacement
41,166
void (@NotNull StringBuilder sb, char ch) { sb.append(String.format("\\u%04X", (int)ch)); }
convert
41,167
PsiElement (@NotNull PsiElementFactory factory, @NotNull PsiElement element, @NotNull String newText) { return factory.createStringTemplateFragment(newText, ((PsiFragment)element).getTokenType(), element); }
buildReplacement
41,168
void (@NotNull StringBuilder sb, char ch) { String entity = ourEntities.get(ch); if (entity != null) { sb.append('&').append(entity).append(';'); } else { sb.append("&#x").append(Integer.toHexString(ch).toUpperCase(Locale.ENGLISH)).append(';'); } }
convert
41,169
PsiElement (@NotNull PsiElementFactory factory, @NotNull PsiElement element, @NotNull String newText) { return factory.createCommentFromText(newText, element.getParent()); }
buildReplacement
41,170
void (@NotNull Project project) { if (ourEntities != null) return; XmlFile file; try { String url = ExternalResourceManager.getInstance().getResourceLocation(XmlUtil.HTML4_LOOSE_URI, project); if (url == null) { Logger.getInstance(ConvertToBasicLatinInspection.class).error("Namespace not found: " + XmlUtil.HTML4_LOOSE_...
loadEntities
41,171
String () { return JavaI18nBundle.message("inspection.non.basic.latin.character.quickfix"); }
getFamilyName
41,172
void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { final Handler handler; if (element instanceof PsiLiteralExpression) { handler = new LiteralHandler(); } else if (element instanceof PsiDocComment) { handler = new DocCommentHandler(); } else if (element instanceof PsiComment)...
applyFix
41,173
boolean () { return false; }
startInWriteAction
41,174
void (@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) { doFix(descriptor, project); }
applyFix
41,175
void (@NotNull PsiFile psiFile, UElement literalExpression, String i18nizedText, Document document, @Nullable UastCodeGenerationPlugin generationPlugin) { PsiElement psi = literalExpression.getSourcePsi(); if (psi == null) { return; } Language language = psi.getLanguage(); int startOffset = psi.getTextRange().getStartO...
doDocumentReplacement
41,176
void (@Nullable PsiElement element, @NotNull UastCodeGenerationPlugin generationPlugin) { UElement uElement = UastContextKt.toUElement(element); if (uElement == null) { return; } // Here we rely on that replacing same element will shorten references generationPlugin.replace(uElement, uElement, UElement.class); }
shortenReferences
41,177
void (final ProblemDescriptor descriptor, final Project project) { final PsiElement psi = descriptor.getPsiElement(); final PsiFile psiFile = descriptor.getPsiElement().getContainingFile(); if (!JavaI18nizeQuickFixDialog.isAvailable(psiFile)) { return; } T uast = getEnclosingLiteral(psiFile, PsiEditorUtil.findEditor(ps...
doFix
41,178
String (String value, NlsInfo.Localized info) { String prefix = info.getPrefix(); String suffix = info.getSuffix(); if (prefix.isEmpty() && suffix.isEmpty()) return null; if (!prefix.isEmpty()) { prefix += "."; } if (!suffix.isEmpty()) { suffix = "." + suffix; } String payload = I18nizeQuickFixDialog.generateDefaultPro...
getSuggestedName
41,179
NlsInfoFactory () { return NlsInfoFactory.INSTANCE; }
factory
41,180
ThreeState () { return myNls; }
getNlsStatus
41,181
boolean () { return this instanceof Localized || this instanceof NlsSafe; }
canBeUsedInLocalizedContext
41,182
Localized () { return Localized.NLS; }
localized
41,183
NonLocalized () { return NonLocalized.INSTANCE; }
nonLocalized
41,184
NlsInfo (@NotNull UExpression expression) { return forExpression(expression, true); }
forExpression
41,185
NlsInfo (@NotNull UExpression expression, boolean allowStringModifications) { expression = StringFlowUtil.goUp(expression, allowStringModifications, NlsInfoFactory.INSTANCE); NlsInfo target = fromEqualityCheck(expression, allowStringModifications); if (target != NlsUnspecified.UNKNOWN) return target; AnnotationContext ...
forExpression
41,186
NlsInfo (@NotNull UExpression expression, boolean allowStringModifications) { UElement parent = UastUtils.skipParenthesizedExprUp(expression.getUastParent()); if (parent instanceof UCallExpression) { String name = ((UCallExpression)parent).getMethodName(); if (name != null && (name.equals("equals") || (allowStringModif...
fromEqualityCheck
41,187
NlsInfo (UExpression receiver) { if (receiver instanceof UReferenceExpression && TypeUtils.isJavaLangString(receiver.getExpressionType())) { PsiElement target = ((UReferenceExpression)receiver).resolve(); if (target instanceof PsiVariable) { return factory().fromModifierListOwner((PsiVariable)target); } } return NlsUns...
fromVariableReference
41,188
NlsInfo (@NotNull PsiType type) { return fromAnnotationOwner(type); }
forType
41,189
NlsInfo (@NotNull PsiModifierListOwner owner) { return fromAnnotationContext(null, AnnotationContext.fromModifierListOwner(owner)); }
forModifierListOwner
41,190
Capitalization (@NotNull PsiModifierListOwner owner) { NlsInfo info = forModifierListOwner(owner); if (info instanceof Localized) { return ((Localized)info).getCapitalization(); } return Capitalization.NotSpecified; }
getCapitalization
41,191
NlsInfo (@Nullable PsiAnnotationOwner annotationOwner) { return NlsInfo.fromAnnotationOwner(annotationOwner); }
fromAnnotationOwner
41,192
NlsInfo (@NotNull PsiModifierListOwner modifierListOwner) { return fromAnnotationContext(null, AnnotationContext.fromModifierListOwner(modifierListOwner)); }
fromModifierListOwner
41,193
NlsInfo (UElement parent, AnnotationContext context) { NlsInfo info = fromType(context.getType()); if (info != NlsUnspecified.UNKNOWN) return info; PsiModifierListOwner owner = context.getOwner(); if (owner == null) return NlsUnspecified.UNKNOWN; info = fromAnnotationOwner(owner.getModifierList()); if (info != NlsUnspe...
fromAnnotationContext
41,194
NlsInfo (PsiType type) { if (type == null) return NlsUnspecified.UNKNOWN; Ref<NlsInfo> result = Ref.create(NlsUnspecified.UNKNOWN); InheritanceUtil.processSuperTypes(type, true, eachType -> { NlsInfo info = fromAnnotationOwner(eachType); if (info != NlsUnspecified.UNKNOWN) { result.set(info); return false; } return !(e...
fromType
41,195
NlsInfo (@NotNull UVariable owner) { for (UAnnotation annotation : owner.getUAnnotations()) { NlsInfo info = fromAnnotation(annotation); if (info != NlsUnspecified.UNKNOWN) { return info; } info = fromMetaAnnotation(annotation.resolve()); if (info != NlsUnspecified.UNKNOWN) { return info; } } return NlsUnspecified.UNKN...
fromUVariable
41,196
NlsInfo (@Nullable PsiAnnotationOwner owner) { if (owner == null) return NlsUnspecified.UNKNOWN; if (owner instanceof PsiModifierList) { return CachedValuesManager.getCachedValue((PsiModifierList)owner, () -> CachedValueProvider.Result.create(computeFromAnnotationOwner(owner), PsiModificationTracker.MODIFICATION_COUNT)...
fromAnnotationOwner
41,197
NlsInfo (@NotNull PsiAnnotationOwner owner) { for (PsiAnnotation annotation : owner.getAnnotations()) { NlsInfo info = fromAnnotation(annotation); if (info != NlsUnspecified.UNKNOWN) { return info; } UAnnotation uAnnotation = UastContextKt.toUElement(annotation, UAnnotation.class); if (uAnnotation != null) { info = fro...
computeFromAnnotationOwner
41,198
NlsInfo (@Nullable PsiClass annotationClass) { if (annotationClass == null) return NlsUnspecified.UNKNOWN; NlsInfo baseInfo = NlsUnspecified.UNKNOWN; String prefix = ""; String suffix = ""; for (PsiAnnotation metaAnno : annotationClass.getAnnotations()) { if (metaAnno.hasQualifiedName(NLS_CONTEXT)) { prefix = StringUti...
fromMetaAnnotation
41,199
NlsInfo (@NotNull PsiAnnotation annotation) { return fromAnnotationInfo( annotation.getQualifiedName(), () -> UastContextKt.toUElement(annotation.findAttributeValue("capitalization"), UExpression.class) ); }
fromAnnotation