Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
50,400
void (String expression) { this.myExpression = expression; }
setExpression
50,401
String () { return myName + "<" + myExpression + ">"; }
toString
50,402
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final Variable variable = (Variable)o; if (myExpression != null ? !myExpression.equals(variable.myExpression) : variable.myExpression != null) return false; return !(myName != null ? !myName.equals(variable.myNam...
equals
50,403
int () { int result = (myName != null ? myName.hashCode() : 0); result = 29 * result + (myExpression != null ? myExpression.hashCode() : 0); return result; }
hashCode
50,404
Set<String> (Collection<Variable> second) { final HashSet<String> strings = new HashSet<>(); for (Variable variable : second) { strings.add(variable.getName()); } return strings; }
asSet
50,405
XmlElement (@NotNull PsiFile psiFile, @NotNull Editor editor) { PsiElement contextNode = psiFile.findElementAt(editor.getCaretModel().getOffset()); while (contextNode != null && !isValidContextNode(contextNode)) { contextNode = contextNode.getParent(); } assert contextNode == null || contextNode instanceof XmlElement; ...
findContextNode
50,406
boolean (@Nullable PsiElement contextNode) { return contextNode instanceof XmlTag || contextNode instanceof XmlDocument; }
isValidContextNode
50,407
PsiElement (@NotNull XmlTag tag) { final PsiElement element = findNameElement(tag); if (element != null) { return element; } LOG.error("Name element not found for " + tag); return tag; }
getNameElement
50,408
PsiElement (@NotNull XmlTag tag) { PsiElement[] children = tag.getChildren(); for (PsiElement child : children) { if (isNameElement(child)) { return child; } } return null; }
findNameElement
50,409
boolean (@Nullable PsiElement child) { if (child != null) { if (child.getParent() instanceof XmlTag) { if (child instanceof XmlToken) { if (((XmlToken)child).getTokenType() == XmlTokenType.XML_NAME) { return true; } } else if (child instanceof ASTNode) { return ((ASTNode)child).getElementType() == XmlTokenType.XML_NAME...
isNameElement
50,410
String (@NotNull XmlAttribute attribute) { final String name = attribute.getName(); if (name.indexOf(':') == -1) { return ""; } else { return name.substring(0, name.indexOf(':')); } }
getAttributePrefix
50,411
boolean (PsiElement contextNode) { if (contextNode instanceof PsiWhiteSpace) { PsiElement sibling = contextNode.getPrevSibling(); while (sibling != null && !isNameElement(sibling)) { sibling = sibling.getPrevSibling(); } return sibling != null; } else if (contextNode instanceof XmlToken) { if (((XmlToken)contextNode).g...
isStartTag
50,412
boolean (PsiElement contextNode) { if (contextNode instanceof PsiWhiteSpace) { PsiElement sibling = contextNode.getPrevSibling(); while (sibling != null && !isNameElement(sibling)) { sibling = sibling.getPrevSibling(); } return sibling != null; } else if (contextNode instanceof XmlToken) { if (((XmlToken)contextNode).g...
isEndTag
50,413
boolean (XmlTag context, String nsUri, String nsPrefix) { if (nsUri == null || nsUri.length() == 0 || nsPrefix != null && nsPrefix.length() > 0) { return true; } do { if (context.getLocalNamespaceDeclarations().containsValue(nsUri)) return true; context = (XmlTag)(context.getParent() instanceof XmlTag ? context.getPare...
isInDeclaredNamespace
50,414
String (final PsiFile file) { final String[] error = new String[1]; file.accept(new PsiRecursiveElementVisitor() { @Override public void visitErrorElement(@NotNull PsiErrorElement element) { error[0] = element.getErrorDescription(); } }); if (error[0] != null) return error[0]; final Annotator annotator = LanguageAnnota...
checkFile
50,415
void (@NotNull PsiErrorElement element) { error[0] = element.getErrorDescription(); }
visitErrorElement
50,416
void (@NotNull PsiElement element) { AnnotationSessionImpl.computeWithSession(file, false, holder -> { holder.runAnnotatorWithContext(element, annotator); for (Annotation annotation : holder) { if (annotation.getSeverity() == HighlightSeverity.ERROR) { error[0] = annotation.getMessage(); break; } } return null; }); sup...
visitElement
50,417
String (String uri) { return uri != null ? "{" + uri + "}:" : ""; }
makePrefix
50,418
Set<Namespace> () { return namespaces; }
getNamespaces
50,419
void (@NotNull XmlAttribute xmlAttribute) { if (xmlAttribute.isNamespaceDeclaration()) { LOG.debug("Namespace: " + xmlAttribute.getLocalName() + " => " + xmlAttribute.getValue()); addNamespace(xmlAttribute.getLocalName(), xmlAttribute.getValue()); } else { addAttribute(xmlAttribute); } }
visitXmlAttribute
50,420
void (@NotNull XmlTag tag) { final Map<String, String> namespaceDeclarations = tag.getLocalNamespaceDeclarations(); final Set<String> localPrefixes = namespaceDeclarations.keySet(); for (String prefix : localPrefixes) { // More namespace fun... // [IDEA-5883] XmlTag.getLocalNamespaceDeclarations() return "xmlns" for de...
visitXmlTag
50,421
void (XmlAttribute xmlAttribute) { final String namespace = xmlAttribute.getNamespace(); final String localName = xmlAttribute.getLocalName(); // [IDEA-5206] XmlAttribute.getNamespace() returns namespace of parent element if no prefix in attribute name. That's wrong final String name = xmlAttribute.getName(); if (name....
addAttribute
50,422
void (XmlTag tag) { final String uri = tag.getNamespace(); final String prefix = tag.getNamespacePrefix(); // [IDEA-5885] IDEA assigns System-URI of DTD as namespace. if (MyPsiUtil.isInDeclaredNamespace(tag, uri, prefix)) { elements.add(new QName(uri, tag.getLocalName(), prefix)); } else { elements.add(new QName("", ta...
addElement
50,423
void (final String prefix, final String value) { if (value.length() > 0) { final Namespace namespace = new Namespace(prefix, value); namespaces.add(namespace); } }
addNamespace
50,424
Set<Namespace> (final XmlFile psiFile) { final NamespaceCollector namespaceCollector = new NamespaceCollector(); final XmlDocument document = psiFile.getDocument(); if (document != null) { document.accept(namespaceCollector); } return namespaceCollector.namespaces; }
findAllNamespaces
50,425
CollectedInfo () { return new CollectedInfo(Collections.emptySet(), Collections.emptySet(), Collections.emptySet()); }
empty
50,426
CollectedInfo (final XmlFile psiFile) { final NamespaceCollector namespaceCollector = new NamespaceCollector(); final XmlDocument document = psiFile.getDocument(); if (document != null) { document.accept(namespaceCollector); } return new CollectedInfo(namespaceCollector.namespaces, namespaceCollector.elements, namespac...
collectInfo
50,427
void (String prefix) { this.prefix = prefix; }
setPrefix
50,428
String () { return prefix; }
getPrefix
50,429
String () { return uri; }
getUri
50,430
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final Namespace namespace = (Namespace)o; return !(uri != null ? !uri.equals(namespace.uri) : namespace.uri != null); }
equals
50,431
int () { return (uri != null ? uri.hashCode() : 0); }
hashCode
50,432
Namespace () { try { return (Namespace)super.clone(); } catch (CloneNotSupportedException e) { throw new Error(); } }
clone
50,433
Namespace () { return clone(); }
copy
50,434
Collection<Namespace> (Map<String, String> namespaces) { final List<Namespace> list = new ArrayList<>(namespaces.size()); for (Map.Entry<String, String> e : namespaces.entrySet()) { list.add(new Namespace(e.getKey(), e.getValue())); } return list; }
fromMap
50,435
void (final Editor editor) { final List<RangeHighlighter> hl = editor.getUserData(HIGHLIGHTERS_KEY); if (hl != null) { if (purgeInvalidHighlighters(editor, hl)) { final HighlightManager mgr = HighlightManager.getInstance(editor.getProject()); for (Iterator<RangeHighlighter> iterator = hl.iterator(); iterator.hasNext();...
clearHighlighters
50,436
void (Editor editor, RangeHighlighter highlighter) { List<RangeHighlighter> hl = editor.getUserData(HIGHLIGHTERS_KEY); if (hl == null) { hl = new LinkedList<>(); editor.putUserData(HIGHLIGHTERS_KEY, hl); } else { purgeInvalidHighlighters(editor, hl); } hl.add(highlighter); }
addHighlighter
50,437
void (Editor editor, RangeHighlighter h) { final HighlightManager mgr = HighlightManager.getInstance(editor.getProject()); mgr.removeSegmentHighlighter(editor, h); }
removeHighlighter
50,438
boolean (Editor editor) { final List<RangeHighlighter> hl = editor.getUserData(HIGHLIGHTERS_KEY); if (hl != null) { if (hl.isEmpty()) { return false; } return purgeInvalidHighlighters(editor, hl); } return false; }
hasHighlighters
50,439
boolean (Editor editor, List<RangeHighlighter> hl) { final Set<RangeHighlighter> set = new ReferenceOpenHashSet<>(editor.getMarkupModel().getAllHighlighters()); boolean hasHighlighter = false; for (Iterator<RangeHighlighter> iterator = hl.iterator(); iterator.hasNext();) { final RangeHighlighter h = iterator.next(); if...
purgeInvalidHighlighters
50,440
List<RangeHighlighter> (Editor editor) { if (!hasHighlighters(editor)) { return Collections.emptyList(); } else { return editor.getUserData(HIGHLIGHTERS_KEY); } }
getHighlighters
50,441
RangeHighlighter (Editor editor, final PsiElement node, TextAttributes attrs, Config cfg) { TextRange range; final PsiElement realElement; if ((node instanceof XmlTag tag) && cfg.isHighlightStartTagOnly()) { realElement = MyPsiUtil.getNameElement(tag); range = realElement.getTextRange(); } else { range = node.getTextRa...
highlightNode
50,442
Object (Editor e, PsiElement element) { if (!(element instanceof XmlTag)) { final String text = element.getText(); if ((text == null || text.length() == 0) && MyPsiUtil.isNameElement(element)) { final XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class, true); if (tag != null) { return tag.getName(); } } ret...
formatTooltip
50,443
XPathSupport () { return ApplicationManager.getApplication().getService(XPathSupport.class); }
getInstance
50,444
Iterator (Object contextNode) { if (!(contextNode instanceof XmlElement)) { return Collections.emptyIterator(); } return new PsiChildAxisIterator(contextNode); }
getChildAxisIterator
50,445
Iterator (Object contextNode) { if (!(contextNode instanceof XmlElement)) { return Collections.emptyIterator(); } return new NodeIterator((XmlElement)contextNode) { @Override protected PsiElement getFirstNode(PsiElement n) { while (n != null) { n = n.getParent(); if (n instanceof XmlTag) { return n; } } return null; } ...
getParentAxisIterator
50,446
PsiElement (PsiElement n) { while (n != null) { n = n.getParent(); if (n instanceof XmlTag) { return n; } } return null; }
getFirstNode
50,447
PsiElement (PsiElement n) { return null; }
getNextNode
50,448
Object (Object contextNode) { if (contextNode instanceof XmlDocument) { return contextNode; } while (contextNode instanceof PsiElement) { if (contextNode instanceof XmlDocument) { return contextNode; } contextNode = ((PsiElement)contextNode).getParent(); } return null; }
getDocumentNode
50,449
String (String prefix, Object element) { if (isElement(element)) { return ((XmlTag)element).getNamespaceByPrefix(prefix); } return super.translateNamespacePrefixToUri(prefix, element); }
translateNamespacePrefixToUri
50,450
String (Object obj) { LOG.assertTrue(obj instanceof XmlProcessingInstruction); XmlProcessingInstruction pi = (XmlProcessingInstruction)obj; return getProcessingInstructionTarget(pi); }
getProcessingInstructionTarget
50,451
String (XmlProcessingInstruction pi) { final PsiElement[] children = pi.getChildren(); LOG.assertTrue(children[1] instanceof XmlToken && ((XmlToken)children[1]).getTokenType() == XmlTokenType.XML_NAME, "Unknown PI structure"); String text = children[1].getText(); int i; for (i=0; i<text.length() && text.charAt(i) == ' ...
getProcessingInstructionTarget
50,452
String (Object obj) { LOG.assertTrue(obj instanceof XmlProcessingInstruction); XmlProcessingInstruction pi = (XmlProcessingInstruction)obj; int targetLength = getProcessingInstructionTarget(obj).length(); int piLength= pi.getText().length(); return pi.getText().substring(2 + targetLength, piLength - 2).trim(); }
getProcessingInstructionData
50,453
Object (Object contextNode) { return ((PsiElement)contextNode).getParent(); }
getParentNode
50,454
Object (String url) { final VirtualFile virtualFile = VfsUtilCore.findRelativeFile(url, file.getVirtualFile()); if (virtualFile != null) { final PsiFile file = this.file.getManager().findFile(virtualFile); if (file instanceof XmlFile) { return ((XmlFile)file).getDocument(); } } return null; }
getDocument
50,455
Iterator (Object contextNode) { if (isElement(contextNode)) { return new AttributeIterator((XmlElement)contextNode); } else { return Collections.emptyIterator(); } }
getAttributeAxisIterator
50,456
String (Object element) { LOG.assertTrue(element instanceof XmlTag); final XmlTag context = (XmlTag)element; final String namespaceUri = context.getNamespace(); if (context.getNamespacePrefix().isEmpty() || !MyPsiUtil.isInDeclaredNamespace(context, namespaceUri, context.getNamespacePrefix())) { return ""; } return name...
getElementNamespaceUri
50,457
String (Object element) { LOG.assertTrue(element instanceof XmlTag); return ((XmlTag)element).getLocalName(); }
getElementName
50,458
String (Object element) { LOG.assertTrue(element instanceof XmlTag); return ((XmlTag)element).getName(); }
getElementQName
50,459
String (Object attr) { LOG.assertTrue(attr instanceof XmlAttribute); final XmlAttribute attribute = ((XmlAttribute)attr); final String name = attribute.getName(); if (name.indexOf(':') == -1) return ""; final String uri = attribute.getNamespace(); if (!MyPsiUtil.isInDeclaredNamespace(attribute.getParent(), uri, MyPsiUt...
getAttributeNamespaceUri
50,460
String (Object attr) { LOG.assertTrue(attr instanceof XmlAttribute); return ((XmlAttribute)attr).getLocalName(); }
getAttributeName
50,461
String (Object attr) { LOG.assertTrue(attr instanceof XmlAttribute); return ((XmlAttribute)attr).getName(); }
getAttributeQName
50,462
boolean (Object object) { return object instanceof XmlDocument; }
isDocument
50,463
boolean (Object object) { return object instanceof XmlTag && isSupportedElement((XmlTag)object); }
isElement
50,464
boolean (XmlTag object) { // optimization: all tags from XML language are supported, but some from other languages (JSP, see IDEADEV-37939) are not return object.getLanguage() == XMLLanguage.INSTANCE || MyPsiUtil.findNameElement(object) != null; }
isSupportedElement
50,465
boolean (Object object) { return object instanceof XmlAttribute; }
isAttribute
50,466
boolean (Object object) { // TODO: implement when namespace axis is supported return false; }
isNamespace
50,467
boolean (Object object) { return object instanceof XmlComment; }
isComment
50,468
boolean (Object object) { return object instanceof PsiWhiteSpace ? ((PsiWhiteSpace)object).getParent() instanceof XmlText : object instanceof XmlText; }
isText
50,469
boolean (Object object) { return object instanceof XmlProcessingInstruction; }
isProcessingInstruction
50,470
String (Object comment) { LOG.assertTrue(comment instanceof XmlComment); PsiElement c = (PsiElement)comment; final PsiElement[] children = c.getChildren(); for (PsiElement child : children) { if (child instanceof XmlToken && ((XmlToken)child).getTokenType() == XmlTokenType.XML_COMMENT_CHARACTERS) { return child.getText...
getCommentStringValue
50,471
String (Object element) { LOG.assertTrue(element instanceof XmlTag); final TextCollector collector = new TextCollector(); ((XmlTag)element).accept(collector); return collector.getText(); }
getElementStringValue
50,472
String (Object attr) { LOG.assertTrue(attr instanceof XmlAttribute); return StringUtil.notNullize(((XmlAttribute)attr).getValue()); }
getAttributeStringValue
50,473
String (Object ns) { // TODO: implement when namespace axis is supported return null; }
getNamespaceStringValue
50,474
String (Object ns) { // TODO: implement when namespace axis is supported return null; }
getNamespacePrefix
50,475
String (Object txt) { if (txt instanceof XmlText) { return ((XmlText)txt).getValue(); } return txt instanceof PsiElement ? ((PsiElement)txt).getText() : txt.toString(); }
getTextStringValue
50,476
Object (Object object, final String elementId) { final XmlTag rootTag = ((XmlFile)((XmlElement)object).getContainingFile()).getRootTag(); if (rootTag == null) { return null; } final Ref<XmlTag> ref = new Ref<>(); rootTag.accept(new XmlRecursiveElementVisitor() { @Override public void visitElement(@NotNull PsiElement el...
getElementById
50,477
void (@NotNull PsiElement element) { if (ref.get() == null) { super.visitElement(element); } }
visitElement
50,478
void (@NotNull XmlAttribute attribute) { final XmlAttributeDescriptor descriptor = attribute.getDescriptor(); final String value = attribute.getValue(); if ((value != null && (descriptor != null && descriptor.hasIdType()))) { if (elementId.equals(value)) { ref.set(attribute.getParent()); } } }
visitXmlAttribute
50,479
void (@NotNull XmlText text) { builder.append(text.getValue()); }
visitXmlText
50,480
String () { return builder.toString(); }
getText
50,481
boolean () { return (node != null); }
hasNext
50,482
Object () { if (node == null) throw new NoSuchElementException(); PsiElement ret = node; node = getNextNode(node); while (!isXPathNode(node)) node = getNextNode(node); return ret; }
next
50,483
void () { throw new UnsupportedOperationException(); }
remove
50,484
boolean (PsiElement node) { // null is usable, because it means end //if (node == null) // return true; // TODO: FIXME return true; }
isXPathNode
50,485
String (XmlElement element, XmlTag context) { return XPathExpressionGenerator.getUniquePath(element, context); }
getUniquePath
50,486
String (XmlElement element, XmlTag context) { return XPathExpressionGenerator.getPath(element, context); }
getPath
50,487
String (String prefix) { final String uri = super.translateNamespacePrefixToUri(prefix); // avoid matching of undefined prefixes on default namespace if (prefix != null && prefix.length() > 0) { if (uri == null) { LOG.debug("Undefined prefix: " + prefix); return "urn:xpathview:undefined-namespace"; } else { return uri;...
translateNamespacePrefixToUri
50,488
PsiElement (PsiElement contextNode) { PsiElement n = contextNode.getFirstChild(); n = skipToXmlElement(n); return n; }
getFirstNode
50,489
PsiElement (PsiElement contextNode) { PsiElement n = contextNode.getNextSibling(); n = skipToXmlElement(n); return n; }
getNextNode
50,490
PsiElement (PsiElement n) { // attributes cannot appear in the child axis // optimize: skip XmlTokens while (n != null && (!isXmlElement(n) || isXmlToken(n) || isAttribute(n))) { n = n.getNextSibling(); } return n; }
skipToXmlElement
50,491
boolean (PsiElement n) { return (n instanceof XmlAttribute); }
isAttribute
50,492
boolean (PsiElement n) { return (n instanceof XmlElement || n instanceof PsiWhiteSpace); }
isXmlElement
50,493
boolean (PsiElement n) { return n instanceof XmlToken; }
isXmlToken
50,494
Iterator<XmlAttribute> (XmlAttribute[] attributes) { final List<XmlAttribute> attrs = new ArrayList<>(attributes.length); for (XmlAttribute attribute : attributes) { final String name = attribute.getName(); if (!name.startsWith("xmlns:") && !name.equals("xmlns")) { attrs.add(attribute); } } return attrs.iterator(); }
filterNamespaceAttrs
50,495
void () { throw new UnsupportedOperationException(); }
remove
50,496
boolean () { return theIterator.hasNext(); }
hasNext
50,497
Object () { return theIterator.next(); }
next
50,498
Object (PsiFile psiFile) { final VirtualFile virtualFile = psiFile.getVirtualFile(); return virtualFile != null ? virtualFile.getExtension() : null; }
extractInfo
50,499
Function () { return this; }
getImplementation