Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
297,600
void (boolean editable) { if (controller != null) { if (editable && (controller instanceof EditableTC)) { return; } if (!editable && (controller instanceof NonEditableTC)) { return; } controller.detach(); } if (editable) { controller = new EditableTC(); } else { controller = new NonEditableTC(); } updateParser(); }
setTextMode
297,601
void () { if (controller != null) { if (controller instanceof RenderedController) { return; } controller.detach(); } controller = new RenderedController(); filterEditor.filterUpdated(null); }
setRenderMode
297,602
boolean () { return controller.isValidContent(); }
isValidContent
297,603
void () { controller.consolidateFilter(); }
consolidateFilter
297,604
void (boolean gained) { focus = gained; controller.focusMoved(gained); if (gained) { // select all text setCaretPosition(0); moveCaretPosition(getText().length()); } }
focusMoved
297,605
void (boolean warning) { if (this.warning != warning) { this.warning = warning; if (isEnabled()) { updateLook(); } } }
setWarning
297,606
boolean () { return focus; }
isFocused
297,607
void (IParser textParser) { this.textParser = textParser; if (isEnabled()) { updateFilter(); } }
setParser
297,608
void (boolean error) { if (this.error != error) { this.error = error; if (isEnabled()) { updateLook(); } } }
setError
297,609
ChoiceMatch (String hint) { ChoiceMatch ret = popup.selectBestMatch(hint); popup.setPopupFocused(false); return ret; }
getBestMatch
297,610
boolean () { boolean ret = false; if (!decorate && (content instanceof CustomChoice)) { decorate = true; updateLook(); repaint(); ret = true; } return ret; }
activateCustomDecoration
297,611
void () { if (decorate) { decorate = false; updateLook(); repaint(); } }
deactivateCustomDecoration
297,612
void () { updateFilter(null, null, false); }
updateFilter
297,613
void (String text, ChoiceMatch match, boolean userUpdate) { RowFilter currentFilter = filter; boolean localError = false; if (text == null) { match = null; text = getText(); } if (match == null) { match = getBestMatch(text); } // perform actions in a try/catch due to text parsing exceptions try { if (match.exact) { content = match.content; if (match.content instanceof CustomChoice) { CustomChoice cc = (CustomChoice) content; filter = cc.getFilter(filterEditor); } else { filter = textParser.parseText(parseEscape(text)); } } else if (instantFiltering && userUpdate) { // parse the expression as it is. If this would produce // no rows, evaluate the filter as an instant expression filter = textParser.parseText(parseEscape(text)); if (filterEditor.attemptFilterUpdate(filter)) { content = text; setWarning(false); currentFilter = filter; // to not apply it again below } else { InstantFilter iFilter = textParser.parseInstantText( parseEscape(text)); content = iFilter.expression; filter = iFilter.filter; } } else { filter = textParser.parseText(parseEscape(text)); content = text; } } catch (ParseException pex) { filter = null; content = text; localError = true; } setError(localError); if (filter != currentFilter) { if (userUpdate && !allowInstantVanishing) { // in this case, the filter is only propagated if it does // not filter all rows out. If it would, just set the // warning color -unset it otherwise- setWarning(!filterEditor.attemptFilterUpdate(filter)); } else { filterEditor.filterUpdated(filter); } } }
updateFilter
297,614
void (String text) { userUpdate = false; setText(text); userUpdate = true; }
setEditorText
297,615
void () { // this action is only taken when the user is entering text, // not when is programmatically set (setText) if (userUpdate) { deactivateCustomDecoration(); setError(false); String text = getText(); // the best match is anyway obtained to select the proper // choice on the popup if (instantFiltering || popup.isVisible()) { ChoiceMatch match = getBestMatch(text); if (instantFiltering) { updateFilter(text, match, true); } } } }
editorUpdated
297,616
Icon (@NotNull String path, int cacheKey, int flags) { return IconManager.getInstance().loadRasterizedIcon(path, JupyterCoreIcons.class.getClassLoader(), cacheKey, flags); }
load
297,617
void () { System.out.println("CWD=" + Path.of(".").toAbsolutePath()); }
printCwd
297,618
void (String[] args) { if (args.length != 2) throw new IllegalArgumentException("Invalid parameters: " + Arrays.toString(args)); System.exit(Integer.parseInt(args[1])); }
exitCode
297,619
void () { throw new UnsupportedOperationException("aw, snap"); }
exception
297,620
void () { var stdout = System.out; try { var buffer = new ByteArrayOutputStream(); System.setOut(new PrintStream(buffer)); sun.tools.jps.Jps.main(new String[]{"-l"}); var pid = String.valueOf(ProcessHandle.current().pid()); var name = buffer.toString().lines() .filter(l -> l.startsWith(pid)) .map(l -> l.substring(pid.length()).trim()) .findFirst() .orElseThrow(() -> new IllegalStateException("No " + pid + " in: <<<\n" + buffer.toString().trim() + "\n>>>")); stdout.println("main.class=" + name); } finally { System.setOut(stdout); } }
mainClassName
297,621
JavaMethodSignature () { return mySignature; }
getSignature
297,622
List<Method> () { List<Method> hierarchy = myHierarchy; if (hierarchy == null) { hierarchy = Collections.unmodifiableList(mySignature.getAllMethods(myDeclaringClass)); myHierarchy = hierarchy; } return hierarchy; }
getHierarchy
297,623
String () { return mySignature.getMethodName(); }
getMethodName
297,624
Method () { return myMethod; }
getMethod
297,625
Type[] () { return myMethod.getGenericParameterTypes(); }
getGenericParameterTypes
297,626
Type () { return myMethod.getGenericReturnType(); }
getGenericReturnType
297,627
JavaMethod (final Class declaringClass, final JavaMethodSignature signature) { return new JavaMethod(declaringClass, signature); }
getMethod
297,628
JavaMethod (final Class declaringClass, final Method method) { return getMethod(declaringClass, new JavaMethodSignature(method)); }
getMethod
297,629
Object (final Object o, final Object... args) { return DomReflectionUtil.invokeMethod(myMethod, o, args); }
invoke
297,630
String () { return "JavaMethod: " + myMethod.toString(); }
toString
297,631
String () { return myMethod.getName(); }
getName
297,632
Object (Class<? extends Annotation> annotationClass) { for (Method method : getHierarchy()) { Annotation annotation = method.getAnnotation(annotationClass); if (annotation != null) { return annotation; } } return NONE; }
findAnnotation
297,633
boolean (final Object o) { if (this == o) return true; if (!(o instanceof JavaMethod that)) return false; if (!myDeclaringClass.equals(that.myDeclaringClass)) return false; if (!mySignature.equals(that.mySignature)) return false; return true; }
equals
297,634
int () { int result = mySignature.hashCode(); result = 31 * result + myDeclaringClass.hashCode(); return result; }
hashCode
297,635
Class () { return myMethod.getReturnType(); }
getReturnType
297,636
int () { return myMethod.getParameterCount(); }
getParameterCount
297,637
String () { return myMethodName; }
getMethodName
297,638
Method (@NotNull Class<?> aClass) { Method method = getDeclaredMethod(aClass); if (method == null && aClass.isInterface() && OBJECT_METHOD_NAMES.contains(myMethodName)) { method = ReflectionUtil.getDeclaredMethod(Object.class, myMethodName, myMethodParameters); } return method; }
findMethod
297,639
Method (@NotNull Class<?> aClass) { Method method = ReflectionUtil.getMethod(aClass, myMethodName, myMethodParameters); return method == null ? ReflectionUtil.getDeclaredMethod(aClass, myMethodName, myMethodParameters) : method; }
getDeclaredMethod
297,640
Method (@NotNull Method sampleMethod, @NotNull Class<?> startFrom, @NotNull Predicate<Method> checker) { String sampleMethodName = sampleMethod.getName(); Class<?>[] sampleMethodParameters = sampleMethod.getParameterCount() == 0 ? ArrayUtil.EMPTY_CLASS_ARRAY : sampleMethod.getParameterTypes(); for (Class<?> superClass : JBIterable.from(JBIterableClassTraverser.classTraverser(startFrom)).append(Object.class).unique()) { for (Method method : superClass.getDeclaredMethods()) { if (sampleMethodName.equals(method.getName()) && method.getParameterCount() == sampleMethodParameters.length && Arrays.equals(method.getParameterTypes(), sampleMethodParameters)) { if (checker.test(method)) { return method; } } } } return null; }
findMethod
297,641
String () { return myMethodName + Arrays.asList(myMethodParameters); }
toString
297,642
boolean (final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final JavaMethodSignature that = (JavaMethodSignature)o; if (!myMethodName.equals(that.myMethodName)) return false; if (!Arrays.equals(myMethodParameters, that.myMethodParameters)) return false; return true; }
equals
297,643
int () { int result = myMethodName.hashCode(); result = 31 * result + Arrays.hashCode(myMethodParameters); return result; }
hashCode
297,644
String () { return myXmlName.getLocalName(); }
getLocalName
297,645
XmlName () { return myXmlName; }
getXmlName
297,646
EvaluatedXmlName (final @NotNull XmlName name) { String namespaceKey = name.getNamespaceKey(); final boolean equalToParent = Objects.equals(namespaceKey, myNamespaceKey); if (namespaceKey == null) { namespaceKey = myNamespaceKey; } return createEvaluatedXmlName(name, namespaceKey, equalToParent); }
evaluateChildName
297,647
String () { return (myNamespaceKey == null ? "" : myNamespaceKey + " : ") + myXmlName.getLocalName(); }
toString
297,648
boolean (final Object o) { if (this == o) return true; if (!(o instanceof EvaluatedXmlNameImpl that)) return false; if (myEqualToParent != that.myEqualToParent) return false; if (myNamespaceKey != null ? !myNamespaceKey.equals(that.myNamespaceKey) : that.myNamespaceKey != null) return false; if (!myXmlName.equals(that.myXmlName)) return false; return true; }
equals
297,649
int () { int result = myXmlName.hashCode(); result = 31 * result + (myNamespaceKey != null ? myNamespaceKey.hashCode() : 0); result = 31 * result + (myEqualToParent ? 1 : 0); return result; }
hashCode
297,650
boolean (DomFileElement element, String namespace) { if (myNamespaceKey == null || myEqualToParent) return true; final XmlFile file = element.getFile(); return isNamespaceAllowed(namespace, getAllowedNamespaces(file)); }
isNamespaceAllowed
297,651
List<String> (final XmlFile file) { CachedValue<Map<String, List<String>>> value = file.getUserData(NAMESPACE_PROVIDER_KEY); if (value == null) { file.putUserData(NAMESPACE_PROVIDER_KEY, value = CachedValuesManager.getManager(file.getProject()).createCachedValue(() -> { Map<String, List<String>> map = ConcurrentFactoryMap.createMap(key-> { final DomFileDescription<?> description = DomManager.getDomManager(file.getProject()).getDomFileDescription(file); if (description == null) return Collections.emptyList(); return description.getAllowedNamespaces(key, file); } ); return CachedValueProvider.Result.create(map, file); }, false)); } final List<String> list = value.getValue().get(myNamespaceKey); assert list != null; return list; }
getAllowedNamespaces
297,652
boolean (final String namespace, final List<String> list) { return list.contains(namespace) || StringUtil.isEmpty(namespace) && list.isEmpty(); }
isNamespaceAllowed
297,653
boolean (String namespace, final XmlFile file, boolean qualified) { return myNamespaceKey == null || myEqualToParent && !qualified || isNamespaceAllowed(namespace, getNamespaceList(file)); }
isNamespaceAllowed
297,654
String (@NotNull XmlElement parentElement, final XmlFile file) { final String xmlElementNamespace = getXmlElementNamespace(parentElement); if (myNamespaceKey != null && !myEqualToParent) { final List<String> strings = getAllowedNamespaces(file); if (!strings.isEmpty() && !strings.contains(xmlElementNamespace)) { return strings.get(0); } } return xmlElementNamespace; }
getNamespace
297,655
String (final XmlElement parentElement) { if (parentElement instanceof XmlTag) { return ((XmlTag)parentElement).getNamespace(); } if (parentElement instanceof XmlAttribute) { return ((XmlAttribute)parentElement).getNamespace(); } if (parentElement instanceof XmlFile) { final XmlDocument document = ((XmlFile)parentElement).getDocument(); if (document != null) { final XmlTag tag = document.getRootTag(); if (tag != null) { return tag.getNamespace(); } } return ""; } throw new AssertionError("Can't get namespace of " + parentElement); }
getXmlElementNamespace
297,656
List<String> (final XmlFile file) { return getAllowedNamespaces(file); }
getNamespaceList
297,657
EvaluatedXmlNameImpl (final @NotNull XmlName xmlName, final @Nullable String namespaceKey, boolean equalToParent) { final EvaluatedXmlNameImpl name = new EvaluatedXmlNameImpl(xmlName, namespaceKey, equalToParent); final EvaluatedXmlNameImpl interned = ourInterned.get(name); if (interned != null) { return interned; } ourInterned.put(name, name); return name; }
createEvaluatedXmlName
297,658
void (DomElement element, final Map<String, DomElement> map) { if (myClass.isInstance(element)) { final String name = ElementPresentationManager.getElementName(element); if (name != null && !map.containsKey(name)) { map.put(name, element); } } else { for (final DomElement child : DomUtil.getDefinedChildren(element, true, myAttribute)) { visitDomElement(child, map); } } }
visitDomElement
297,659
T (final String s, final ConvertContext context) { if (s == null) return null; return (T) myResolveCache.get(getResolvingScope(context)).getValue().get(s); }
fromString
297,660
PsiElement (@Nullable T resolvedValue) { if (resolvedValue == null) return null; DomTarget target = DomTarget.getTarget(resolvedValue); return target == null ? super.getPsiElement(resolvedValue) : PomService.convertToPsi(target); }
getPsiElement
297,661
boolean (@NotNull PsiElement element, String stringValue, @Nullable T resolveResult, ConvertContext context) { return resolveResult != null && element.getManager().areElementsEquivalent(element, resolveResult.getXmlElement()); }
isReferenceTo
297,662
DomElement (final ConvertContext context) { final DomElement invocationElement = context.getInvocationElement(); return invocationElement.getManager().getResolvingScope((GenericDomValue)invocationElement); }
getResolvingScope
297,663
String (final String s, final ConvertContext context) { return CodeInsightBundle.message("error.cannot.resolve.0.1", TypePresentationService.getService().getTypePresentableName(myClass), s); }
getErrorMessage
297,664
String (final T t, final ConvertContext context) { if (t == null) return null; return ElementPresentationManager.getElementName(t); }
toString
297,665
LocalQuickFix[] (final ConvertContext context) { final DomElement element = context.getInvocationElement(); final GenericDomValue value = element.createStableCopy(); final String newName = value.getStringValue(); if (newName == null) return LocalQuickFix.EMPTY_ARRAY; final DomElement scope = value.getManager().getResolvingScope(value); return ResolvingElementQuickFix.createFixes(newName, myClass, scope); }
getQuickFixes
297,666
boolean (final T t) { return !ReflectionUtil.isAssignable(clazz, t.getClass()) || super.process(t); }
process
297,667
boolean (final T t) { return !ReflectionUtil.isAssignable(clazz, t.getClass()) || super.process(t); }
process
297,668
boolean (final T t) { final boolean merged = t instanceof MergedObject; if ((!merged || myProcessMerged) && !myProcessor.process(t)) { return false; } if (merged && !ContainerUtil.process(((MergedObject<T>)t).getImplementations(), this)) { return false; } return true; }
process
297,669
boolean (Type type) { return getGenericValueParameter(type) != null; }
isGenericValueType
297,670
List<JavaMethod> (DomElement element) { assert element.isValid(); final LinkedList<JavaMethod> methods = new LinkedList<>(); while (true) { final DomElement parent = element.getParent(); if (parent instanceof DomFileElement) { break; } final JavaMethod method = getGetterMethod(element, parent); if (method == null) { return null; } methods.addFirst(method); element = element.getParent(); } return methods; }
getFixedPath
297,671
JavaMethod (final DomElement element, final DomElement parent) { final String xmlElementName = element.getXmlElementName(); final String namespace = element.getXmlElementNamespaceKey(); final DomGenericInfo genericInfo = parent.getGenericInfo(); if (element instanceof GenericAttributeValue) { DomAttributeChildDescription<?> description = genericInfo.getAttributeChildDescription(xmlElementName, namespace); assert description != null; return description.getGetterMethod(); } final DomFixedChildDescription description = genericInfo.getFixedChildDescription(xmlElementName, namespace); return description != null ? description.getGetterMethod(description.getValues(parent).indexOf(element)) : null; }
getGetterMethod
297,672
void () { ourTypeParameters.clear(); ourVariableSubstitutions.clear(); }
clearCaches
297,673
XmlElement (GenericDomValue<?> domValue) { if (domValue instanceof GenericAttributeValue<?> value) { XmlAttributeValue attributeValue = value.getXmlAttributeValue(); return attributeValue == null ? value.getXmlAttribute() : attributeValue; } else { return domValue.getXmlTag(); } }
getValueElement
297,674
void (DomElement element) { if (type.isInstance(element)) { result.add(type.cast(element)); } }
visitDomElement
297,675
List<DomElement> (@NotNull final DomElement parent, final boolean tags, final boolean attributes) { if (parent instanceof MergedObject) { final SmartList<DomElement> result = new SmartList<>(); parent.acceptChildren(new DomElementVisitor() { @Override public void visitDomElement(final DomElement element) { if (hasXml(element)) { result.add(element); } } }); return result; } ProgressManager.checkCanceled(); if (parent instanceof GenericAttributeValue) return Collections.emptyList(); if (parent instanceof DomFileElement) { DomFileElement<?> element = (DomFileElement<?>)parent; return tags ? Collections.singletonList(element.getRootElement()) : Collections.emptyList(); } final XmlElement xmlElement = parent.getXmlElement(); if (xmlElement instanceof XmlTag tag) { final DomManager domManager = parent.getManager(); final SmartList<DomElement> result = new SmartList<>(); if (attributes) { for (final XmlAttribute attribute : tag.getAttributes()) { if (!attribute.isValid()) { Logger.getInstance(DomUtil.class).error("Invalid attr: parent.valid=" + tag.isValid()); continue; } GenericAttributeValue<?> element = domManager.getDomElement(attribute); if (checkHasXml(attribute, element)) { ContainerUtil.addIfNotNull(result, element); } } } if (tags) { for (final XmlTag subTag : tag.getSubTags()) { if (!subTag.isValid()) { Logger.getInstance(DomUtil.class).error("Invalid subtag: parent.valid=" + tag.isValid()); continue; } DomElement element = domManager.getDomElement(subTag); if (checkHasXml(subTag, element)) { ContainerUtil.addIfNotNull(result, element); } } } return result; } return Collections.emptyList(); }
getDefinedChildren
297,676
void (final DomElement element) { if (hasXml(element)) { result.add(element); } }
visitDomElement
297,677
boolean (XmlElement psi, DomElement dom) { if (dom != null && !hasXml(dom)) { Logger.getInstance(DomUtil.class).error("No xml for dom " + dom + "; attr=" + psi + ", physical=" + psi.isPhysical()); return false; } return true; }
checkHasXml
297,678
DomElement (DomElement element, String newName) { return ElementPresentationManager.findByName(getIdentitySiblings(element), newName); }
findDuplicateNamedValue
297,679
boolean (@NotNull DomElement ancestor, @NotNull DomElement descendant, boolean strict) { if (!strict && ancestor.equals(descendant)) return true; final DomElement parent = descendant.getParent(); return parent != null && isAncestor(ancestor, parent, false); }
isAncestor
297,680
void (final DomElement element, final DomElementVisitor visitor) { final XmlTag tag = element.getXmlTag(); if (tag != null) { for (XmlTag xmlTag : tag.getSubTags()) { final DomElement childElement = element.getManager().getDomElement(xmlTag); if (childElement != null) { childElement.accept(visitor); } } } }
acceptAvailableChildren
297,681
DomElement (@Nullable final Editor editor) { if(editor == null) return null; final Project project = editor.getProject(); if (project == null) return null; final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); if (!(file instanceof XmlFile)) { return null; } return getDomElement(file.findElementAt(editor.getCaretModel().getOffset())); }
getContextElement
297,682
DomElement (@NotNull final Editor editor, @NotNull final PsiFile file) { return getDomElement(file.findElementAt(editor.getCaretModel().getOffset())); }
getDomElement
297,683
DomElement (@Nullable final PsiElement element) { if (element == null) return null; final Project project = element.getProject(); final DomManager domManager = DomManager.getDomManager(project); final XmlAttribute attr = PsiTreeUtil.getParentOfType(element, XmlAttribute.class, false); if (attr != null) { GenericAttributeValue<?> value = domManager.getDomElement(attr); if (value != null) return value; } XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class, false); while (tag != null) { final DomElement domElement = domManager.getDomElement(tag); if(domElement != null) return domElement; tag = tag.getParentTag(); } return null; }
getDomElement
297,684
XmlFile (@NotNull DomElement element) { return DomService.getInstance().getContainingFile(element); }
getFile
297,685
DomElement (@NotNull DomElement domElement) { while (true) { final DomElement parent = domElement.getParent(); if (parent == null) { return domElement; } domElement = parent; } }
getRoot
297,686
boolean (@NotNull DomElement element) { return element.exists(); }
hasXml
297,687
Object (@Nullable @NonNls String s, final ConvertContext context) { final List<Converter> converters = getConverters((GenericDomValue)context.getInvocationElement()); if (converters.isEmpty()) return s; for (Converter converter : converters) { final Object o = converter.fromString(s, context); if (o != null) { return o; } } return null; }
fromString
297,688
String (@Nullable Object t, final ConvertContext context) { final List<Converter> converters = getConverters((GenericDomValue)context.getInvocationElement()); if (converters.isEmpty()) return String.valueOf(t); for (Converter converter : converters) { final String s = converter.toString(t, context); if (s != null) { return s; } } return null; }
toString
297,689
List<Converter> (@NotNull final GenericDomValue domElement) { final Converter converter = getConverter(domElement); return ContainerUtil.createMaybeSingletonList(converter); }
getConverters
297,690
Converter (final Converter converter, final GenericDomValue domValue) { Converter cur = converter; Converter next; int guard = 0; while (cur instanceof WrappingConverter) { next = ((WrappingConverter)cur).getConverter(domValue); if (next == null) break; cur = next; if (guard++ > 10) { throw new RuntimeException("Too deep wrapping for " + converter); } } return cur; }
getDeepestConverter
297,691
boolean (final Collection<? extends GenericValue<?>> collection, String value) { for (GenericValue<?> o : collection) { if (Objects.equals(value, o.getStringValue())) return true; } return false; }
containsString
297,692
Collection<String> (final Collection<? extends GenericValue> collection, Collection<String> result) { for (GenericValue o : collection) { ContainerUtil.addIfNotNull(result, o.getStringValue()); } return result; }
getStringCollection
297,693
Collection<String> (final Collection<? extends GenericValue> collection, Collection<String> result) { for (GenericValue o : collection) { final String value = o.getStringValue(); if (value != null) { result.add(value.replace('$', '.')); } } return result; }
getClassStringCollection
297,694
void (String namespaceKey, final String... namespaces) { myNamespacePolicies.put(namespaceKey, new ConstantFunction<>(Arrays.asList(namespaces))); }
registerNamespacePolicy
297,695
List<String> (@NotNull String namespaceKey, @NotNull XmlFile file) { final NotNullFunction<XmlTag, List<String>> function = myNamespacePolicies.get(namespaceKey); if (function instanceof ConstantFunction) { return function.fun(null); } if (function != null) { final XmlDocument document = file.getDocument(); if (document != null) { final XmlTag tag = document.getRootTag(); if (tag != null) { return function.fun(tag); } } } else { return Collections.singletonList(namespaceKey); } return Collections.emptyList(); }
getAllowedNamespaces
297,696
int () { return myRootTagName.hashCode(); }
getVersion
297,697
void (final Type aClass, final TypeChooser typeChooser) { myTypeChooserManager.registerTypeChooser(aClass, typeChooser); }
registerTypeChooser
297,698
TypeChooserManager () { return myTypeChooserManager; }
getTypeChooserManager
297,699
void (DomReferenceInjector injector) { myInjectors.add(injector); }
registerReferenceInjector