Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
26,800 | void () { final Pair<List<String>, Boolean> keysOrder = keysOrder(myResourceBundle); myOrdered = keysOrder != null; if (myOrdered) { myAlphaSorted = keysOrder.getSecond(); myKeysOrder = myAlphaSorted ? null : keysOrder.getFirst(); } else { myKeysOrder = null; } } | reload |
26,801 | Collection<String> () { final Set<String> nodes = new LinkedHashSet<>(); for (PropertiesOrder order : propertiesOrders) { nodes.addAll(order.myKeys); } return nodes; } | getNodes |
26,802 | Iterator<String> (String n) { final Collection<String> siblings = new LinkedHashSet<>(); for (PropertiesOrder order : propertiesOrders) { for (String nextKey : order.getNext(n)) { if (isAlphaSorted[0] && String.CASE_INSENSITIVE_ORDER.compare(n, nextKey) > 0) { isAlphaSorted[0] = false; } siblings.add(nextKey); } } return siblings.iterator(); } | getIn |
26,803 | boolean () { return myAlphaSorted; } | isAlphaSorted |
26,804 | boolean () { return myOrdered; } | isSorted |
26,805 | List<String> (@NotNull String key) { List<String> nextProperties = null; if (myKeyIndices.containsKey(key)) { final IntList indices = myKeyIndices.get(key); for (int i = 0; i < indices.size(); i++) { final int searchIdx = indices.getInt(i) + 1; if (searchIdx < myKeys.size()) { final String nextProperty = myKeys.get(searchIdx); if (nextProperty != null) { if (nextProperties == null) { nextProperties = new SmartList<>(); } nextProperties.add(nextProperty); } } } } return nextProperties == null ? Collections.emptyList() : nextProperties; } | getNext |
26,806 | String () { return "ResourceBundle"; } | getName |
26,807 | String () { return PropertiesFileType.DEFAULT_EXTENSION; } | getDefaultExtension |
26,808 | String () { return PropertiesBundle.message("filetype.resourcebundle.description"); } | getDescription |
26,809 | String () { return PropertiesBundle.message("filetype.resourcebundle.display.name"); } | getDisplayName |
26,810 | boolean (@NotNull VirtualFile file) { return file instanceof ResourceBundleAsVirtualFile; } | isMyFileType |
26,811 | ResourceBundle (@NotNull DataContext dataContext) { PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext); if (element instanceof IProperty) return null; //rename property final ResourceBundle[] bundles = ResourceBundle.ARRAY_DATA_KEY.getData(dataContext); if (bundles != null && bundles.length == 1) return bundles[0]; VirtualFile virtualFile = CommonDataKeys.VIRTUAL_FILE.getData(dataContext); if (virtualFile == null || !virtualFile.isValid()) { return null; } final Project project = CommonDataKeys.PROJECT.getData(dataContext); if (virtualFile instanceof ResourceBundleAsVirtualFile && project != null) { return ((ResourceBundleAsVirtualFile)virtualFile).getResourceBundle(); } if (project != null) { final PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile); if (psiFile instanceof PropertiesFile) { return ((PropertiesFile)psiFile).getResourceBundle(); } } return null; } | getResourceBundleFromDataContext |
26,812 | void (@NotNull DefinitionsScopedSearch.SearchParameters queryParameters, @NotNull Processor<? super PsiElement> consumer) { final PsiElement element = queryParameters.getElement(); Property prop = ReadAction.compute(() -> GotoPropertyParentDeclarationHandler.findProperty(element)); if (prop == null || !(queryParameters.getScope() instanceof GlobalSearchScope)) { return; } ReadAction.run(() -> { final String key = prop.getKey(); if (!prop.isValid() || key == null) return; final PropertiesFile currentFile = PropertiesImplUtil.getPropertiesFile(prop.getContainingFile()); LOG.assertTrue(currentFile != null); final GlobalSearchScope scope = (GlobalSearchScope)queryParameters.getScope(); currentFile.getResourceBundle() .getPropertiesFiles() .stream() .filter(f -> f.equals(currentFile)) .filter(f -> scope.contains(f.getVirtualFile())) .filter(f -> PropertiesUtil.getParent(f, Collections.singleton(currentFile)) == currentFile) .map(f -> f.findPropertyByKey(key)) .filter(Objects::nonNull) .map(IProperty::getPsiElement) .anyMatch(psiElement -> { ProgressManager.checkCanceled(); return !consumer.process(psiElement); }); }); } | processQuery |
26,813 | IProperty () { return getPsiElement() != null ? myProperty : null; } | getProperty |
26,814 | PsiElement () { PsiElement element = myProperty.getPsiElement(); return element.isValid() ? element : null; } | getPsiElement |
26,815 | void (final String presentableName) { myPresentableName = presentableName; } | setPresentableName |
26,816 | String () { return myGrouped.getAsBoolean() ? myPresentableName : null; } | getPresentableName |
26,817 | IProperty () { return getProperty(); } | getValue |
26,818 | TextAttributes (EditorColorsScheme colorsScheme) { return null; } | getErrorTextAttributes |
26,819 | ItemPresentation () { return new TextAttributesPresentation() { @Nullable @Override public TextAttributesKey getTextAttributesKey() { return (getPresentableName() != null && getPresentableName().isEmpty()) ? GROUP_KEY : null; } @Override public String getPresentableText() { IProperty property = getProperty(); if (property == null) return null; String presentableName = getPresentableName(); if (presentableName == null) { return property.getName(); } return !presentableName.isEmpty() ? presentableName : PropertiesBundle.message("structure.view.empty.property.presentation"); } @Override public Icon getIcon(boolean open) { return myProperty.getIcon(0); } @Override public TextAttributes getTextAttributes(EditorColorsScheme colorsScheme) { final TextAttributesKey baseAttrKey = (getPresentableName() != null && getPresentableName().isEmpty()) ? GROUP_KEY : PropertiesHighlighter.PropertiesComponent.PROPERTY_KEY.getTextAttributesKey(); final TextAttributes baseAttrs = colorsScheme.getAttributes(baseAttrKey); if (getPsiElement() != null) { TextAttributes highlightingAttributes = getErrorTextAttributes(colorsScheme); if (highlightingAttributes != null) { return TextAttributes.merge(baseAttrs, highlightingAttributes); } } return baseAttrs; } }; } | getPresentation |
26,820 | TextAttributesKey () { return (getPresentableName() != null && getPresentableName().isEmpty()) ? GROUP_KEY : null; } | getTextAttributesKey |
26,821 | String () { IProperty property = getProperty(); if (property == null) return null; String presentableName = getPresentableName(); if (presentableName == null) { return property.getName(); } return !presentableName.isEmpty() ? presentableName : PropertiesBundle.message("structure.view.empty.property.presentation"); } | getPresentableText |
26,822 | Icon (boolean open) { return myProperty.getIcon(0); } | getIcon |
26,823 | TextAttributes (EditorColorsScheme colorsScheme) { final TextAttributesKey baseAttrKey = (getPresentableName() != null && getPresentableName().isEmpty()) ? GROUP_KEY : PropertiesHighlighter.PropertiesComponent.PROPERTY_KEY.getTextAttributesKey(); final TextAttributes baseAttrs = colorsScheme.getAttributes(baseAttrKey); if (getPsiElement() != null) { TextAttributes highlightingAttributes = getErrorTextAttributes(colorsScheme); if (highlightingAttributes != null) { return TextAttributes.merge(baseAttrs, highlightingAttributes); } } return baseAttrs; } | getTextAttributes |
26,824 | void (boolean requestFocus) { myProperty.navigate(requestFocus); } | navigate |
26,825 | boolean () { return myProperty.canNavigate(); } | canNavigate |
26,826 | boolean () { return myProperty.canNavigateToSource(); } | canNavigateToSource |
26,827 | PsiElement (@Nullable PsiElement sourceElement, Editor editor) { Property property = findProperty(sourceElement); if (property == null) return null; final String key = property.getKey(); if (key == null) return null; PropertiesFile currentFile = PropertiesImplUtil.getPropertiesFile(property.getContainingFile()); if (currentFile == null) return null; do { currentFile = PropertiesUtil.getParent(currentFile, currentFile.getResourceBundle().getPropertiesFiles()); if (currentFile != null) { final IProperty parent = currentFile.findPropertyByKey(key); if (parent != null) return parent.getPsiElement(); } else { return null; } } while (true); } | getGotoDeclarationTarget |
26,828 | Property (@Nullable PsiElement source) { if (source == null) return null; if (source instanceof Property) return (Property)source; final PsiElement parent = source.getParent(); return parent instanceof Property ? (Property)parent : null; } | findProperty |
26,829 | void (@NotNull PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withLocalName("key"), new PsiReferenceProvider() { @Override public boolean acceptsTarget(@NotNull PsiElement target) { return target instanceof PomTargetPsiElement && ((PomTargetPsiElement)target).getTarget() instanceof XmlProperty; } @Override public PsiReference @NotNull [] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) { PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(element.getContainingFile()); if (propertiesFile == null) return PsiReference.EMPTY_ARRAY; XmlProperty property = new XmlProperty(PsiTreeUtil.getParentOfType(element, XmlTag.class), (XmlPropertiesFileImpl)propertiesFile); return new PsiReference[] {new PsiReferenceBase.Immediate<>(element, PomService.convertToPsi(property))}; } }); } | registerReferenceProviders |
26,830 | boolean (@NotNull PsiElement target) { return target instanceof PomTargetPsiElement && ((PomTargetPsiElement)target).getTarget() instanceof XmlProperty; } | acceptsTarget |
26,831 | void () { while (myFileModificationStamp != myFile.getModificationStamp() || myPropertiesMap == null) { myFileModificationStamp = myFile.getModificationStamp(); MostlySingularMultiMap<String, IProperty> propertiesMap = new MostlySingularMultiMap<>(); XmlTag rootTag = myFile.getRootTag(); final List<IProperty> propertiesOrder = new ArrayList<>(); if (rootTag != null) { XmlTag[] entries = rootTag.findSubTags(ENTRY_TAG_NAME); for (XmlTag entry : entries) { XmlProperty property = new XmlProperty(entry, this); propertiesOrder.add(property); final String key = property.getKey(); if (key != null) { propertiesMap.add(key, property); } } } myAlphaSorted = PropertiesImplUtil.isAlphaSorted(propertiesOrder); myProperties = propertiesOrder; myPropertiesMap = propertiesMap; } } | ensurePropertiesLoaded |
26,832 | PsiFile () { return myFile; } | getContainingFile |
26,833 | List<IProperty> () { synchronized (myLock) { ensurePropertiesLoaded(); return myProperties; } } | getProperties |
26,834 | IProperty (@NotNull @NonNls String key) { synchronized (myLock) { ensurePropertiesLoaded(); Iterator<IProperty> properties = myPropertiesMap.get(key).iterator(); return properties.hasNext() ? properties.next(): null; } } | findPropertyByKey |
26,835 | List<IProperty> (@NotNull @NonNls String key) { synchronized (myLock) { ensurePropertiesLoaded(); return ContainerUtil.collect(myPropertiesMap.get(key).iterator()); } } | findPropertiesByKey |
26,836 | ResourceBundle () { return PropertiesImplUtil.getResourceBundle(this); } | getResourceBundle |
26,837 | Locale () { return PropertiesUtil.getLocale(this); } | getLocale |
26,838 | IProperty (@NotNull String key, @NotNull String value, IProperty anchor) { return addPropertyAfter(key, value, anchor, true); } | addPropertyAfter |
26,839 | IProperty (String key, String value, @Nullable IProperty anchor, boolean addToEnd) { final XmlTag anchorTag = anchor == null ? null : (XmlTag)anchor.getPsiElement().getNavigationElement(); final XmlTag rootTag = myFile.getRootTag(); final XmlTag entry = createPropertyTag(key, value); final XmlTag addedEntry = (XmlTag) (anchorTag == null ? myFile.getRootTag().addSubTag(entry, !addToEnd) : rootTag.addAfter(entry, anchorTag)); return new XmlProperty(addedEntry, this); } | addPropertyAfter |
26,840 | IProperty (@NotNull String key, @NotNull String value, @NotNull PropertyKeyValueFormat format) { final XmlTag entry = createPropertyTag(key, value); synchronized (myLock) { ensurePropertiesLoaded(); if (myAlphaSorted) { final XmlProperty dummyProperty = new XmlProperty(entry, this); final int insertIndex = Collections.binarySearch(myProperties, dummyProperty, (p1, p2) -> { final String k1 = p1.getKey(); final String k2 = p2.getKey(); return k1.compareTo(k2); }); final IProperty insertPosition; final IProperty inserted; if (insertIndex == -1) { inserted = addPropertyAfter(key, value, null, false); myProperties.add(0, inserted); } else { final int position = insertIndex < 0 ? -insertIndex - 2 : insertIndex; insertPosition = myProperties.get(position); inserted = addPropertyAfter(key, value, insertPosition, false); myProperties.add(position + 1, inserted); } return inserted; } else { return addPropertyAfter(key, value, null, true); } } } | addProperty |
26,841 | XmlTag (final String key, final String value) { XmlTag rootTag = myFile.getRootTag(); XmlTag entry = rootTag.createChildTag("entry", "", value, false); entry.setAttribute("key", key); return entry; } | createPropertyTag |
26,842 | PropertiesFile (@NotNull PsiFile file) { CachedValuesManager manager = CachedValuesManager.getManager(file.getProject()); if (file instanceof XmlFile) { return manager.getCachedValue(file, KEY, () -> { PropertiesFile value = XmlPropertiesIndex.isPropertiesFile((XmlFile)file) ? new XmlPropertiesFileImpl((XmlFile)file) : null; return CachedValueProvider.Result.create(value, file); }, false ); } return null; } | getPropertiesFile |
26,843 | String () { return getContainingFile().getName(); } | getName |
26,844 | VirtualFile () { return getContainingFile().getVirtualFile(); } | getVirtualFile |
26,845 | PsiDirectory () { return getContainingFile().getParent(); } | getParent |
26,846 | Project () { return getContainingFile().getProject(); } | getProject |
26,847 | String () { return getContainingFile().getText(); } | getText |
26,848 | boolean () { synchronized (myLock) { ensurePropertiesLoaded(); return myAlphaSorted; } } | isAlphaSorted |
26,849 | boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; XmlPropertiesFileImpl that = (XmlPropertiesFileImpl)o; if (!myFile.equals(that.myFile)) return false; return true; } | equals |
26,850 | int () { return myFile.hashCode(); } | hashCode |
26,851 | String () { return "XmlPropertiesFileImpl:" + getName(); } | toString |
26,852 | String () { return myTag.getAttributeValue("key"); } | getName |
26,853 | boolean () { return myTag.isWritable(); } | isWritable |
26,854 | PsiElement (@NotNull String name) { return myTag.setAttribute("key", name); } | setName |
26,855 | String () { return getName(); } | getKey |
26,856 | String () { return myTag.getValue().getText(); } | getValue |
26,857 | String () { return getValue(); } | getUnescapedValue |
26,858 | String () { return getKey(); } | getUnescapedKey |
26,859 | String () { return null; } | getDocCommentText |
26,860 | PsiElement () { return PomService.convertToPsi(this); } | getPsiElement |
26,861 | void (boolean requestFocus) { } | navigate |
26,862 | boolean () { return true; } | canNavigate |
26,863 | boolean () { return true; } | canNavigateToSource |
26,864 | Icon (int flags) { return PlatformIcons.PROPERTY_ICON; } | getIcon |
26,865 | boolean () { return myTag.isValid(); } | isValid |
26,866 | PsiElement () { return myTag; } | getNavigationElement |
26,867 | boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; XmlProperty property = (XmlProperty)o; if (!myTag.equals(property.myTag)) return false; return true; } | equals |
26,868 | int () { return myTag.hashCode(); } | hashCode |
26,869 | String () { return "XmlProperty: key = '" + getKey() + "', value = '" + getValue() + "'"; } | toString |
26,870 | KeyDescriptor<Key> () { return this; } | getKeyDescriptor |
26,871 | DataExternalizer<String> () { return EnumeratorStringDescriptor.INSTANCE; } | getValueExternalizer |
26,872 | boolean (@NotNull VirtualFile file) { return file.getName().endsWith(".xml"); } | acceptInput |
26,873 | boolean () { return true; } | dependsOnFileContent |
26,874 | int () { return 2; } | getVersion |
26,875 | boolean (XmlFile file) { Project project = file.getProject(); if (!file.isValid()) return false; VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile == null || DumbService.isDumb(project) || NoAccessDuringPsiEvents.isInsideEventProcessing()) { CharSequence contents = file.getViewProvider().getContents(); return CharArrayUtil.indexOf(contents, HTTP_JAVA_SUN_COM_DTD_PROPERTIES_DTD, 0) != -1 && isAccepted(contents); } return !FileBasedIndex.getInstance().getFileData(NAME, virtualFile, project).isEmpty(); } | isPropertiesFile |
26,876 | boolean (CharSequence bytes) { return parse(bytes, true).accepted; } | isAccepted |
26,877 | MyIXMLBuilderAdapter (CharSequence text, boolean stopIfAccepted) { StdXMLReader reader = new StdXMLReader(CharArrayUtil.readerFromCharSequence(text)) { @Override public Reader openStream(String publicID, String systemID) throws IOException { if (!HTTP_JAVA_SUN_COM_DTD_PROPERTIES_DTD.equals(systemID)) throw new IOException(); return new StringReader(" "); } }; MyIXMLBuilderAdapter builder = new MyIXMLBuilderAdapter(stopIfAccepted); NanoXmlUtil.parse(reader, builder); return builder; } | parse |
26,878 | int (Key value) { return value.hashCode(); } | getHashCode |
26,879 | boolean (Key val1, Key val2) { return val1.isMarker == val2.isMarker && Objects.equals(val1.key, val2.key); } | isEqual |
26,880 | String () { return "Key{" + "isMarker=" + isMarker + ", key='" + key + '\'' + '}'; } | toString |
26,881 | int () { return isMarker ? 0 : key.hashCode(); } | hashCode |
26,882 | boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Key key1 = (Key)o; if (isMarker != key1.isMarker) return false; if (!Objects.equals(key, key1.key)) return false; return true; } | equals |
26,883 | void (String key, String nsPrefix, String nsURI, String value, String type) { if (insideEntry && "key".equals(key)) { this.key = value; } } | addAttribute |
26,884 | Icon (@NotNull PsiElement element, int flags) { return element instanceof XmlFile && ((XmlFile)element).getFileType() == XmlFileType.INSTANCE && PropertiesImplUtil.getPropertiesFile((XmlFile)element) != null ? PropertiesIcons.XmlProperties : null; } | getIcon |
26,885 | boolean (@NotNull PsiElement psiElement) { return psiElement instanceof PsiNamedElement; } | canFindUsagesFor |
26,886 | String (@NotNull PsiElement psiElement) { return HelpID.FIND_OTHER_USAGES; } | getHelpId |
26,887 | String (@NotNull PsiElement element) { if (element instanceof IProperty) return PropertiesBundle.message("terms.property"); return ""; } | getType |
26,888 | String (@NotNull PsiElement element) { if (element instanceof PsiNamedElement) { return StringUtil.notNullize(((PsiNamedElement)element).getName()); } return element.getText(); } | getDescriptiveName |
26,889 | String (@NotNull PsiElement element, boolean useFullName) { return getDescriptiveName(element); } | getNodeText |
26,890 | WordsScanner () { return new PropertiesWordsScanner(); } | getWordsScanner |
26,891 | String () { return PluginPathManager.getPluginHomePath("properties") + "/tests/testData"; } | getTestDataPath |
26,892 | void () { final TrailingSpacesInPropertyInspection inspection = new TrailingSpacesInPropertyInspection(); myFixture.enableInspections(inspection); myFixture.configureByFile("/propertiesFile/highlighting/trailingSpaces.properties"); myFixture.checkHighlighting(true, false, true); myFixture.disableInspections(inspection); } | testSimple |
26,893 | void () { final TrailingSpacesInPropertyInspection inspection = new TrailingSpacesInPropertyInspection(); inspection.myIgnoreVisibleSpaces = true; myFixture.enableInspections(inspection); VirtualFile file = myFixture.copyFileToProject("/propertiesFile/highlighting/trailingSpaces2.properties"); myFixture.configureFromExistingVirtualFile(file); myFixture.checkHighlighting(true, false, true); myFixture.disableInspections(inspection); } | testOnlyNonVisible |
26,894 | void () { doTest(""" a.b.c=dddd a.b.d=dddd a.x=i b.n.p=ooo""", """ -Test.properties -a -b c d x b.n.p"""); } | testGrouping |
26,895 | void () { doTest(""" a=dddd a.b=dddd a.b.c=i a.b.c.d=ooo""", """ -Test.properties -a <property> -b <property> -c <property> d"""); } | testNesting |
26,896 | void () { doTest(""" log4j.category.x=dd log4j.category.xdo=dd log4j.category.middlegen.swing.ss=dd log4j.category.middlegen.plugins.ss=dd log4j.appender.middlegen.plugins.ss=dd""", """ -Test.properties -log4j appender.middlegen.plugins.ss -category -middlegen plugins.ss swing.ss x xdo"""); } | testGroupSort |
26,897 | void () { doTest(""" errors.byte={0} must be a BYTE type\s errors.short={0} must be a SHORT type\s error.date={0} must be a DATE types\s error.range={0} is not between {1} and {2}\s errors.email={0} is not a valid Email Address\s errors.ipaddress={0} is not a valid IP address""", """ -Test.properties -error date range -errors byte email ipaddress short"""); } | testFunkyGroups |
26,898 | void (String classText, String expected) { myFixture.configureByText("Test.properties", classText); myFixture.testStructureView(svc -> { svc.setActionActive(Sorter.ALPHA_SORTER_ID, true); svc.setActionActive(GroupByWordPrefixes.ID, true); svc.setActionActive(PropertiesFileStructureViewModel.KIND_SORTER_ID, true); JTree tree = svc.getTree(); PlatformTestUtil.expandAll(tree); PlatformTestUtil.assertTreeEqual(tree, expected); }); } | doTest |
26,899 | String () { return PluginPathManager.getPluginHomePath("properties") + "/tests/testData/propertiesFile/projectView"; } | getTestDataPath |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.