Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
247,000
List<Node> () { List<Node> list = children; return list != null ? list : emptyList(); }
getChildren
247,001
void (Consumer<? super Node> consumer) { for (Node node : getChildren()) { if (node != loading) consumer.accept(node); } }
forEachChildExceptLoading
247,002
void (@NotNull TreePath path) { if (!paths.add(path)) { LOG.warn("node is already attached to " + path); } forEachChildExceptLoading(child -> child.insertPath(path.pathByAddingChild(child.object))); }
insertPath
247,003
void (Node parent) { if (parent == null) { insertPath(new CachingTreePath(object)); } else if (parent.loading == this) { LOG.warn("insert loading node unexpectedly"); } else if (parent.paths.isEmpty()) { LOG.warn("insert to invalid parent"); } else { parent.paths.forEach(path -> insertPath(path.pathByAddingChild(object...
insertMapping
247,004
void (@NotNull TreePath path) { if (!paths.remove(path)) { LOG.warn("node is not attached to " + path); } forEachChildExceptLoading(child -> child.removePath(path.pathByAddingChild(child.object))); }
removePath
247,005
void (Node parent, @NotNull Tree tree) { if (parent == null) { removePath(new CachingTreePath(object)); tree.removeEmpty(this); } else if (parent.loading == this) { parent.loading = null; } else if (parent.paths.isEmpty()) { LOG.warn("remove from invalid parent"); } else { parent.paths.forEach(path -> removePath(path.p...
removeMapping
247,006
void (@NotNull Object oldObject, @NotNull Object newObject) { if (ContainerUtil.exists(paths, path -> contains(path, oldObject))) { // replace instance of user's object in all internal maps to avoid memory leaks List<TreePath> updated = ContainerUtil.map(paths, path -> update(path, oldObject, newObject)); paths.clear()...
updatePaths
247,007
TreePath (@NotNull TreePath path, @NotNull Object oldObject, @NotNull Object newObject) { if (!contains(path, oldObject)) return path; if (LOG.isTraceEnabled()) LOG.debug("update path: ", path); Object[] objects = TreePathUtil.convertTreePathToArray(path); for (int i = 0; i < objects.length; i++) { if (oldObject == obj...
update
247,008
boolean (@NotNull TreePath path, @NotNull Object object) { while (object != path.getLastPathComponent()) { path = path.getParentPath(); if (path == null) return false; } return true; }
contains
247,009
void (TreePath path, int[] indices, Object[] children) { try { super.treeStructureChanged(path, indices, children); } catch (Throwable throwable) { LOG.error("custom model: " + model, throwable); } }
treeStructureChanged
247,010
void (TreePath path) { treeStructureChanged(path, null, null); }
treeStructureChanged
247,011
void (TreePath path, int[] indices, Object[] children) { try { super.treeNodesChanged(path, indices, children); } catch (Throwable throwable) { LOG.error("custom model: " + model, throwable); } }
treeNodesChanged
247,012
void (TreePath path) { treeNodesChanged(path, null, null); }
treeNodesChanged
247,013
void (TreePath path, int[] indices, Object[] children) { try { super.treeNodesInserted(path, indices, children); } catch (Throwable throwable) { LOG.error("custom model: " + model, throwable); } }
treeNodesInserted
247,014
void (TreePath path) { treeNodesInserted(path, null, null); }
treeNodesInserted
247,015
void (TreePath path, int[] indices, Object[] children) { try { super.treeNodesRemoved(path, indices, children); } catch (Throwable throwable) { LOG.error("custom model: " + model, throwable); } }
treeNodesRemoved
247,016
void (TreePath path) { treeNodesRemoved(path, null, null); }
treeNodesRemoved
247,017
void (@NotNull Object object) { Node node = new Node(object, LeafState.NEVER); node.insertPath(new CachingTreePath(object)); tree.root = node; tree.map.put(object, node); }
setRootImmediately
247,018
void (boolean fromRoot, @NotNull Set<? extends VirtualFile> updatedFiles) { boolean filtered = root.filter != null; SmartHashSet<Node> nodes = fromRoot || filtered ? null : new SmartHashSet<>(); root.children.forEach(child -> child.invalidateChildren(node -> { if (!updatedFiles.contains(node.file)) return true; if (fil...
updateStructure
247,019
ProjectFileNodeUpdater () { return updater; }
getUpdater
247,020
Invoker () { return invoker; }
getInvoker
247,021
boolean () { return invoker.isValidThread(); }
isValidThread
247,022
void (@NotNull Runnable task) { invoker.invoke(task); }
onValidThread
247,023
Object () { return root; }
getRoot
247,024
boolean (Object object) { return root != object && super.isLeaf(object); }
isLeaf
247,025
int (Object parent, Object object) { Node node = object instanceof Node ? (Node)object : null; return node == null || node.parent != parent ? -1 : super.getIndexOfChild(parent, object); }
getIndexOfChild
247,026
List<ProjectFileNode> (Object object) { Node node = object instanceof Node && isValidThread() ? (Node)object : null; if (node == null) return emptyList(); List<?> children = node.getChildren(); if (children.isEmpty()) return emptyList(); List<ProjectFileNode> result = new SmartList<>(); VirtualFileFilter filter = root....
getChildren
247,027
boolean (@NotNull FileNode node, @Nullable VirtualFileFilter filter) { if (!node.file.isValid() || root.project.isDisposed()) return false; if (filter == null) return !root.isExcluded(node.file); ThreeState visibility = node.visibility; if (visibility == ThreeState.NO) return false; if (visibility == ThreeState.YES) re...
isVisible
247,028
void (@Nullable VirtualFileFilter filter) { onValidThread(() -> { if (root.filter == null && filter == null) return; root.filter = filter; root.resetVisibility(); pathChanged(null); }); }
setFilter
247,029
void (boolean showExcludedFiles, boolean showModules) { onValidThread(() -> { if (root.showExcludedFiles != showExcludedFiles) { if (root.filter != null) root.resetVisibility(); root.showExcludedFiles = showExcludedFiles; root.valid = false; // need to reload from root } if (root.showModules != showModules) { root.show...
setSettings
247,030
void (@Nullable TreePath path) { onValidThread(() -> treeStructureChanged(path, null, null)); }
pathChanged
247,031
FileNode (VirtualFile file, Object id) { FileNode node = map.isEmpty() ? null : map.remove(file); return node != null && node.id.equals(id) ? node : new FileNode(file, id); }
apply
247,032
List<FileNode> () { List<FileNode> oldList = children; if (valid) return oldList; checkCanceled(); // ProcessCanceledException if current task is interrupted List<FileNode> newList = getChildren(oldList); oldList.forEach(node -> node.parent = null); newList.forEach(node -> node.parent = this); // cleanup removed nodes ...
getChildren
247,033
void () { children.forEach(Node::cleanup); children = emptyList(); parent = null; }
cleanup
247,034
void () { visibility = null; children.forEach(Node::resetVisibility); }
resetVisibility
247,035
String () { return project.getName(); }
toString
247,036
void (@Nullable Project project, @NotNull BiConsumer<? super VirtualFile, ? super AreaInstance> consumer) { VirtualFile ancestor = ProjectFileNode.findBaseDir(project); if (ancestor != null && project == ProjectFileNode.findArea(ancestor, project)) { consumer.accept(ancestor, project); } if (project != null && !project...
visitContentRoots
247,037
Object () { return id; }
getRootID
247,038
VirtualFile () { return file; }
getVirtualFile
247,039
String () { return parent instanceof ProjectNode ? file.getPath() : file.getName(); }
toString
247,040
boolean (@NotNull VirtualFile file, @NotNull Project project) { if (file.is(SYMLINK) && VfsUtilCore.isInvalidLink(file)) return false; // ignore invalid symlink AreaInstance area = ProjectFileNode.findArea(file, project); return area != null && (id instanceof VirtualFile || id.equals(area)); }
isValidChild
247,041
void (@NotNull ModuleRootEvent event) { updateFromRoot(); }
rootsChanged
247,042
void (@NotNull List<? extends @NotNull VFileEvent> events) { for (VFileEvent event : events) { if (event instanceof VFileCreateEvent create) { updateFromFile(create.getParent()); } else if (event instanceof VFileCopyEvent copy) { updateFromFile(copy.getNewParent()); } else if (event instanceof VFileMoveEvent move) { up...
after
247,043
void (@NotNull PsiTreeChangeEvent event) { if (event.getNewChild() instanceof PsiWhiteSpace) return; // optimization childrenChanged(event); }
childAdded
247,044
void (@NotNull PsiTreeChangeEvent event) { if (event.getOldChild() instanceof PsiWhiteSpace) return; // optimization childrenChanged(event); }
childRemoved
247,045
void (@NotNull PsiTreeChangeEvent event) { if (event.getOldChild() instanceof PsiWhiteSpace && event.getNewChild() instanceof PsiWhiteSpace) return; // optimization childrenChanged(event); }
childReplaced
247,046
void (@NotNull PsiTreeChangeEvent event) { updateFromElement(event.getParent()); }
childrenChanged
247,047
void (@NotNull PsiTreeChangeEvent event) { updateFromElement(event.getOldParent()); updateFromElement(event.getNewParent()); }
childMoved
247,048
void (@NotNull VirtualFile virtualFile) { updateFromFile(virtualFile); }
virtualFileAppearanceChanged
247,049
void () { updateLater(null); }
updateFromRoot
247,050
void (@Nullable VirtualFile file) { if (file != null) updateLater(file); }
updateFromFile
247,051
void (@Nullable PsiElement element) { updateFromFile(getVirtualFile(element)); }
updateFromElement
247,052
void (@NotNull Runnable onDone) { invoker.invoke(() -> onInvokerThread(true)).onProcessed(o -> EdtExecutorService.getInstance().execute(onDone)); }
updateImmediately
247,053
int () { return 10; }
getUpdatingDelay
247,054
void (@Nullable VirtualFile file) { Set<VirtualFile> files; boolean start = false; synchronized (reference) { files = reference.get(); if (files == null) { files = new SmartHashSet<>(); time = System.currentTimeMillis(); reference.set(files); start = true; } if (file == null) { root = true; } else if (files.add(file) &...
updateLater
247,055
void (boolean now) { Set<VirtualFile> files; long startedAt; boolean fromRoot; boolean restart = false; synchronized (reference) { files = reference.get(); if (files == null) { LOG.debug("updating queue was already flushed @ ", invoker); return; } startedAt = time; fromRoot = root; if (fromRoot) { root = false; referen...
onInvokerThread
247,056
void (@NotNull JTree tree, @NotNull Component component, int row) { TreePath path = tree.getPathForRow(row); Color background = path == null ? null : getBackground(tree, path, row, tree.isRowSelected(row)); setBackground(tree, component, background, true); }
setBackground
247,057
boolean (@Nullable TreePath path) { return path != null && isSeparator(path.getLastPathComponent()); }
isSeparator
247,058
void (@NotNull JTree tree, @NotNull Component component, @Nullable Color background, boolean opaque) { if (component instanceof JComponent) { ((JComponent)component).setOpaque(opaque); } if (background != null) { component.setBackground(background); } else if (component.isOpaque()) { component.setBackground(RenderingUt...
setBackground
247,059
boolean (Component component) { if (component instanceof JComponent) { Method method = getMethod(component.getClass(), "validate"); Class<?> type = method == null ? null : method.getDeclaringClass(); return Component.class.equals(type) || Container.class.equals(type); } return true; }
isSuspiciousRenderer
247,060
boolean (@NotNull JTree tree, int row) { return 1 < tree.getSelectionCount() && tree.isRowSelected(row - 1) && tree.isRowSelected(row + 1); }
isLeadSelectionNeeded
247,061
boolean (@Nullable JTree tree) { return is("ide.tree.large.model.allowed") || ClientProperty.isTrue(tree, LARGE_MODEL_ALLOWED); }
isLargeModelAllowed
247,062
boolean (@NotNull JTree tree) { Boolean allowed = ClientProperty.get(tree, AUTO_EXPAND_ALLOWED); return allowed != null ? allowed : tree.isShowing(); }
isAutoExpandAllowed
247,063
boolean (@NotNull JTree tree, @NotNull Object node) { Function<Object, Boolean> filter = ClientProperty.get(tree, AUTO_EXPAND_FILTER); return filter == null || !filter.apply(node); }
isAutoExpandAllowed
247,064
ComponentUI (JComponent component) { assert component instanceof JTree; return new DefaultTreeUI(); }
createUI
247,065
Control (@NotNull JComponent c, @NotNull TreePath path) { Function<@NotNull TreePath, @Nullable Control> controlResolver = ClientProperty.get(c, Control.CUSTOM_CONTROL); Control resolvedControl = controlResolver != null ? controlResolver.apply(path) : myDefaultControl; return ObjectUtils.chooseNotNull(resolvedControl, ...
getControl
247,066
boolean (@Nullable Object value) { return value == null || isSeparator(value) || super.treeModel.isLeaf(value); // TODO: treeModel ??? }
isLeaf
247,067
boolean (@Nullable Object value) { return value instanceof SeparatorWithText; }
isSeparator
247,068
boolean (@Nullable JTree tree) { if (!validator.isValidThread()) { LOG.error("TreeUI should be accessed only from EDT"); return false; } if (tree != null && tree == getTree()) return true; LOG.warn(new IllegalStateException(tree != null ? "unexpected tree" : "undefined tree")); return false; }
isValid
247,069
void (@Nullable TreePath path) { Rectangle bounds = getPathBounds(getTree(), path); // repaint 1 px above and 1 px below to avoid rounding errors with fractional scaling: if (bounds != null) tree.repaint(0, bounds.y - 1, tree.getWidth(), bounds.height + 2); }
repaintPath
247,070
void () { CellRendererPane pane = painting.get() ? null : rendererPane; if (pane != null) pane.removeAll(); }
removeCachedRenderers
247,071
void (Graphics g, JComponent c) { AbstractLayoutCache cache = treeState; // TODO: treeState ??? if (cache == null) return; JTree tree = (JTree)c; if (!isValid(tree)) return; g = g.create(); try { painting.set(true); Rectangle paintBounds = g.getClipBounds(); Insets insets = tree.getInsets(); TreePath path = cache.getPa...
paint
247,072
void () { super.installDefaults(); if (!isLargeModelAllowed(getTree())) largeModel = false; JTree tree = getTree(); if (tree != null) { LookAndFeel.installBorder(tree, "Tree.border"); if (tree.isForegroundSet()) tree.setForeground(null); if (UIManager.get("Tree.showsRootHandles") == null) { LookAndFeel.installProperty(...
installDefaults
247,073
void () { super.installKeyboardActions(); TreeAction.installTo(tree.getActionMap()); TreeAction.installTo(tree.getInputMap(JComponent.WHEN_FOCUSED)); }
installKeyboardActions
247,074
boolean (MouseEvent event) { if (!super.isToggleEvent(event)) return false; JTree tree = getTree(); return tree != null // BasicTreeUI uses clickCount % toggleClickCount == 0, which works terrible for single-click, so we double-check here: && tree.getToggleClickCount() == event.getClickCount() && isExpandPreferable(tre...
isToggleEvent
247,075
void (TreePath path) { if (!tree.isExpanded(path) && tree instanceof Tree) { ((Tree)tree).startMeasuringExpandDuration(path); } super.toggleExpandState(path); }
toggleExpandState
247,076
boolean (TreePath path, int mouseX, int mouseY) { JTree tree = getTree(); if (tree == null) return false; Rectangle bounds = getPathBounds(tree, path); if (bounds == null) return false; Control control = getControl(tree, path); bounds.x = getPainter(tree).getControlOffset(control, TreeUtil.getNodeDepth(tree, path), isL...
isLocationInExpandControl
247,077
void () { super.configureLayoutCache(); JTree tree = getTree(); if (tree != null && null == ReflectionUtil.getField(BasicTreeUI.class, this, null, "componentListener")) { ComponentListener listener = createComponentListener(); ComponentAdapter adapter = new ComponentAdapter() { @Override public void componentMoved(Comp...
configureLayoutCache
247,078
void (ComponentEvent event) { AbstractLayoutCache cache = treeState; // TODO: treeState ??? if (cache != null && tree.isLargeModel() && is("ide.tree.experimental.preferred.width")) { listener.componentMoved(event); } }
componentMoved
247,079
void () { JTree tree = getTree(); AbstractLayoutCache cache = treeState; if (tree != null && isValid(tree) && cache != null && tree.isLargeModel() && is("ide.tree.experimental.preferred.width")) { Rectangle paintBounds = tree.getVisibleRect(); if (!paintBounds.isEmpty()) { JScrollPane pane = UIUtil.getParentOfType(JScr...
updateCachedPreferredSize
247,080
int (int row, int depth) { JTree tree = getTree(); if (tree == null) { return 0; } TreePath path = getPathForRow(tree, row); if (path == null) { return 0; } Control control = getControl(tree, path); return getPainter(tree).getRendererOffset(control, TreeUtil.getNodeDepth(tree, path), isLeaf(path.getLastPathComponent())...
getRowX
247,081
void (boolean newValue) { if (treeModel instanceof AsyncTreeModel) { // this method must be called on EDT to be consistent with ATM, // because it modifies a list of visible nodes in the layout cache EdtInvocationManager.invokeLaterIfNeeded(() -> super.setRootVisible(newValue)); } else { super.setRootVisible(newValue);...
setRootVisible
247,082
void (boolean large) { super.setLargeModel(large && isLargeModelAllowed(getTree())); }
setLargeModel
247,083
void (TreeModel model) { if (!isLargeModelAllowed(getTree())) { largeModel = false; } super.setModel(model); }
setModel
247,084
void () { if (getTree() != null) { super.updateSize(); } }
updateSize
247,085
void () { if (getTree() != null) { super.completeEditing(); } }
completeEditing
247,086
Rectangle (Object value, int row, int depth, boolean expanded, Rectangle bounds) { JTree tree = getTree(); if (tree == null) { return null; } boolean leaf = isLeaf(value); Dimension size = null; // TODO: editingComponent, editingRow ??? if (editingComponent != null && editingRow == row) { size = editingComponent.getPre...
getNodeDimensions
247,087
AbstractLayoutCache () { if (is("ide.tree.experimental.layout.cache", true)) { return new DefaultTreeLayoutCache(path -> { handleAutoExpand(path); return Unit.INSTANCE; }); } if (isLargeModel() && getRowHeight() > 0) { return new FixedHeightLayoutCache(); } return new VariableHeightLayoutCache() { @Override public void...
createLayoutCache
247,088
void (TreePath path, boolean isExpanded) { int oldRowCount = getRowCount(); super.setExpandedState(path, isExpanded); if (isExpanded) onSingleChildInserted(path, oldRowCount); }
setExpandedState
247,089
void (TreeModelEvent event) { int oldRowCount = getRowCount(); super.treeNodesInserted(event); onSingleChildInserted(event.getTreePath(), oldRowCount); }
treeNodesInserted
247,090
void (TreePath path, int oldRowCount) { if (path == null || oldRowCount + 1 != getRowCount()) return; JTree tree = getTree(); if (!shouldAutoExpand(tree, path)) return; TreeModel model = tree.getModel(); if (model instanceof AsyncTreeModel && 1 == model.getChildCount(path.getLastPathComponent())) { int pathCount = 1 + ...
onSingleChildInserted
247,091
boolean (JTree tree, TreePath path) { return tree != null && isAutoExpandAllowed(tree) && tree.isVisible(path); }
shouldAutoExpand
247,092
void (@NotNull TreePath row) { var tree = getTree(); if (!shouldAutoExpand(tree, row.getParentPath())) { return; } if (tree.getModel() instanceof AsyncTreeModel asyncTreeModel) { Object node = row.getLastPathComponent(); if (isAutoExpandAllowed(tree, node)) { asyncTreeModel.onValidThread(() -> tree.expandPath(row)); } ...
handleAutoExpand
247,093
MouseListener () { return new MouseEventAdapter<>(super.createMouseListener()) { @Override public void mouseDragged(MouseEvent event) { Object component = event.getSource(); // DnDManagerImpl.SOURCE_KEY Object property = component instanceof Component ? ClientProperty.get((Component)component, "DnD Source") : null; if ...
createMouseListener
247,094
void (MouseEvent event) { Object component = event.getSource(); // DnDManagerImpl.SOURCE_KEY Object property = component instanceof Component ? ClientProperty.get((Component)component, "DnD Source") : null; if (property == null) { // use Swing-based DnD only if custom DnD is not set super.mouseDragged(event); } }
mouseDragged
247,095
MouseEvent (@NotNull MouseEvent event) { JTree tree = getTree(); if (tree == null || tree != event.getSource() || !tree.isEnabled()) { return event; } if (!event.isConsumed() && SwingUtilities.isLeftMouseButton(event)) { int x = event.getX(); int y = event.getY(); TreePath path = getClosestPathForLocation(tree, x, y); ...
convert
247,096
PropertyChangeListener () { PropertyChangeListener parent = super.createPropertyChangeListener(); return new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { String name = event.getPropertyName(); if (JTree.ANCHOR_SELECTION_PATH_PROPERTY.equals(name)) return; if (JTree.LEAD_S...
createPropertyChangeListener
247,097
void (PropertyChangeEvent event) { String name = event.getPropertyName(); if (JTree.ANCHOR_SELECTION_PATH_PROPERTY.equals(name)) return; if (JTree.LEAD_SELECTION_PATH_PROPERTY.equals(name)) { updateLeadSelectionRow(); repaintPath((TreePath)event.getOldValue()); repaintPath((TreePath)event.getNewValue()); } else if (par...
propertyChange
247,098
Rectangle (JTree tree, TreePath path) { return path != null && isValid(tree) ? super.getPathBounds(tree, path) : null; }
getPathBounds
247,099
TreePath (JTree tree, int row) { return isValid(tree) ? super.getPathForRow(tree, row) : null; }
getPathForRow