Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
299,400
boolean (@NotNull XmlElement element, @NotNull PsiElementProcessor<? super PsiElement> processor, boolean deepFlag) { return XmlPsiUtil.processXmlElements(element, processor, deepFlag); }
processXmlElements
299,401
boolean (@NotNull XmlElement element, @NotNull PsiElementProcessor<? super PsiElement> processor, boolean deepFlag, boolean wideFlag) { return XmlPsiUtil.processXmlElements(element, processor, deepFlag, wideFlag); }
processXmlElements
299,402
boolean (@NotNull XmlElement element, @NotNull PsiElementProcessor<? super PsiElement> processor, final boolean deepFlag, final boolean wideFlag, final PsiFile baseFile) { return XmlPsiUtil.processXmlElements(element, processor, deepFlag, wideFlag, baseFile); }
processXmlElements
299,403
boolean (@NotNull XmlElement element, @NotNull PsiElementProcessor<? super PsiElement> processor, final boolean deepFlag, final boolean wideFlag, final PsiFile baseFile, boolean processIncludes) { return XmlPsiUtil.processXmlElements(element, processor, deepFlag, wideFlag, baseFile, processIncludes); }
processXmlElements
299,404
boolean (@NotNull XmlElement element, @NotNull PsiElementProcessor<? super PsiElement> processor, final boolean deepFlag) { return XmlPsiUtil.processXmlElementChildren(element, processor, deepFlag); }
processXmlElementChildren
299,405
boolean (final @NotNull XmlTag tag) { final String ns = tag.getNamespace(); return nsFromTemplateFramework(ns); }
tagFromTemplateFramework
299,406
boolean (final String ns) { return XSLT_URI.equals(ns) || XINCLUDE_URI.equals(ns); }
nsFromTemplateFramework
299,407
char (@NonNls @NotNull String text) { try { if (text.charAt(1) != '#') { text = text.substring(1, text.length() - 1); char c = XmlTagUtil.getCharacterByEntityName(text); if (c == 0) { LOG.error("Unknown entity: " + text); } return c == 0 ? ' ' : c; } text = text.substring(2, text.length() - 1); } catch (StringIndexOutOfBoundsException e) { LOG.error("Cannot parse ref: '" + text + "'", e); } try { int code; if (StringUtil.startsWithChar(text, 'x')) { text = text.substring(1); code = Integer.parseInt(text, 16); } else { code = Integer.parseInt(text); } return (char)code; } catch (NumberFormatException e) { return 0; } }
getCharFromEntityRef
299,408
boolean (final @NonNls String name, final XmlTag tag) { return "jsfc".equals(name) && isJsfHtmlScheme(tag); }
attributeFromTemplateFramework
299,409
boolean (final PsiFile file) { if (file instanceof XmlFile xmlFile) { final XmlDocument document = xmlFile.getDocument(); if (document != null) { final XmlTag tag = document.getRootTag(); if (tag != null && "project".equals(tag.getName()) && tag.getContext() instanceof XmlDocument) { if (tag.getAttributeValue("default") != null) { return true; } VirtualFile vFile = xmlFile.getOriginalFile().getVirtualFile(); if (vFile != null && vFile.getUserData(ANT_FILE_SIGN) != null) { return true; } } } } return false; }
isAntFile
299,410
boolean (XmlTag tag) { for (String jsfHtmlUri : JSF_HTML_URIS) { if (tag.getNSDescriptor(jsfHtmlUri, true) != null) { return true; } } return false; }
isJsfHtmlScheme
299,411
void (XmlTag tag) { ASTNode child = XmlChildRole.START_TAG_END_FINDER.findChild(tag.getNode()); if (child == null) { CodeStyleManager.getInstance(tag.getProject()).reformat(tag); } else { CodeStyleManager.getInstance(tag.getProject()) .reformatRange(tag, tag.getTextRange().getStartOffset(), child.getTextRange().getEndOffset()); } }
reformatTagStart
299,412
void (@NotNull XmlTag tag) { XmlTag newTag = XmlElementFactory.getInstance(tag.getProject()).createTagFromText('<' + tag.getName() + "></" + tag.getName() + '>'); ASTNode node = tag.getNode(); if (!(node instanceof CompositeElement compositeElement)) return; final LeafElement emptyTagEnd = (LeafElement)XmlChildRole.EMPTY_TAG_END_FINDER.findChild(compositeElement); if (emptyTagEnd == null) return; if (XmlTokenType.WHITESPACES.contains(emptyTagEnd.getTreePrev().getElementType())) { compositeElement.removeChild(emptyTagEnd.getTreePrev()); } compositeElement.removeChild(emptyTagEnd); PsiElement[] children = newTag.getChildren(); compositeElement.addChildren(children[2].getNode(), null, null); }
expandTag
299,413
String (Project project) { final String doctype = ExternalResourceManagerEx.getInstanceEx().getDefaultHtmlDoctype(project); return Html5SchemaProvider.getHtml5SchemaLocation().equals(doctype) ? Html5SchemaProvider.getXhtml5SchemaLocation() : doctype; }
getDefaultXhtmlNamespace
299,414
CharSequence (final CharSequence tagName) { int pos = StringUtil.indexOf(tagName, ':'); if (pos == -1) { return tagName; } return tagName.subSequence(pos + 1, tagName.length()); }
getLocalName
299,415
boolean () { return BUILDING_DOM_STUBS.get(); }
isStubBuilding
299,416
String (String id) { if (id.contains("XHTML")) { if (id.contains("1.1")) { if (id.contains("Basic")) { return "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd"; } return "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"; } else { if (id.contains("Strict")) { return "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"; } else if (id.contains("Frameset")) { return "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"; } else if (id.contains("Transitional")) { return "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"; } } } else if (id.contains("HTML")) { if (id.contains("Strict")) { return "http://www.w3.org/TR/html4/strict.dtd"; } else if (id.contains("Frameset")) { return "http://www.w3.org/TR/html4/frameset.dtd"; } return HTML4_LOOSE_URI; } return null; }
guessDtdByPublicId
299,417
void (XmlTag tag, final Map<String, List<String>> tagsMap, final Map<String, List<MyAttributeInfo>> attributesMap, final boolean processIncludes) { if (tag == null) { return; } final String tagName = tag.getName(); List<MyAttributeInfo> list = attributesMap.get(tagName); if (list == null) { list = new ArrayList<>(); final XmlAttribute[] attributes = tag.getAttributes(); for (final XmlAttribute attribute : attributes) { list.add(new MyAttributeInfo(attribute.getName())); } } else { final XmlAttribute[] attributes = tag.getAttributes().clone(); list.sort(null); Arrays.sort(attributes, Comparator.comparing(XmlAttribute::getName)); final Iterator<MyAttributeInfo> iter = list.iterator(); list = new ArrayList<>(); int index = 0; while (iter.hasNext()) { final MyAttributeInfo info = iter.next(); boolean requiredFlag = false; while (attributes.length > index) { if (info.compareTo(attributes[index]) != 0) { if (info.compareTo(attributes[index]) < 0) { break; } if (attributes[index].getValue() != null) list.add(new MyAttributeInfo(attributes[index].getName(), false)); index++; } else { requiredFlag = true; index++; break; } } info.myRequired &= requiredFlag; list.add(info); } while (attributes.length > index) { if (attributes[index].getValue() != null) { list.add(new MyAttributeInfo(attributes[index++].getName(), false)); } else { index++; } } } attributesMap.put(tagName, list); final List<String> tags = tagsMap.get(tagName) != null ? tagsMap.get(tagName) : new ArrayList<>(); tagsMap.put(tagName, tags); PsiFile file = tag.isValid() ? tag.getContainingFile() : null; processXmlElements(tag, new FilterElementProcessor(XmlTagFilter.INSTANCE) { @Override public void add(PsiElement element) { XmlTag tag = (XmlTag)element; if (!tags.contains(tag.getName())) { tags.add(tag.getName()); } computeTag(tag, tagsMap, attributesMap, processIncludes); } }, false, false, file, processIncludes); /*tag.processElements(new FilterElementProcessor(XmlTagFilter.INSTANCE) { public void add(PsiElement element) { XmlTag tag = (XmlTag)element; if (!tags.contains(tag.getName())) { tags.add(tag.getName()); } computeTag(tag, tagsMap, attributesMap); } }, tag);*/ }
computeTag
299,418
void (PsiElement element) { XmlTag tag = (XmlTag)element; if (!tags.contains(tag.getName())) { tags.add(tag.getName()); } computeTag(tag, tagsMap, attributesMap, processIncludes); }
add
299,419
void (PsiElement element) { XmlTag tag = (XmlTag)element; if (!tags.contains(tag.getName())) { tags.add(tag.getName()); } computeTag(tag, tagsMap, attributesMap); }
add
299,420
boolean (final XmlTag element, final HashSet<? super String> variants) { return processEnumerationValues(element, xmlTag -> { variants.add(xmlTag.getAttributeValue(VALUE_ATTR_NAME)); return true; }); }
collectEnumerationValues
299,421
boolean (final XmlTag element, final Processor<? super XmlTag> tagProcessor) { return processEnumerationValues(element, tagProcessor, new HashSet<>()); }
processEnumerationValues
299,422
boolean (XmlTag element, Processor<? super XmlTag> tagProcessor, Set<? super XmlTag> visited) { if (!visited.add(element)) return true; boolean exhaustiveEnum = true; for (final XmlTag tag : element.getSubTags()) { final @NonNls String localName = tag.getLocalName(); if (localName.equals(ENUMERATION_TAG_NAME)) { final String attributeValue = tag.getAttributeValue(VALUE_ATTR_NAME); if (attributeValue != null) { if (!tagProcessor.process(tag)) { return exhaustiveEnum; } } } else if (localName.equals("union")) { exhaustiveEnum = false; processEnumerationValues(tag, tagProcessor, visited); XmlAttribute attribute = tag.getAttribute("memberTypes"); if (attribute != null && attribute.getValueElement() != null) { for (PsiReference reference : attribute.getValueElement().getReferences()) { PsiElement resolve = reference.resolve(); if (resolve instanceof XmlTag) { processEnumerationValues((XmlTag)resolve, tagProcessor, visited); } } } } else if (localName.equals("extension")) { XmlTag base = XmlSchemaTagsProcessor.resolveTagReference(tag.getAttribute("base")); if (base != null) { return processEnumerationValues(base, tagProcessor, visited); } } else if (!doNotVisitTags.contains(localName)) { // don't go into annotation exhaustiveEnum &= processEnumerationValues(tag, tagProcessor, visited); } } return exhaustiveEnum; }
processEnumerationValues
299,423
XmlTag (@NotNull XmlTag xmlTag, @NotNull String localName, @Nullable String namespace, @Nullable String bodyText, boolean enforceNamespacesDeep, @NotNull Function<String, XmlTag> tagFromTextFactory) { String qname; final String prefix = xmlTag.getPrefixByNamespace(namespace); if (prefix != null && !prefix.isEmpty()) { qname = prefix + ":" + localName; } else { qname = localName; } try { String tagStart = qname + (!StringUtil.isEmpty(namespace) && xmlTag.getPrefixByNamespace(namespace) == null && !(StringUtil.isEmpty(xmlTag.getNamespacePrefix()) && namespace.equals(xmlTag.getNamespace())) ? " xmlns=\"" + namespace + "\"" : ""); XmlTag retTag; if (bodyText != null) { retTag = tagFromTextFactory.apply("<" + tagStart + ">" + bodyText + "</" + qname + ">"); if (enforceNamespacesDeep) { retTag.acceptChildren(new XmlRecursiveElementVisitor() { @Override public void visitXmlTag(@NotNull XmlTag tag) { final String namespacePrefix = tag.getNamespacePrefix(); if (namespacePrefix.isEmpty()) { String qname; if (prefix != null && !prefix.isEmpty()) { qname = prefix + ":" + tag.getLocalName(); } else { qname = tag.getLocalName(); } try { tag.setName(qname); } catch (IncorrectOperationException e) { LOG.error(e); } } super.visitXmlTag(tag); } }); } } else { retTag = tagFromTextFactory.apply("<" + tagStart + "/>"); } return retTag; } catch (IncorrectOperationException e) { LOG.error(e); } return null; }
createChildTag
299,424
void (@NotNull XmlTag tag) { final String namespacePrefix = tag.getNamespacePrefix(); if (namespacePrefix.isEmpty()) { String qname; if (prefix != null && !prefix.isEmpty()) { qname = prefix + ":" + tag.getLocalName(); } else { qname = tag.getLocalName(); } try { tag.setName(qname); } catch (IncorrectOperationException e) { LOG.error(e); } } super.visitXmlTag(tag); }
visitXmlTag
299,425
boolean (final @NotNull String unquotedValue, final PsiElement context) { for (int i = 0; i < unquotedValue.length(); ++i) { final char ch = unquotedValue.charAt(i); if (!Character.isJavaIdentifierPart(ch) && ch != ':' && ch != '-') { final XmlFile file = PsiTreeUtil.getParentOfType(context, XmlFile.class); if (file != null) { XmlTag tag = file.getRootTag(); return tag != null && !tagFromTemplateFramework(tag); } } } return true; }
isSimpleValue
299,426
boolean (@NotNull String str) { for (int i = 0; i < str.length(); i++) { if (toCode(str.charAt(i))) return true; } return false; }
toCode
299,427
boolean (char ch) { return "<&>\u00a0".indexOf(ch) >= 0; }
toCode
299,428
int (final @NotNull String s) { if (s.startsWith(TAG_DIR_NS_PREFIX)) return TAG_DIR_NS_PREFIX.length(); if (s.startsWith(FILE)) return FILE.length(); if (s.startsWith(CLASSPATH)) return CLASSPATH.length(); return 0; }
getPrefixLength
299,429
boolean (final String s, Project project) { final boolean surelyUrl = HtmlUtil.hasHtmlPrefix(s) || s.startsWith(URN); if (surelyUrl) return true; int protocolIndex = s.indexOf(":/"); if (protocolIndex > 1 && !s.regionMatches(0, "classpath", 0, protocolIndex)) return true; return !s.equals(ExternalResourceManager.getInstance().getResourceLocation(s, project)); }
isUrlText
299,430
String (XmlDocument doc, boolean full) { final Map<String, List<String>> tags = new LinkedHashMap<>(); final Map<String, List<MyAttributeInfo>> attributes = new LinkedHashMap<>(); final XmlTag rootTag = doc.getRootTag(); computeTag(rootTag, tags, attributes, full); // For supporting not well-formed XML for (PsiElement element = rootTag != null ? rootTag.getNextSibling() : null; element != null; element = element.getNextSibling()) { if (element instanceof XmlTag) { computeTag((XmlTag)element, tags, attributes, full); } } final StringBuilder buffer = new StringBuilder(); for (final String tagName : tags.keySet()) { buffer.append(generateElementDTD(tagName, tags.get(tagName), attributes.get(tagName))); } return buffer.toString(); }
generateDocumentDTD
299,431
String (String name, List<String> tags, List<? extends MyAttributeInfo> attributes) { if (name == null || name.isEmpty()) return ""; if (name.contains(CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED)) return ""; final @NonNls StringBuilder buffer = new StringBuilder(); buffer.append("<!ELEMENT ").append(name).append(" "); if (tags.isEmpty()) { buffer.append("(#PCDATA)>\n"); } else { buffer.append("("); final Iterator<String> iter = tags.iterator(); while (iter.hasNext()) { final String tagName = iter.next(); buffer.append(tagName); if (iter.hasNext()) { buffer.append("|"); } else { buffer.append(")*"); } } buffer.append(">\n"); } if (!attributes.isEmpty()) { buffer.append("<!ATTLIST ").append(name); for (final MyAttributeInfo info : attributes) { buffer.append("\n ").append(generateAttributeDTD(info)); } buffer.append(">\n"); } return buffer.toString(); }
generateElementDTD
299,432
String (MyAttributeInfo info) { if (info.myName.contains(CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED)) return ""; return info.myName + " " + "CDATA" + (info.myRequired ? " #REQUIRED" : " #IMPLIED"); }
generateAttributeDTD
299,433
String (final String prefix, XmlTag contextTag) { return contextTag.getNamespaceByPrefix(prefix); }
findNamespaceByPrefix
299,434
String (@NotNull String name) { final int prefixEnd = name.indexOf(':'); if (prefixEnd > 0) { return name.substring(0, prefixEnd); } return ""; }
findPrefixByQualifiedName
299,435
XmlFile (PsiElement element) { while (!(element instanceof XmlFile) && element != null) { final PsiElement context = element.getContext(); if (context == null) { //todo Dmitry Avdeev: either XmlExtension should work on any PsiFile (not just XmlFile), or you need to handle elements from JspJavaFile in some other way final XmlExtension extension = XmlExtension.getExtensionByElement(element); if (extension != null) { element = extension.getContainingFile(element); } } else { if (element == context) { LOG.error("Context==element: " + element.getClass()); return null; } element = context; } } return (XmlFile)element; }
getContainingFile
299,436
String (@NotNull String text) { return StringUtil.unescapeXmlEntities(text); }
unescape
299,437
String (@NotNull String text) { return StringUtil.escapeXmlEntities(text); }
escape
299,438
boolean (char c) { return Character.isLetter(c) || Character.isDigit(c) || c == ':' || c == '_' || c == '-' || c == '.'; }
isValidTagNameChar
299,439
void (PsiReferenceRegistrar registrar, @NonNls String @Nullable [] attributeNames, @Nullable ElementFilter elementFilter, @NotNull PsiReferenceProvider provider) { registerXmlAttributeValueReferenceProvider(registrar, attributeNames, elementFilter, true, provider); }
registerXmlAttributeValueReferenceProvider
299,440
void (PsiReferenceRegistrar registrar, @NonNls String @Nullable [] attributeNames, @Nullable ElementFilter elementFilter, boolean caseSensitive, @NotNull PsiReferenceProvider provider) { registerXmlAttributeValueReferenceProvider(registrar, attributeNames, elementFilter, caseSensitive, provider, PsiReferenceRegistrar.DEFAULT_PRIORITY); }
registerXmlAttributeValueReferenceProvider
299,441
void (PsiReferenceRegistrar registrar, @NonNls String @Nullable [] attributeNames, @Nullable ElementFilter elementFilter, boolean caseSensitive, @NotNull PsiReferenceProvider provider, double priority) { if (attributeNames == null) { registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().and(new FilterPattern(elementFilter)), provider, priority); return; } final StringPattern namePattern = caseSensitive ? StandardPatterns.string().oneOf(attributeNames) : StandardPatterns.string().oneOfIgnoreCase(attributeNames); registrar .registerReferenceProvider(XmlPatterns.xmlAttributeValue().withLocalName(namePattern).and(new FilterPattern(elementFilter)), provider, priority); }
registerXmlAttributeValueReferenceProvider
299,442
void (PsiReferenceRegistrar registrar, @NonNls String[] names, @Nullable ElementFilter elementFilter, boolean caseSensitive, @NotNull PsiReferenceProvider provider) { if (names == null) { registrar.registerReferenceProvider(XmlPatterns.xmlTag().and(new FilterPattern(elementFilter)), provider, PsiReferenceRegistrar.DEFAULT_PRIORITY); return; } final StringPattern namePattern = caseSensitive ? StandardPatterns.string().oneOf(names) : StandardPatterns.string().oneOfIgnoreCase(names); registrar.registerReferenceProvider(XmlPatterns.xmlTag().withLocalName(namePattern).and(new FilterPattern(elementFilter)), provider, PsiReferenceRegistrar.DEFAULT_PRIORITY); }
registerXmlTagReferenceProvider
299,443
XmlFile (@NotNull XmlTag tag, @NotNull XmlFile containingFile) { final XmlElementDescriptor descriptor = tag.getDescriptor(); final XmlNSDescriptor nsDescriptor = descriptor != null ? descriptor.getNSDescriptor() : null; XmlFile descriptorFile = nsDescriptor != null ? nsDescriptor.getDescriptorFile() : containingFile.getDocument().getProlog().getDoctype() != null ? containingFile : null; if (nsDescriptor != null && (descriptorFile == null || descriptorFile.getName().equals(containingFile.getName() + ".dtd"))) { descriptorFile = containingFile; } return descriptorFile; }
findDescriptorFile
299,444
boolean (final @NotNull XmlTag xmlTag) { final XmlNSDescriptor nsDescriptor = xmlTag.getNSDescriptor(xmlTag.getNamespace(), false); final XmlElementDescriptor descriptor = nsDescriptor != null ? nsDescriptor.getElementDescriptor(xmlTag) : null; return descriptor != null && !(descriptor instanceof AnyXmlElementDescriptor); }
isTagDefinedByNamespace
299,445
boolean (@NotNull XmlAttribute attribute, int offset) { InjectedLanguageManager manager = InjectedLanguageManager.getInstance(attribute.getProject()); PsiElement host = manager.getInjectionHost(attribute); if (host == null) return false; Document doc = PsiDocumentManager.getInstance(attribute.getProject()).getDocument(attribute.getContainingFile()); if (!(doc instanceof DocumentWindow)) return false; return ContainerUtil.exists(manager.getNonEditableFragments((DocumentWindow)doc), range -> { return range.getStartOffset() <= offset && offset <= (range.getEndOffset() + 1); }); }
hasNonEditableInjectionFragmentAt
299,446
boolean (@NotNull PsiFile file) { if (InjectedLanguageManager.getInstance(file.getProject()).getInjectionHost(file) == null) return true; var language = file.getLanguage(); return language instanceof HTMLLanguage && language != HTMLLanguage.INSTANCE; }
isNotInjectedOrCustomHtmlFile
299,447
int (Object o) { if (o instanceof MyAttributeInfo) { return myName.compareTo(((MyAttributeInfo)o).myName); } else if (o instanceof XmlAttribute) { return myName.compareTo(((XmlAttribute)o).getName()); } return -1; }
compareTo
299,448
boolean (PsiElement element) { if (element instanceof XmlTag xmlTag) { if (xmlTag.getParent() instanceof XmlDocument) return false; if (xmlTag.getLocalName().equals(INCLUDE_TAG_NAME) && xmlTag.getAttributeValue("href") != null) { if (xmlTag.getNamespace().equals(XmlPsiUtil.XINCLUDE_URI)) { return true; } } } return false; }
isXInclude
299,449
String (String baseId) { return myExternalResourcesMap.get(baseId); }
getPathByPublicId
299,450
String[] () { return ArrayUtilRt.toStringArray(myExternalResourcesMap.values()); }
getResourcePaths
299,451
PsiFile (String baseSystemId) { PsiFile baseFile = resolve(null, baseSystemId); if (baseFile != null) return baseFile; // Find relative to myFile File workingFile = new File(""); String workingDir = workingFile.getAbsoluteFile().getAbsolutePath().replace(File.separatorChar, '/'); VirtualFile parent = myFile.getVirtualFile().getParent(); if (parent == null) return null; String id = StringUtil.replace(baseSystemId, workingDir, parent.getPath()); VirtualFile vFile = UriUtil.findRelative(id, myFile); if (vFile == null) { vFile = UriUtil.findRelative(baseSystemId, myFile); } if (vFile == null) { try { vFile = VirtualFileManager.getInstance().findFileByUrl(VfsUtilCore.convertFromUrl(new URL(baseSystemId))); } catch (MalformedURLException ignore) { } } if (vFile != null && !vFile.isDirectory() && !(vFile.getFileSystem() instanceof HttpFileSystem)) { baseFile = PsiManager.getInstance(myProject).findFile(vFile); } return baseFile; }
getBaseFile
299,452
XMLInputSource (XMLResourceIdentifier xmlResourceIdentifier, String publicId, String defaultText) { try { myErrorReporter.processError( new SAXParseException(XmlPsiBundle.message("xml.inspections.validate.external.resource.is.not.registered", publicId), publicId, null, 0, 0), ValidateXmlActionHandler.ProblemType.ERROR); } catch (SAXException ignore) { } final XMLInputSource source = new XMLInputSource(xmlResourceIdentifier); source.setPublicId(publicId); source.setCharacterStream(new StringReader(defaultText)); return source; }
reportUnresolvedUrl
299,453
boolean (@NotNull String url) { try { String protocol = new URL(url).getProtocol(); return protocol.equals("http") || protocol.equals("https"); } catch (MalformedURLException e) { return false; } }
isHttpUrl
299,454
PsiFile (PsiFile baseFile, String location) { if (baseFile instanceof XmlFile) { XmlTag tag = ((XmlFile)baseFile).getRootTag(); if (tag != null) { XmlAttribute attribute = tag.getAttribute("schemaLocation", XmlUtil.XML_SCHEMA_INSTANCE_URI); if (attribute != null) { XmlAttributeValue element = attribute.getValueElement(); if (element != null) { PsiReference[] references = element.getReferences(); for (PsiReference reference : references) { if (location.equals(reference.getCanonicalText())) { PsiElement resolve = reference.resolve(); return resolve instanceof PsiFile ? (PsiFile)resolve : null; } } } } } } return null; }
resolveByLocation
299,455
void (final boolean stopOnUnDeclaredResource) { myStopOnUnDeclaredResource = stopOnUnDeclaredResource; }
setStopOnUnDeclaredResource
299,456
void (XmlNSDescriptor descriptor) { sequence.add(descriptor); }
add
299,457
XmlElementDescriptor (@NotNull XmlTag tag) { for (XmlNSDescriptor descriptor : sequence) { final XmlElementDescriptor elementDescriptor = descriptor.getElementDescriptor(tag); if (elementDescriptor != null) return elementDescriptor; } return null; }
getElementDescriptor
299,458
XmlFile () { for (XmlNSDescriptor descriptor : sequence) { final XmlFile file = descriptor.getDescriptorFile(); if (file != null) return file; } return null; }
getDescriptorFile
299,459
List<XmlNSDescriptor> () { return sequence; }
getSequence
299,460
PsiElement () { for (XmlNSDescriptor descriptor : sequence) { final PsiElement declaration = descriptor.getDeclaration(); if (declaration != null) return declaration; } return null; }
getDeclaration
299,461
String (PsiElement context) { for (XmlNSDescriptor descriptor : sequence) { final String name = descriptor.getName(context); if (name != null) return name; } return null; }
getName
299,462
String () { for (XmlNSDescriptor descriptor : sequence) { final String name = descriptor.getName(); if (name != null) return name; } return null; }
getName
299,463
void (PsiElement element) { for (XmlNSDescriptor descriptor : sequence) { descriptor.init(element); } }
init
299,464
XmlElement () { return getOriginal().getNameElement(); }
getNameElement
299,465
XmlTag () { return (XmlTag)super.getParent(); }
getParent
299,466
String () { return getOriginal().getValue(); }
getValue
299,467
String () { return getOriginal().getDisplayValue(); }
getDisplayValue
299,468
int (int offset) { return getOriginal().physicalToDisplay(offset); }
physicalToDisplay
299,469
int (int offset) { return getOriginal().displayToPhysical(offset); }
displayToPhysical
299,470
TextRange () { return getOriginal().getValueTextRange(); }
getValueTextRange
299,471
boolean () { return getOriginal().isNamespaceDeclaration(); }
isNamespaceDeclaration
299,472
boolean (@NotNull XmlTag tag, boolean toLowerCase) { final String name = tag.getName(); boolean result = EMPTY_TAGS_MAP.contains(!toLowerCase || tag.isCaseSensitive() ? name : StringUtil.toLowerCase(name)); return result && !XmlCustomElementDescriptor.isCustomElement(tag); }
isSingleHtmlTag
299,473
boolean (String tagName, boolean caseSensitive) { return EMPTY_TAGS_MAP.contains(caseSensitive ? tagName : StringUtil.toLowerCase(tagName)); }
isSingleHtmlTag
299,474
boolean (String tagName) { return isSingleHtmlTag(tagName, false); }
isSingleHtmlTag
299,475
boolean (@NotNull String tagName, boolean caseSensitive) { return OPTIONAL_END_TAGS_MAP.contains(caseSensitive ? tagName : StringUtil.toLowerCase(tagName)); }
isTagWithOptionalEnd
299,476
ThreeState (@NotNull String tagToClose, @NotNull String openingTag, boolean caseSensitive) { var normalizedTagToClose = caseSensitive ? tagToClose : StringUtil.toLowerCase(tagToClose); var normalizedOpeningTag = caseSensitive ? openingTag : StringUtil.toLowerCase(openingTag); if (!isTagWithOptionalEnd(normalizedTagToClose, true)) { return ThreeState.NO; } final Set<String> closingTags = AUTO_CLOSE_BY_OPENING_TAG.get(normalizedTagToClose); if (closingTags != null && closingTags.contains(normalizedOpeningTag)) { return ThreeState.YES; } return ThreeState.UNSURE; }
canOpeningTagAutoClose
299,477
boolean (@NotNull String tagToClose, @NotNull String closingTag, boolean caseSensitive) { var normalizedTagToClose = caseSensitive ? tagToClose : StringUtil.toLowerCase(tagToClose); var normalizedClosingTag = caseSensitive ? closingTag : StringUtil.toLowerCase(closingTag); if (!isTagWithOptionalEnd(normalizedTagToClose, true)) return false; if (normalizedTagToClose.equals("p")) { return P_AUTO_CLOSE_CLOSING_TAGS.contains(normalizedClosingTag); } return true; }
canClosingTagAutoClose
299,478
boolean (String tagName, boolean caseSensitive) { return BLOCK_TAGS_MAP.contains(caseSensitive ? tagName : StringUtil.toLowerCase(tagName)); }
isHtmlBlockTag
299,479
boolean (String tagName) { return isHtmlBlockTag(tagName, false); }
isHtmlBlockTag
299,480
boolean (@NotNull String tagName) { return POSSIBLY_INLINE_TAGS_MAP.contains(tagName); }
isPossiblyInlineTag
299,481
boolean (String tagName, boolean caseSensitive) { return INLINE_ELEMENTS_CONTAINER_MAP.contains(caseSensitive ? tagName : StringUtil.toLowerCase(tagName)); }
isInlineTagContainer
299,482
void (final XmlElementDescriptor descriptor, final XmlTag element, final List<? super XmlElementDescriptor> variants) { // add html block completions for tags with optional ends! String name = descriptor.getName(element); if (name != null && isTagWithOptionalEnd(name, false)) { PsiElement parent = element.getParent(); if (parent instanceof XmlTag && XmlChildRole.CLOSING_TAG_START_FINDER.findChild(parent.getNode()) != null) { return; } if (parent != null) { // we need grand parent since completion already uses parent's descriptor parent = parent.getParent(); } if (parent instanceof HtmlTag) { final XmlElementDescriptor parentDescriptor = ((HtmlTag)parent).getDescriptor(); if (parentDescriptor != descriptor && parentDescriptor != null) { for (final XmlElementDescriptor elementsDescriptor : parentDescriptor.getElementsDescriptors((XmlTag)parent)) { if (isHtmlBlockTag(elementsDescriptor.getName(), false)) { variants.add(elementsDescriptor); } } } } else if (parent instanceof HtmlDocumentImpl) { final XmlNSDescriptor nsDescriptor = descriptor.getNSDescriptor(); if (nsDescriptor != null) { for (XmlElementDescriptor elementDescriptor : nsDescriptor.getRootElementsDescriptors((XmlDocument)parent)) { if (isHtmlBlockTag(elementDescriptor.getName(), false) && !variants.contains(elementDescriptor)) { variants.add(elementDescriptor); } } } } } }
addHtmlSpecificCompletions
299,483
boolean () { return Registry.is("html.prefer.short.notation.of.boolean.attributes", true); }
isShortNotationOfBooleanAttributePreferred
299,484
void (boolean value, Disposable parent) { final boolean oldValue = isShortNotationOfBooleanAttributePreferred(); final RegistryValue registryValue = Registry.get("html.prefer.short.notation.of.boolean.attributes"); registryValue.setValue(value); Disposer.register(parent, new Disposable() { @Override public void dispose() { registryValue.setValue(oldValue); } }); }
setShortNotationOfBooleanAttributeIsPreferred
299,485
void () { registryValue.setValue(oldValue); }
dispose
299,486
boolean (@NotNull XmlAttributeDescriptor descriptor, @Nullable PsiElement context) { if (descriptor.isEnumerated()) { final String[] values = descriptor.getEnumeratedValues(); if (values == null) { return false; } if (values.length == 2) { return values[0].isEmpty() && values[1].equals(descriptor.getName()) || values[1].isEmpty() && values[0].equals(descriptor.getName()); } else if (values.length == 1) { return descriptor.getName().equals(values[0]); } } return context != null && isCustomBooleanAttribute(descriptor.getName(), context); }
isBooleanAttribute
299,487
boolean (@NotNull String attributeName, @NotNull PsiElement context) { final String entitiesString = getEntitiesString(context, XmlEntitiesInspection.BOOLEAN_ATTRIBUTE_SHORT_NAME); if (entitiesString != null) { StringTokenizer tokenizer = new StringTokenizer(entitiesString, ","); while (tokenizer.hasMoreElements()) { if (tokenizer.nextToken().equalsIgnoreCase(attributeName)) { return true; } } } return false; }
isCustomBooleanAttribute
299,488
XmlAttributeDescriptor[] (PsiElement context) { String entitiesString = getEntitiesString(context, XmlEntitiesInspection.ATTRIBUTE_SHORT_NAME); if (entitiesString == null) return XmlAttributeDescriptor.EMPTY; StringTokenizer tokenizer = new StringTokenizer(entitiesString, ","); XmlAttributeDescriptor[] descriptors = new XmlAttributeDescriptor[tokenizer.countTokens()]; int index = 0; while (tokenizer.hasMoreElements()) { final String customName = tokenizer.nextToken(); if (customName.isEmpty()) continue; descriptors[index++] = new XmlAttributeDescriptorImpl() { @Override public String getName(PsiElement context) { return customName; } @Override public String getName() { return customName; } }; } return descriptors; }
getCustomAttributeDescriptors
299,489
String (PsiElement context) { return customName; }
getName
299,490
String () { return customName; }
getName
299,491
XmlElementDescriptor[] (@Nullable PsiElement context) { String entitiesString = getEntitiesString(context, XmlEntitiesInspection.TAG_SHORT_NAME); if (entitiesString == null) return XmlElementDescriptor.EMPTY_ARRAY; StringTokenizer tokenizer = new StringTokenizer(entitiesString, ","); XmlElementDescriptor[] descriptors = new XmlElementDescriptor[tokenizer.countTokens()]; int index = 0; while (tokenizer.hasMoreElements()) { final String tagName = tokenizer.nextToken(); if (tagName.isEmpty()) continue; descriptors[index++] = new CustomXmlTagDescriptor(tagName); } return descriptors; }
getCustomTagDescriptors
299,492
XmlAttributeDescriptor[] (final XmlTag declarationTag, XmlAttributeDescriptor[] descriptors, final XmlAttribute context) { if (declarationTag instanceof HtmlTag) { descriptors = ArrayUtil.mergeArrays( descriptors, getCustomAttributeDescriptors(context) ); return descriptors; } boolean isJsfHtmlNamespace = false; for (String jsfHtmlUri : XmlUtil.JSF_HTML_URIS) { if (declarationTag.getPrefixByNamespace(jsfHtmlUri) != null) { isJsfHtmlNamespace = true; break; } } if (isJsfHtmlNamespace && declarationTag.getNSDescriptor(XmlUtil.XHTML_URI, true) != null && !XmlUtil.JSP_URI.equals(declarationTag.getNamespace())) { descriptors = ArrayUtil.append( descriptors, new XmlAttributeDescriptorImpl() { @Override public String getName(PsiElement context) { return JSFC; } @Override public String getName() { return JSFC; } }, XmlAttributeDescriptor.class ); } return descriptors; }
appendHtmlSpecificAttributeCompletions
299,493
String (PsiElement context) { return JSFC; }
getName
299,494
String () { return JSFC; }
getName
299,495
boolean (XmlDocument doc) { if (doc == null) { return false; } XmlProlog prolog = doc.getProlog(); XmlDoctype doctype = prolog != null ? prolog.getDoctype() : null; final PsiFile htmlFile = doc.getContainingFile(); final String htmlFileFullName; if (htmlFile != null) { final VirtualFile vFile = htmlFile.getVirtualFile(); htmlFileFullName = vFile == null ? htmlFile.getName() : vFile.getPath(); } else { htmlFileFullName = "unknown"; } if (doctype == null) { LOG.debug("DOCTYPE for " + htmlFileFullName + " is null"); return isHtmlTagContainingFile(doc) && Html5SchemaProvider.getHtml5SchemaLocation() .equals(ExternalResourceManagerEx.getInstanceEx().getDefaultHtmlDoctype(doc.getProject())); } final boolean html5Doctype = isHtml5Doctype(doctype); final String doctypeDescription = "text: " + doctype.getText() + ", dtdUri: " + doctype.getDtdUri() + ", publicId: " + doctype.getPublicId() + ", markupDecl: " + doctype.getMarkupDecl(); LOG.debug("DOCTYPE for " + htmlFileFullName + "; " + doctypeDescription + "; HTML5: " + html5Doctype); return html5Doctype; }
isHtml5Document
299,496
boolean (XmlDoctype doctype) { return doctype.getDtdUri() == null && doctype.getPublicId() == null && doctype.getMarkupDecl() == null; }
isHtml5Doctype
299,497
boolean (XmlElement context) { XmlDocument doc = PsiTreeUtil.getParentOfType(context, XmlDocument.class); if (doc == null && context != null) { return Html5SchemaProvider.getHtml5SchemaLocation() .equals(ExternalResourceManagerEx.getInstanceEx().getDefaultHtmlDoctype(context.getProject())); } return isHtml5Document(doc); }
isHtml5Context
299,498
boolean (@NotNull XmlTag tag) { if (!tag.getLanguage().isKindOf(HTMLLanguage.INSTANCE)) return false; XmlDocument doc = PsiTreeUtil.getParentOfType(tag, XmlDocument.class); String doctype = null; if (doc != null) { doctype = XmlUtil.getDtdUri(doc); } doctype = doctype == null ? ExternalResourceManagerEx.getInstanceEx().getDefaultHtmlDoctype(tag.getProject()) : doctype; return XmlUtil.XHTML4_SCHEMA_LOCATION.equals(doctype) || !StringUtil.containsIgnoreCase(doctype, "xhtml"); }
isHtmlTag
299,499
boolean (XmlElement context) { XmlDocument doc = PsiTreeUtil.getParentOfType(context, XmlDocument.class); if (doc == null) { return false; } XmlProlog prolog = doc.getProlog(); XmlDoctype doctype = prolog != null ? prolog.getDoctype() : null; return doctype != null && !isHtml5Doctype(doctype); }
hasNonHtml5Doctype