Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
302,600
Set<Define> () { return myResult != null ? Collections.singleton(myResult) : null; }
getResult
302,601
Grammar (@NotNull XmlFile element) { if (element instanceof RncFile) { return ((RncFile)element).getGrammar(); } final DomFileElement<RngGrammar> fileElement = DomManager.getDomManager(element.getProject()).getFileElement(element, RngGrammar.class); return fileElement != null ? fileElement.getRootElement() : null; }
getGrammar
302,602
boolean (XmlFile file, final PsiElementProcessor<? super XmlFile> processor) { VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile == null) { return processor.execute(file); } final Project project = file.getProject(); final VirtualFile[] files = FileIncludeManager.getManager(project).getIncludedFiles(virtualFile, true); return processRelatedFiles(file, files, processor); }
processForwardDependencies
302,603
boolean (@NotNull XmlFile file, PsiElementProcessor<? super XmlFile> processor) { VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile == null) { return processor.execute(file); } final Project project = file.getProject(); final VirtualFile[] files = FileIncludeManager.getManager(project).getIncludingFiles(virtualFile, true); return processRelatedFiles(file, files, processor); }
processBackwardDependencies
302,604
boolean (PsiFile file, VirtualFile[] files, PsiElementProcessor<? super XmlFile> processor) { Project project = file.getProject(); final PsiManager psiManager = PsiManager.getInstance(project); final PsiFile[] psiFiles = ContainerUtil.map2Array(files, PsiFile.class, (NullableFunction<VirtualFile, PsiFile>)file1 -> psiManager.findFile(file1)); for (final PsiFile psiFile : psiFiles) { if (!processFile(psiFile, processor)) { return false; } } return true; }
processRelatedFiles
302,605
boolean (PsiFile psiFile, PsiElementProcessor<? super XmlFile> processor) { final FileType type = psiFile.getFileType(); if (type == XmlFileType.INSTANCE && isRngFile(psiFile)) { if (!processor.execute((XmlFile)psiFile)) { return false; } } else if (type == RncFileType.getInstance()) { if (!processor.execute((XmlFile)psiFile)) { return false; } } return true; }
processFile
302,606
boolean (PsiFile psiFile) { return psiFile instanceof XmlFile && DomManager.getDomManager(psiFile.getProject()).getFileElement((XmlFile)psiFile, RngGrammar.class) != null; }
isRngFile
302,607
void (String name, String nsPrefix, String nsURI, String systemID, int lineNr) { attributeHandler = null; if (depth == 1 && RelaxNgMetaDataContributor.RNG_NAMESPACE.equals(nsURI)) { if ("define".equals(name)) { attributeHandler = new NanoXmlBuilder() { @Override public void addAttribute(String key, String nsPrefix, String nsURI, String value, String type) { if ("name".equals(key) && (nsURI == null || nsURI.length() == 0) && value != null) { map.put(value, null); } } }; } } depth++; }
startElement
302,608
void (String key, String nsPrefix, String nsURI, String value, String type) { if ("name".equals(key) && (nsURI == null || nsURI.length() == 0) && value != null) { map.put(value, null); } }
addAttribute
302,609
void (String name, String nsPrefix, String nsURI) { attributeHandler = null; depth--; }
endElement
302,610
void (Define define) { final String name = define.getName(); if (name != null) { map.put(name, null); } }
visitDefine
302,611
KeyDescriptor<String> () { return EnumeratorStringDescriptor.INSTANCE; }
getKeyDescriptor
302,612
boolean (@NotNull VirtualFile file) { return !(file.getFileSystem() instanceof JarFileSystem); }
acceptInput
302,613
boolean () { return true; }
dependsOnFileContent
302,614
int () { return 0; }
getVersion
302,615
Icon () { return AllIcons.Gutter.OverridenMethod; }
getIcon
302,616
AnAction () { return new AnAction() { @Override public void actionPerformed(@NotNull AnActionEvent e) { final PsiElement element = myDefine.getPsiElement(); if (element == null || !element.isValid()) return; final PsiElementProcessor.CollectElements<XmlFile> collector = new PsiElementProcessor.CollectElements<>(); final XmlFile localFile = (XmlFile)element.getContainingFile(); RelaxIncludeIndex.processBackwardDependencies(localFile, collector); final Collection<XmlFile> files = collector.getCollection(); final List<Define> result = new SmartList<>(); final OverriddenDefineSearcher searcher = new OverriddenDefineSearcher(myDefine, localFile, result); for (XmlFile file : files) { final Grammar grammar = GrammarFactory.getGrammar(file); if (grammar == null) continue; grammar.acceptChildren(searcher); } if (result.size() > 0) { OverridingDefineRenderer.doClickAction(e, result, RelaxngBundle.message("relaxng.gutter.go-to-overriding-defines")); } } }; }
getClickAction
302,617
void (@NotNull AnActionEvent e) { final PsiElement element = myDefine.getPsiElement(); if (element == null || !element.isValid()) return; final PsiElementProcessor.CollectElements<XmlFile> collector = new PsiElementProcessor.CollectElements<>(); final XmlFile localFile = (XmlFile)element.getContainingFile(); RelaxIncludeIndex.processBackwardDependencies(localFile, collector); final Collection<XmlFile> files = collector.getCollection(); final List<Define> result = new SmartList<>(); final OverriddenDefineSearcher searcher = new OverriddenDefineSearcher(myDefine, localFile, result); for (XmlFile file : files) { final Grammar grammar = GrammarFactory.getGrammar(file); if (grammar == null) continue; grammar.acceptChildren(searcher); } if (result.size() > 0) { OverridingDefineRenderer.doClickAction(e, result, RelaxngBundle.message("relaxng.gutter.go-to-overriding-defines")); } }
actionPerformed
302,618
boolean () { return true; }
isNavigateAction
302,619
String () { return RelaxngBundle.message("relaxng.gutter.is-overridden"); }
getTooltipText
302,620
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; OverriddenDefineRenderer that = (OverriddenDefineRenderer)o; if (!myDefine.equals(that.myDefine)) return false; return true; }
equals
302,621
int () { return myDefine.hashCode(); }
hashCode
302,622
Icon () { return AllIcons.Gutter.OverridingMethod; }
getIcon
302,623
boolean () { return true; }
isNavigateAction
302,624
AnAction () { return new MyClickAction(); }
getClickAction
302,625
String () { return myMessage; }
getTooltipText
302,626
void (@NotNull AnActionEvent e) { doClickAction(e, mySet, RelaxngBundle.message("relaxng.gutter.go-to-overridden-define")); }
actionPerformed
302,627
void (AnActionEvent e, Collection<? extends Define> set, @PopupTitle String title) { if (set.size() == 1) { final Navigatable n = (Navigatable)set.iterator().next().getPsiElement(); OpenSourceUtil.navigate(true, n); } else { final Define[] array = set.toArray(new Define[0]); NavigationUtil.getPsiElementPopup(ContainerUtil.map(array, define -> define.getPsiElement(), PsiElement.EMPTY_ARRAY), title) .show(new RelativePoint((MouseEvent)e.getInputEvent())); } }
doClickAction
302,628
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; OverridingDefineRenderer that = (OverridingDefineRenderer)o; if (!Objects.equals(myMessage, that.myMessage)) return false; if (!Objects.equals(mySet, that.mySet)) return false; return true; }
equals
302,629
int () { int result = mySet != null ? mySet.hashCode() : 0; result = 31 * result + (myMessage != null ? myMessage.hashCode() : 0); return result; }
hashCode
302,630
void (@NotNull HighlightSeverity severity, @NotNull DomElement element, @Nullable @InspectionMessage String message, @Nullable GutterIconRenderer renderer) { AnnotationHolder annotationHolder = myHolder.getAnnotationHolder(); final XmlElement xmlElement = element.getXmlElement(); if (xmlElement == null) return; AnnotationBuilder builder = message == null ? annotationHolder.newSilentAnnotation(severity) : annotationHolder.newAnnotation(severity, message); builder = builder.range(xmlElement.getNavigationElement()); if (message != null) { builder = builder.tooltip(message); // no tooltip by default?? } if (renderer != null) { builder = builder.gutterIconRenderer(renderer); } builder.create(); }
createAnnotation
302,631
void (@NotNull HighlightSeverity severity, @NotNull T element, @Nullable @InspectionMessage String message, @Nullable GutterIconRenderer renderer) { AnnotationBuilder builder = message == null ? myHolder.newSilentAnnotation(severity) : myHolder.newAnnotation(severity, message); if (renderer != null) { builder = builder.gutterIconRenderer(renderer); } builder.create(); }
createAnnotation
302,632
void (@NotNull PsiElement psiElement, @NotNull AnnotationHolder holder) { if (psiElement instanceof CommonElement) { ((CommonElement<?>)psiElement).accept(new MyAnnotator<>(CommonAnnotationHolder.create(holder))); } }
annotate
302,633
void (DomElement element, DomElementAnnotationHolder holder) { if (element instanceof RngDomElement) { ((RngDomElement)element).accept(new MyAnnotator<>(CommonAnnotationHolder.create(holder))); } }
annotate
302,634
void (final Define define) { final PsiElement element = define.getPsiElement(); if (element != null) { final XmlFile xmlFile = (XmlFile)element.getContainingFile(); final List<Define> result = new SmartList<>(); final OverriddenDefineSearcher searcher = new OverriddenDefineSearcher(define, xmlFile, result); final PsiElementProcessor.FindElement<XmlFile> processor = new PsiElementProcessor.FindElement<>() { @Override public boolean execute(@NotNull XmlFile file) { final Grammar grammar = GrammarFactory.getGrammar(file); if (grammar == null) return true; grammar.acceptChildren(searcher); return result.size() == 0 || super.execute(file); } }; RelaxIncludeIndex.processBackwardDependencies(xmlFile, processor); if (processor.isFound()) { createGutterAnnotation(define, new OverriddenDefineRenderer(define)); } } }
visitDefine
302,635
boolean (@NotNull XmlFile file) { final Grammar grammar = GrammarFactory.getGrammar(file); if (grammar == null) return true; grammar.acceptChildren(searcher); return result.size() == 0 || super.execute(file); }
execute
302,636
void (CommonElement t, @NotNull GutterIconRenderer renderer) { myHolder.createAnnotation(HighlightSeverity.INFORMATION, (T)t, null, renderer); }
createGutterAnnotation
302,637
void (Include inc) { final Define[] overrides = inc.getOverrides(); for (Define define : overrides) { final PsiFile file = inc.getInclude(); if (!(file instanceof XmlFile)) continue; // final Grammar grammar = GrammarFactory.getGrammar((XmlFile)file); if (grammar == null) continue; final Map<String, Set<Define>> map = DefinitionResolver.getAllVariants(grammar); if (map == null) continue; final Set<Define> set = map.get(define.getName()); if (set == null || set.size() == 0) { //noinspection unchecked myHolder.createAnnotation(HighlightSeverity.ERROR, (T)define, RelaxngBundle.message("relaxng.annotator.definition-doesnt-override-anything-from", file.getName()), null); continue; } final String message = RelaxngBundle.message("relaxng.annotator.overrides.x.in.y", define.getName(), file.getName()); createGutterAnnotation(define, new OverridingDefineRenderer(message, set)); } }
visitInclude
302,638
void (Include inc) { myIncludes.add(inc.getInclude() == myLocalFile ? 1 : 0); try { inc.acceptChildren(this); } finally { myIncludes.removeInt(myIncludes.size() - 1); } }
visitInclude
302,639
void (Div ref) { ref.acceptChildren(this); }
visitDiv
302,640
void (Define<?, ?> d) { if (myIncludes.size() > 0 && myIncludes.getInt(myIncludes.size() - 1) == 1) { if (d.getName().equals(myDefine.getName())) { myResult.add(d); } } d.acceptChildren(this); }
visitDefine
302,641
void (Grammar pattern) { pattern.acceptChildren(this); }
visitGrammar
302,642
URL () { return RngHtml5SchemaProvider.class.getResource("/resources/html5-schema/html5.rnc"); }
getHtmlSchemaLocation
302,643
URL () { return RngHtml5SchemaProvider.class.getResource("/resources/html5-schema/xhtml5.rnc"); }
getXhtmlSchemaLocation
302,644
URL () { return RngHtml5SchemaProvider.class.getResource("/resources/html5-schema/html5chars.ent"); }
getCharsLocation
302,645
void (DomElement element) { }
visitDomElement
302,646
void (RngGrammar grammar) { visitDomElement(grammar); }
visit
302,647
void (RngInclude include) { visitDomElement(include); }
visit
302,648
void (RngDiv div) { visitDomElement(div); }
visit
302,649
void (RngDefine def) { visitDomElement(def); }
visit
302,650
String () { return value; }
getValue
302,651
void (Visitor visitor) { visitor.visitInclude(this); }
accept
302,652
PsiFile () { return getIncludedFile().getValue(); }
getInclude
302,653
String () { return RelaxngBundle.message("relaxng.quickfix.create-pattern.name", myReference.getCanonicalText()); }
getText
302,654
String () { return RelaxngBundle.message("relaxng.quickfix.create-pattern.family"); }
getFamilyName
302,655
String () { return getText(); }
getName
302,656
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { if (!isAvailable()) { return; } try { doFix(); } catch (IncorrectOperationException e) { Logger.getInstance(getClass().getName()).error(e); } }
applyFix
302,657
boolean (@NotNull Project project, Editor editor, PsiFile file) { return isAvailable(); }
isAvailable
302,658
boolean () { if (!(myReference instanceof DefinitionReference) || !myReference.getElement().isValid()) { return false; } else { final RngGrammar grammar = ((DefinitionReference)myReference).getScope(); if (grammar == null) { return false; } else if (grammar.getXmlTag() == null) { return false; } return true; } }
isAvailable
302,659
boolean () { return true; }
startInWriteAction
302,660
PsiElement () { // final XmlTag tag = PsiTreeUtil.getParentOfType(value, XmlTag.class); // final XmlTag include = getAncestorTag(tag, "include", ProjectLoader.RNG_NAMESPACE); // final XmlTag grammar = getAncestorTag(tag, "grammar", ProjectLoader.RNG_NAMESPACE); // // if (include != null && (grammar == null || PsiTreeUtil.isAncestor(grammar, include, true))) { // final ResolveResult[] e = new DefinitionReference(getElement(), false).multiResolve(false); // } return myElement.getParent().getParent(); }
resolve
302,661
void (RngGrammar grammar) { final Map<String, Set<Define>> map = DefinitionResolver.getAllVariants(grammar); if (map != null) { ref.set(map.keySet().toArray()); } }
visit
302,662
Icon () { return IconManager.getInstance().getPlatformIcon(PlatformIcons.Property); }
getIcon
302,663
String () { return RelaxngBundle.message("relaxng.symbol.pattern-definition"); }
getTypeName
302,664
XmlElement () { return getXmlElement(); }
getPsiElement
302,665
void (Visitor visitor) { if (this instanceof Div) { visitor.visitDiv((Div)this); // TODO fix me } else { visitor.visitElement(this); } }
accept
302,666
void (final Visitor visitor) { acceptChildren(new DomElementVisitor() { @Override public void visitDomElement(DomElement element) { if (element instanceof CommonElement) { ((CommonElement<?>)element).accept(visitor); } } }); }
acceptChildren
302,667
void (DomElement element) { if (element instanceof CommonElement) { ((CommonElement<?>)element).accept(visitor); } }
visitDomElement
302,668
Pattern (RngDomElement t) { if (t == null) return null; final List<Pattern> list = DomUtil.getChildrenOfType(t, Pattern.class); return list.size() > 0 ? list.get(0) : null; }
getPatternFrom
302,669
void (Visitor visitor) { visitor.visitRef(this); }
accept
302,670
Define () { final XmlAttributeValue value = getName().getXmlAttributeValue(); if (value == null) return null; final String name = getReferencedName(); if (name == null) { return null; } final RngGrammar scope = getScope(); if (scope == null) { return null; } final Set<Define> defines = DefinitionResolver.resolve(scope, name); // TODO: honor combine & return virtual element if defines.size() > 1 return defines != null && defines.size() > 0 ? defines.iterator().next() : null; }
getPattern
302,671
RngGrammar () { return getParentOfType(RngGrammar.class, true); }
getScope
302,672
String () { return getName().getValue(); }
getReferencedName
302,673
boolean () { return true; }
isSoft
302,674
RngGrammar () { RngGrammar scope = myValue.getParentOfType(RngGrammar.class, true); if (scope == null) { return null; } if (myIsParentRef) { scope = scope.getParentOfType(RngGrammar.class, true); } return scope; }
getScope
302,675
ResolveResult (Define define) { final XmlElement xmlElement = (XmlElement)define.getPsiElement(); assert xmlElement != null; return new PsiElementResolveResult(xmlElement); }
fun
302,676
String () { //noinspection UnresolvedPropertyKey return RelaxngBundle.message("relaxng.annotator.unresolved-pattern-reference"); }
getUnresolvedMessagePattern
302,677
void (String name) { final GenericAttributeValue<String> value = getNameAttr(); if (value.getStringValue() != null) { value.setStringValue(name); } }
setName
302,678
String () { return getNameAttr().getValue(); }
getName
302,679
PsiElement () { return getNameAttr().getXmlAttributeValue(); }
getNameElement
302,680
Pattern () { return getPatternFrom(this); }
getPattern
302,681
void (Visitor visitor) { visitor.visitDefine(this); }
accept
302,682
void (Visitor visitor) { visitor.visitGrammar(this); }
accept
302,683
Pattern () { return getPatternFrom(getStartElement()); }
getStart
302,684
XmlFile (@Nullable @NonNls String s, ConvertContext context) { if (s != null) { final GenericAttributeValue<XmlFile> element = (GenericAttributeValue<XmlFile>)context.getInvocationElement(); final PsiReference[] references = createReferences(element, element.getXmlAttributeValue(), context); if (references.length > 0) { PsiElement result = references[references.length - 1].resolve(); if (result instanceof XmlFile) { return (XmlFile)result; } } } return null; }
fromString
302,685
String (@Nullable XmlFile psiFile, ConvertContext context) { return psiFile == null ? null : psiFile.getName(); }
toString
302,686
XmlAttributeDescriptor[] (XmlTag context) { return RelaxedHtmlFromSchemaElementDescriptor.addAttrDescriptorsForFacelets(context, XmlAttributeDescriptor.EMPTY); }
getAttributesDescriptors
302,687
XmlAttributeDescriptor (String attributeName, XmlTag context) { XmlAttributeDescriptor descriptor = RelaxedHtmlFromSchemaElementDescriptor.getAttributeDescriptorFromFacelets(attributeName, context); if (descriptor == null) { descriptor = super.getAttributeDescriptor(attributeName, context); } return descriptor; }
getAttributeDescriptor
302,688
XmlAttributeDescriptor (XmlAttribute attr) { XmlAttributeDescriptor descriptor = RelaxedHtmlFromSchemaElementDescriptor.getAttributeDescriptorFromFacelets(attr.getName(), attr.getParent()); if (descriptor == null) { descriptor = super.getAttributeDescriptor(attr); } return descriptor; }
getAttributeDescriptor
302,689
void (@NotNull MetaDataRegistrar registrar) { registrar.registerMetaData( new AndFilter( new ClassFilter(RncDocument.class), new MyRncNamespaceFilter(XmlUtil.HTML_URI, XmlUtil.XHTML_URI)), RelaxedHtmlFromRngNSDescriptor.class ); }
contributeMetaData
302,690
boolean (Class hintClass) { return ReflectionUtil.isAssignable(RncDocument.class, hintClass); }
isClassAcceptable
302,691
boolean (Object element, PsiElement context) { if (!(element instanceof RncDocument)) { return false; } final PsiFile file = ((RncDocument)element).getContainingFile(); String namespace = null; if (file instanceof RncFile) { for (RncDecl decl : ((RncFile)file).getDeclarations()) { if (decl instanceof RncNsDecl) { namespace = decl.getDeclaredNamespace(); break; } } } if (namespace != null) { for (String aMyValue : myValue) { if (aMyValue.equals(namespace)) return true; } } return false; }
isAcceptable
302,692
XmlElementDescriptor (@NotNull XmlTag tag) { XmlElementDescriptor elementDescriptor = super.getElementDescriptor(tag); if (LOG.isDebugEnabled()) { LOG.debug("Descriptor from rng for tag " + tag.getName() + " is " + (elementDescriptor != null ? elementDescriptor.getClass().getCanonicalName() : "NULL")); } String namespace; if (elementDescriptor == null && !((namespace = tag.getNamespace()).equals(XmlUtil.XHTML_URI))) { var nsDescriptor = HTML_URI.equals(namespace) ? this : tag.getNSDescriptor(namespace, true); if (HTML_URI.equals(namespace) || MATH_ML_NAMESPACE.equals(namespace) || SVG_NAMESPACE.equals(namespace)) { return new RelaxedAnyHtmlElementDescriptor(null, nsDescriptor); } else { return new AnyXmlElementDescriptor(null, nsDescriptor); } } return elementDescriptor; }
getElementDescriptor
302,693
XmlElementDescriptor (@NotNull XmlElementDescriptor descriptor) { return new RelaxedHtmlFromRngElementDescriptor(descriptor); }
initDescriptor
302,694
boolean (RelaxedHtmlFromRngElementDescriptor descriptor) { return descriptor.isHtml() || "svg".equals(descriptor.getName()) || "math".equals(descriptor.getName()); }
isRootTag
302,695
XmlElementDescriptor (String localName, String namespace) { XmlElementDescriptor descriptor = super.getElementDescriptor(localName, namespace); if (descriptor != null) return descriptor; descriptor = super.getElementDescriptor(localName, MATH_ML_NAMESPACE); if (descriptor != null) return descriptor; return super.getElementDescriptor(localName, SVG_NAMESPACE); }
getElementDescriptor
302,696
int (@NotNull Object o) { if (!(o instanceof RelaxedHtmlFromRngElementDescriptor other)) return 1; if (other.isHtml && !isHtml) return -1; if (!other.isHtml && isHtml) return 1; return 0; }
compareTo
302,697
boolean (XmlElementDescriptor o) { if (o instanceof CompositeDescriptor) { for (DElementPattern pattern : ((CompositeDescriptor)o).getElementPatterns()) { if (isHtml(pattern)) return true; } } else if (o instanceof RngElementDescriptor) { return isHtml(((RngElementDescriptor)o).getElementPattern()); } return false; }
isHtml
302,698
boolean (DElementPattern pattern) { for (QName name : pattern.getName().listNames()) { if (XmlUtil.XHTML_URI.equals(name.getNamespaceURI())) { return true; } } return false; }
isHtml
302,699
boolean () { return isHtml; }
isHtml