Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
26,600
String () { return PropertiesBundle.message("unused.property.suppress.for.file"); }
getFamilyName
26,601
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { final PsiElement element = descriptor.getStartElement(); final PsiFile file = element.getContainingFile(); @NonNls final Document doc = PsiDocumentManager.getInstance(project).getDocument(file); LOG.assertTrue(doc != null, file); doc.insertString(...
applyFix
26,602
boolean (@NotNull Project project, @NotNull PsiElement context) { return context.isValid() && context.getContainingFile() instanceof PropertiesFile; }
isAvailable
26,603
boolean () { return false; }
isSuppressAll
26,604
PsiElementVisitor (@NotNull final ProblemsHolder holder, boolean isOnTheFly) { if (!(holder.getFile() instanceof PropertiesFileImpl)) { return PsiElementVisitor.EMPTY_VISITOR; } final PropertiesCodeStyleSettings codeStyleSettings = PropertiesCodeStyleSettings.getInstance(holder.getProject()); final char codeStyleKeyVal...
buildVisitor
26,605
void (@NotNull PsiElement element) { if (element instanceof PropertyImpl) { final char delimiter = ((PropertyImpl)element).getKeyValueDelimiter(); if (delimiter != codeStyleKeyValueDelimiter) { holder.registerProblem(element, PropertiesBundle.message("wrong.property.key.value.delimiter.inspection.display.name"), new Re...
visitElement
26,606
String () { return getFamilyName(); }
getText
26,607
void (@NotNull Project project, @NotNull PsiFile file, @NotNull PsiElement element, @NotNull PsiElement endElement) { ((PropertyImpl) element).replaceKeyValueDelimiterWithDefault(); }
invoke
26,608
String () { return PropertiesBundle.message("replace.key.value.delimiter.quick.fix.family.name"); }
getFamilyName
26,609
String () { return "TrailingSpacesInProperty"; }
getShortName
26,610
OptPane () { return pane( checkbox("myIgnoreVisibleSpaces", PropertiesBundle.message("trailing.spaces.in.property.inspection.ignore.visible.spaces"))); }
getOptionsPane
26,611
ProblemDescriptor[] (@NotNull PsiFile file, @NotNull final InspectionManager manager, final boolean isOnTheFly) { if (!(file instanceof PropertiesFile)) return null; final List<IProperty> properties = ((PropertiesFile)file).getProperties(); final List<ProblemDescriptor> descriptors = new SmartList<>(); for (IProperty p...
checkFile
26,612
TextRange (PsiElement element, boolean ignoreVisibleTrailingSpaces) { String key = element.getText(); if (ignoreVisibleTrailingSpaces) { for (int i = key.length() - 1; i > -1; i--) { if (key.charAt(i) != ' ' && key.charAt(i) != '\t') { return i == key.length() - 1 ? null : new TextRange(i + 1, key.length()); } } return...
getTrailingSpaces
26,613
String () { return PropertiesBundle.message("remove.trailing.spaces.fix.family.name"); }
getFamilyName
26,614
void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { PsiElement parent = element.getParent(); if (!(parent instanceof PropertyImpl)) return; TextRange textRange = getTrailingSpaces(element, myIgnoreVisibleSpaces); if (textRange != null) { Document document = element.getContaini...
applyFix
26,615
PsiElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly) { final Charset charset = EncodingProjectManager.getInstance(holder.getProject()).getDefaultCharsetForPropertiesFiles(null); if (charset != StandardCharsets.UTF_8) return PsiElementVisitor.EMPTY_VISITOR; return new PsiElementVisitor() { @Override pu...
buildVisitor
26,616
void (@NotNull PsiElement element) { if (!(element instanceof PropertyValueImpl)) return; boolean found = getThreeDots(((PropertyValueImpl)element).getChars()); if (found) { int length = element.getTextLength(); holder.registerProblem(element, TextRange.create(length - 3, length), PropertiesBundle.message("inspection.u...
visitElement
26,617
boolean (@NotNull CharSequence element) { int textLength = element.length(); if (textLength <= 4) return false; // Ends with three dots… if (element.charAt(textLength - 3) != '.') return false; if (element.charAt(textLength - 2) != '.') return false; if (element.charAt(textLength - 1) != '.') return false; // But doesn...
getThreeDots
26,618
ReplaceThreeDotsWithEllipsisFix () { if (instance == null) { synchronized (ReplaceThreeDotsWithEllipsisFix.class) { if (instance == null) { instance = new ReplaceThreeDotsWithEllipsisFix(); } } } return instance; }
getInstance
26,619
String () { return PropertiesBundle.message("use.ellipsis.fix.family.name"); }
getFamilyName
26,620
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement element = descriptor.getPsiElement(); if (!(element instanceof PropertyValueImpl)) return; boolean found = getThreeDots(((PropertyValueImpl)element).getChars()); if (found) { int length = element.getTextLength(); StringBuilder newText =...
applyFix
26,621
PsiElementVisitor (@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new PsiElementVisitor() { @Override public void visitFile(@NotNull PsiFile file) { var propertiesFile = findPropertiesFile(file); if (propertiesFile == null) return; var resourceBundle = propertiesFile.getResourceBundle(); final Strin...
buildVisitor
26,622
void (@NotNull PsiFile file) { var propertiesFile = findPropertiesFile(file); if (propertiesFile == null) return; var resourceBundle = propertiesFile.getResourceBundle(); final String resourceBundleBaseName = resourceBundle.getBaseName(); if (!isResourceBundleAlphaSortedExceptOneFile(resourceBundle, propertiesFile)) { ...
visitFile
26,623
boolean (@NotNull final ResourceBundle resourceBundle, @NotNull final PropertiesFile exceptedFile) { for (PropertiesFile file : resourceBundle.getPropertiesFiles()) { if (!(file instanceof PropertiesFileImpl)) { return true; } if (!file.equals(exceptedFile) && !file.isAlphaSorted()) { return false; } } return true; }
isResourceBundleAlphaSortedExceptOneFile
26,624
String () { return PropertiesBundle.message("properties.sorter.quick.fix.family.name"); }
getFamilyName
26,625
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { Collection<PropertiesFile> filesToSort = getFilesToSort(descriptor.getPsiElement().getContainingFile()); final boolean force = filesToSort.size() == 1; for (PropertiesFile file : filesToSort) { if (!force && file.isAlphaSorted()) { continue; } sor...
applyFix
26,626
Collection<PropertiesFile> (@NotNull PsiFile file) { PropertiesFile propertiesFile = findPropertiesFile(file); if (propertiesFile == null) return Collections.emptyList(); if (myOnlyCurrentFile) { return Collections.singleton(propertiesFile); } return propertiesFile.getResourceBundle().getPropertiesFiles(); }
getFilesToSort
26,627
void (final PropertiesFile file) { final List<IProperty> properties = new ArrayList<>(file.getProperties()); properties.sort(Comparator.comparing(IProperty::getKey, String.CASE_INSENSITIVE_ORDER)); final PropertiesList propertiesList = PsiTreeUtil.findChildOfType(file.getContainingFile(), PropertiesList.class); if (pro...
sortPropertiesFile
26,628
String () { return "AlphaUnsortedPropertiesFile"; }
getShortName
26,629
void (@NotNull PsiFile file, @NotNull InspectionManager manager, @NotNull ProblemsHolder problemsHolder, @NotNull GlobalInspectionContext globalContext, @NotNull ProblemDescriptionsProcessor problemDescriptionsProcessor) { checkFile(file, manager, (GlobalInspectionContextBase)globalContext, globalContext.getRefManager(...
checkFile
26,630
void (@NotNull StringBuilder anchor, PsiElement element, final boolean isValue) { if (element != null) { final PsiElement parent = element.getParent(); PsiElement elementToLink = isValue ? parent.getFirstChild() : parent.getLastChild(); if (elementToLink != null) { HTMLComposer.appendAfterHeaderIndention(anchor); HTMLC...
surroundWithHref
26,631
void (@NotNull StringBuilder lineAnchor, PsiElement psiElement) { final PsiFile file = psiElement.getContainingFile(); if (file != null) { final VirtualFile vFile = file.getVirtualFile(); if (vFile != null) { Document doc = FileDocumentManager.getInstance().getDocument(vFile); final int lineNumber = doc.getLineNumber(p...
compoundLineLink
26,632
void (final PsiFile file, final InspectionManager manager, GlobalInspectionContextBase context, final RefManager refManager, final ProblemDescriptionsProcessor processor) { if (!(file instanceof PropertiesFile propertiesFile)) return; if (!context.isToCheckFile(file, this) || SuppressionUtil.inspectionResultSuppressed(...
checkFile
26,633
void (final Map<String, Set<PsiFile>> processedTextToFiles, final String text, final Map<String, Set<PsiFile>> processedFoundTextToFiles, final PsiSearchHelper searchHelper, final GlobalSearchScope scope) { if (!processedTextToFiles.containsKey(text)) { if (processedFoundTextToFiles.containsKey(text)) { final Set<PsiFi...
processTextUsages
26,634
void (final Map<String, Set<PsiFile>> valueToFiles, final InspectionManager manager, final List<? super ProblemDescriptor> problemDescriptors, final PsiFile psiFile, final ProgressIndicator progress) { for (final String value : valueToFiles.keySet()) { if (progress != null){ progress.setText2(PropertiesBundle.message("...
prepareDuplicateValuesByFile
26,635
void (final Map<String, Set<PsiFile>> keyToFiles, final InspectionManager manager, final Map<String, Set<String>> keyToValues, final List<? super ProblemDescriptor> problemDescriptors, final PsiFile psiFile, final ProgressIndicator progress) { for (String key : keyToFiles.keySet()) { if (progress!= null){ progress.setT...
prepareDuplicateKeysByFile
26,636
void (final Map<String, Set<String>> keyToDifferentValues, final Map<String, Set<PsiFile>> keyToFiles, final List<? super ProblemDescriptor> problemDescriptors, final InspectionManager manager, final PsiFile psiFile, final ProgressIndicator progress) { for (String key : keyToDifferentValues.keySet()) { if (progress != ...
processDuplicateKeysWithDifferentValues
26,637
void (String stringToFind, PsiSearchHelper searchHelper, GlobalSearchScope scope, final Set<? super PsiFile> resultFiles) { final List<String> words = StringUtil.getWordsIn(stringToFind); if (words.isEmpty()) return; words.sort((o1, o2) -> o2.length() - o1.length()); for (String word : words) { final Set<PsiFile> files...
findFilesWithText
26,638
String () { return InspectionsBundle.message("group.names.properties.files"); }
getGroupDisplayName
26,639
String () { return "DuplicatePropertyInspection"; }
getShortName
26,640
boolean () { return false; }
isEnabledByDefault
26,641
OptPane () { @SuppressWarnings("InjectedReferences") OptDropdown scope = dropdown("SCOPE", PropertiesBundle.message("label.analysis.scope"), option("file", PropertiesBundle.message("duplicate.property.file.scope.option")), option("module", PropertiesBundle.message("duplicate.property.module.scope.option")), option("pro...
getOptionsPane
26,642
OptionController () { return super.getOptionController().onValue( "SCOPE", () -> CURRENT_FILE ? "file" : MODULE_WITH_DEPENDENCIES ? "module" : "project", value -> { CURRENT_FILE = "file".equals(value); MODULE_WITH_DEPENDENCIES = "module".equals(value); }); }
getOptionController
26,643
boolean (@NotNull Property property) { final String propertiesFileName = property.getPropertiesFile().getName(); for (String keyword : LOGGER_PROPERTIES_KEYWORDS) { if (propertiesFileName.startsWith(keyword)) { return true; } } return false; }
isUsed
26,644
String () { return SHORT_NAME; }
getShortName
26,645
OptPane () { return OptPane.pane( OptPane.string("fileNameMask", PropertiesBundle.message("label.analyze.only.property.files.whose.name.matches"), 30, new RegexValidator()) ); }
getOptionsPane
26,646
OptionController () { return super.getOptionController().onValueSet("fileNameMask", value -> { if ("".equals(value)) fileNameMask = ".*"; }); }
getOptionController
26,647
GlobalSearchScope (@Nullable String key, @NotNull Project project, @NotNull Module ownModule) { if (key == null) return null; Set<Module> modules = new LinkedHashSet<>(); for (IProperty property : PropertiesImplUtil.findPropertiesByKey(project, key)) { Module module = ModuleUtilCore.findModuleForPsiElement(property.get...
getWidestUseScope
26,648
PsiElementVisitor (@NotNull final ProblemsHolder holder, final boolean isOnTheFly, @NotNull final LocalInspectionToolSession session) { final PsiFile file = session.getFile(); if (!fileNameMask.isEmpty()) { try { Pattern p = Pattern.compile(fileNameMask); if (!p.matcher(file.getName()).matches()) { return PsiElementVis...
buildVisitor
26,649
void (@NotNull PsiElement element) { if (!(element instanceof Property property)) return; if (propertiesBeingCommitted != null && !propertiesBeingCommitted.contains(property)) return; if (isPropertyUsed(property, helper, isOnTheFly)) return; final ASTNode propertyNode = property.getNode(); assert propertyNode != null; ...
visitElement
26,650
Set<PsiElement> (@NotNull PsiFile file) { final Map<Class<? extends PsiElement>, Set<PsiElement>> data = file.getUserData(InspectionProfileWrapper.PSI_ELEMENTS_BEING_COMMITTED); if (data == null) return null; return data.get(Property.class); }
getBeingCommittedProperties
26,651
boolean (@NotNull Property property) { for (ImplicitPropertyUsageProvider provider : EP_NAME.getIterable()) { if (provider.isUsed(property)) { return true; } } return false; }
isImplicitlyUsed
26,652
boolean (@NotNull Property property, @NotNull UnusedPropertiesSearchHelper helper, boolean isOnTheFly) { final ProgressIndicator original = ProgressManager.getInstance().getProgressIndicator(); if (original != null) { if (original.isCanceled()) return true; original.setText(PropertiesBundle.message("searching.for.prope...
isPropertyUsed
26,653
boolean (@NotNull PsiElement property, @NotNull String name, @NotNull PsiSearchHelper psiSearchHelper, @NotNull GlobalSearchScope searchScope, boolean onTheFly, @Nullable ProgressIndicator indicator) { GlobalSearchScope exceptPropertyFiles = createExceptPropertyFilesScope(searchScope); GlobalSearchScope newScope = sear...
mayHaveUsages
26,654
GlobalSearchScope (@NotNull GlobalSearchScope origin) { return new DelegatingGlobalSearchScope(origin) { @Override public boolean contains(@NotNull VirtualFile file) { return super.contains(file) && !FileTypeRegistry.getInstance().isFileOfType(file, PropertiesFileType.INSTANCE); } }; }
createExceptPropertyFilesScope
26,655
boolean (@NotNull VirtualFile file) { return super.contains(file) && !FileTypeRegistry.getInstance().isFileOfType(file, PropertiesFileType.INSTANCE); }
contains
26,656
Module () { return myModule; }
getModule
26,657
boolean (PsiReferenceService.@NotNull Hints hints) { return false; }
shouldAskParentForReferences
26,658
PsiReference () { PsiReference[] references = getReferences(); return references.length == 0 ? null : references[0]; }
getReference
26,659
String () { return "PropertyValueImpl: " + getText(); }
toString
26,660
String () { return "Property{ key = " + getKey() + ", value = " + getValue() + "}"; }
toString
26,661
String () { return getUnescapedKey(); }
getName
26,662
String () { final PropertyStub stub = getStub(); if (stub != null) { return stub.getKey(); } final ASTNode node = getKeyNode(); if (node == null) { return null; } return node.getText(); }
getKey
26,663
ASTNode () { return getNode().findChildByType(PropertiesTokenTypes.KEY_CHARACTERS); }
getKeyNode
26,664
ASTNode () { return getNode().findChildByType(PropertiesTokenTypes.VALUE_CHARACTERS); }
getValueNode
26,665
String () { final ASTNode node = getValueNode(); if (node == null) { return ""; } return node.getText(); }
getValue
26,666
String () { return unescape(getValue()); }
getUnescapedValue
26,667
String (String s) { if (s == null) return null; StringBuilder sb = new StringBuilder(); parseCharacters(s, sb, null); return sb.toString(); }
unescape
26,668
boolean (String s, StringBuilder outChars, int @Nullable [] sourceOffsets) { assert sourceOffsets == null || sourceOffsets.length == s.length() + 1; int off = 0; int len = s.length(); boolean result = true; final int outOffset = outChars.length(); while (off < len) { char aChar = s.charAt(off++); if (sourceOffsets != n...
parseCharacters
26,669
TextRange (String s) { if (s == null) { return null; } int off = 0; int len = s.length(); int startSpaces = -1; while (off < len) { char aChar = s.charAt(off++); if (aChar == '\\') { if (startSpaces == -1) startSpaces = off-1; aChar = s.charAt(off++); if (aChar == 'u') { // Read the xxxx int value = 0; boolean error = ...
trailingSpaces
26,670
String () { return unescape(getKey()); }
getUnescapedKey
26,671
Icon (@IconFlags int flags) { return PlatformIcons.PROPERTY_ICON; }
getElementIcon
26,672
PropertiesFile () { PsiFile containingFile = super.getContainingFile(); if (!(containingFile instanceof PropertiesFile)) { LOG.error("Unexpected file type of: " + containingFile.getName()); } return (PropertiesFile)containingFile; }
getPropertiesFile
26,673
PsiElement (@NotNull final Property property) { PsiElement prev = property; for (PsiElement node = property.getPrevSibling(); node != null; node = node.getPrevSibling()) { if (node instanceof Property) break; if (node instanceof PsiWhiteSpace) { if (PROPERTIES_SEPARATOR.matcher(node.getText()).find()) break; } prev = n...
getEdgeOfProperty
26,674
String () { final PsiElement edge = getEdgeOfProperty(this); StringBuilder text = new StringBuilder(); for(PsiElement doc = edge; doc != this; doc = doc.getNextSibling()) { if (doc instanceof PsiComment) { text.append(doc.getText()); text.append("\n"); } } if (text.length() == 0) return null; return text.toString(); }
getDocCommentText
26,675
PsiElement () { return this; }
getPsiElement
26,676
SearchScope () { // property ref can occur in any file return GlobalSearchScope.allScope(getProject()); }
getUseScope
26,677
ItemPresentation () { return new ItemPresentation() { @Override public String getPresentableText() { return getName(); } @Override public String getLocationString() { return getPropertiesFile().getName(); } @Override public Icon getIcon(final boolean open) { return null; } }; }
getPresentation
26,678
String () { return getName(); }
getPresentableText
26,679
String () { return getPropertiesFile().getName(); }
getLocationString
26,680
Icon (final boolean open) { return null; }
getIcon
26,681
boolean () { return true; }
isValidHost
26,682
PsiLanguageInjectionHost (@NotNull String text) { return new PropertyManipulator().handleContentChange(this, text); }
updateText
26,683
char () { final PsiElement delimiter = findChildByType(PropertiesTokenTypes.KEY_VALUE_SEPARATOR); if (delimiter == null) { return ' '; } final String text = delimiter.getText(); LOG.assertTrue(text.length() == 1); return text.charAt(0); }
getKeyValueDelimiter
26,684
void () { PropertyImpl property = (PropertyImpl)PropertiesElementFactory.createProperty(getProject(), "yyy", "xxx", null); final ASTNode newDelimiter = property.getNode().findChildByType(PropertiesTokenTypes.KEY_VALUE_SEPARATOR); final ASTNode propertyNode = getNode(); final ASTNode oldDelimiter = propertyNode.findChil...
replaceKeyValueDelimiterWithDefault
26,685
boolean (@Nullable ASTNode node1, @Nullable ASTNode node2) { if (node1 == null && node2 == null) return true; if (node1 == null || node2 == null) return false; final String text1 = node1.getText(); final String text2 = node2.getText(); return text1.equals(text2); }
areDelimitersEqual
26,686
boolean (@NotNull TextRange rangeInsideHost, @NotNull StringBuilder outChars) { String subText = rangeInsideHost.substring(myHost.getText()); outSourceOffsets = new int[subText.length() + 1]; int prefixLen = outChars.length(); boolean b = PropertyImpl.parseCharacters(subText, outChars, outSourceOffsets); if (b) { for (...
decode
26,687
int (int offsetInDecoded, @NotNull TextRange rangeInsideHost) { int result = offsetInDecoded < outSourceOffsets.length ? outSourceOffsets[offsetInDecoded] : -1; if (result == -1) return -1; return Math.min(result, rangeInsideHost.getLength()) + rangeInsideHost.getStartOffset(); }
getOffsetInHost
26,688
boolean () { return !myHost.getText().contains("\\"); }
isOneLine
26,689
Language () { return PropertiesLanguage.INSTANCE; }
getLanguage
26,690
PsiReference () { PsiReference[] references = getReferences(); return references.length == 0 ? null : references[0]; }
getReference
26,691
String () { return "Property key: " + getText(); }
toString
26,692
String () { return "PropertiesList"; }
toString
26,693
String () { final Property firstProp = PsiTreeUtil.getChildOfType(this, Property.class); // If there are no properties in the property file, // then the whole content of the file is considered to be a doc comment if (firstProp == null) return getText(); final PsiElement upperEdge = PropertyImpl.getEdgeOfProperty(firstP...
getDocCommentText
26,694
String () { return myKey; }
getKey
26,695
CompositeElement (@NotNull final IElementType type) { if (type instanceof IFileElementType) { return new FileElement(type, null); } return new CompositeElement(type); }
createComposite
26,696
LeafElement (@NotNull final IElementType type, @NotNull CharSequence text) { if (type == PropertiesTokenTypes.KEY_CHARACTERS) { return new PropertyKeyImpl(type, text); } if (type == PropertiesTokenTypes.VALUE_CHARACTERS) { return new PropertyValueImpl(type, text); } if (type == PropertiesTokenTypes.END_OF_LINE_COMMENT)...
createLeaf
26,697
FileType () { return PropertiesFileType.INSTANCE; }
getFileType
26,698
String () { return "Properties file:" + getName(); }
toString
26,699
List<IProperty> () { PropertiesList propertiesList; final StubElement<?> stub = getGreenStub(); if (stub != null) { PropertiesListStub propertiesListStub = stub.findChildStubByType(PropertiesElementTypes.PROPERTIES_LIST); propertiesList = propertiesListStub == null ? null : propertiesListStub.getPsi(); } else { propert...
getProperties