Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
285,100
boolean () { return true; }
supportsNonCodeRule
285,101
boolean () { return true; }
supportsModuleRule
285,102
boolean () { return true; }
supportsScopesRule
285,103
GroupByFileStructureAction (UsageViewImpl impl) { return (GroupByFileStructureAction) ActionManager.getInstance().getAction("UsageGrouping.FileStructure"); }
createGroupByFileStructureAction
285,104
AnAction () { return ActionManager.getInstance().getAction("UsageGrouping.DirectoryStructure"); }
createGroupByDirectoryStructureAction
285,105
boolean (@NotNull AnActionEvent e) { UsageViewImpl impl = RuleAction.getUsageViewImpl(e); return impl != null && impl.isPreviewUsages(); }
getOptionValue
285,106
void (@NotNull AnActionEvent e, boolean value) { UsageViewImpl usageViewImpl = RuleAction.getUsageViewImpl(e); if (usageViewImpl != null) usageViewImpl.setPreviewUsages(value); }
setOptionValue
285,107
void (@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { if (myView.isDisposed()) { return; } boolean showAsReadOnly = false; if (value instanceof Node && value != tree.getModel().getRoot()) { Node node = (Node)value; if (!node.isValid()) { append(UsageViewBundle.message("node.invalid") + " ", UsageTreeColors.INVALID_ATTRIBUTES); return; } if (myPresentation.isShowReadOnlyStatusAsRed() && node.isReadOnly()) { showAsReadOnly = true; } } if (value instanceof DefaultMutableTreeNode treeNode) { Object userObject = treeNode.getUserObject(); if (userObject instanceof UsageTarget usageTarget) { LOG.assertTrue(treeNode instanceof Node); if (!((Node)treeNode).isValid()) { if (!getCharSequence(false).toString().contains(UsageViewBundle.message("node.invalid"))) { append(UsageViewBundle.message("node.invalid"), UsageTreeColors.INVALID_ATTRIBUTES); } return; } final ItemPresentation presentation = usageTarget.getPresentation(); LOG.assertTrue(presentation != null); if (showAsReadOnly) { append(UsageViewBundle.message("node.readonly") + " ", UsageTreeColors.INVALID_ATTRIBUTES); } final String text = presentation.getPresentableText(); append(text == null ? "" : text, SimpleTextAttributes.REGULAR_ATTRIBUTES); final String locationString = presentation.getLocationString(); append(locationString == null ? "" : " " + locationString, SimpleTextAttributes.GRAY_ATTRIBUTES); setIcon(presentation.getIcon(expanded)); } else if (treeNode instanceof GroupNode) { GroupNode node = (GroupNode)treeNode; if (node.isRoot()) { append("<root>", patchAttrs(node, SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES)); //NON-NLS root is invisible } else { renderNode(node); } int count = node.getRecursiveUsageCount(); SimpleTextAttributes attributes = patchAttrs(node, UsageTreeColors.NUMBER_OF_USAGES_ATTRIBUTES); append(FontUtil.spaceAndThinSpace() + UsageViewBundle.message("usage.view.counter", count), SimpleTextAttributes.GRAYED_ATTRIBUTES.derive(attributes.getStyle(), null, null, null)); } else if (treeNode instanceof UsageNode) { UsageNode node = (UsageNode)treeNode; if (!node.isValid()) { append(UsageViewBundle.message("node.invalid"), UsageTreeColors.INVALID_ATTRIBUTES); return; } if (showAsReadOnly) { append(UsageViewBundle.message("node.readonly") + " ", patchAttrs(node, UsageTreeColors.READ_ONLY_ATTRIBUTES)); } renderNode(node); } else if (userObject instanceof String) { append((String)userObject, SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES); } else { //noinspection HardCodedStringLiteral append(userObject == null ? "" : userObject.toString(), SimpleTextAttributes.REGULAR_ATTRIBUTES); } } else { //noinspection HardCodedStringLiteral append(value.toString(), SimpleTextAttributes.REGULAR_ATTRIBUTES); } SpeedSearchUtil.applySpeedSearchHighlighting(tree, this, true, mySelected); }
customizeCellRenderer
285,108
void (Node node) { UsageNodePresentation presentation = node.getCachedPresentation(); if (presentation == null) { // either: // 1. the node was never updated yet // 2. the usage has dropped the cached presentation by itself // (i.e., it was stored by a soft reference and was gc-ed). // In either case, `myView.updateLater()` will eventually re-update the visible nodes. append(UsageViewBundle.message("loading"), SimpleTextAttributes.GRAY_ATTRIBUTES, true); // Since the "loading..." text is not reflected in the node's cached state, // we must force the node to recalculate its bounds on the next view update node.forceUpdate(); myView.updateLater(); return; } setIcon(presentation.getIcon()); TextChunk[] text = presentation.getText(); for (int i = 0; i < text.length; i++) { TextChunk textChunk = text[i]; SimpleTextAttributes simples = textChunk.getSimpleAttributesIgnoreBackground(); append(textChunk.getText() + (i == 0 ? " " : ""), patchAttrs(node, simples), true); } }
renderNode
285,109
SimpleTextAttributes (@NotNull Node node, @NotNull SimpleTextAttributes original) { if (node.isExcluded()) { original = new SimpleTextAttributes(original.getStyle() | SimpleTextAttributes.STYLE_STRIKEOUT, original.getFgColor(), original.getWaveColor()); } if (node instanceof GroupNode) { DefaultMutableTreeNode parent = (DefaultMutableTreeNode)node.getParent(); if (parent != null && parent.isRoot()) { original = new SimpleTextAttributes(original.getStyle() | SimpleTextAttributes.STYLE_BOLD, original.getFgColor(), original.getWaveColor()); } } return original; }
patchAttrs
285,110
void () { if (getGroup() != null) { getGroup().update(); } }
updateNotify
285,111
String () { String result = getGroup() == null ? "" : getGroup().getPresentableGroupText(); synchronized (this) { return result + ContainerUtil.getFirstItems(myChildren, 10); } }
toString
285,112
GroupNode (@NotNull UsageGroup group, int ruleIndex, @NotNull Consumer<? super UsageViewImpl.NodeChange> edtModelToSwingNodeChangesQueue) { synchronized (this) { GroupNode newNode = new GroupNode(this, group, ruleIndex); int i = getNodeIndex(newNode, this.myChildren); if (i >= 0) { return (GroupNode)this.myChildren.get(i); } int insertionIndex = -i - 1; this.myChildren.add(insertionIndex, newNode); edtModelToSwingNodeChangesQueue.consume(new UsageViewImpl.NodeChange(UsageViewImpl.NodeChangeType.ADDED, this, newNode)); return newNode; } }
insertGroupNode
285,113
int (@NotNull Node newNode, @NotNull List<? extends Node> children) { return Collections.binarySearch(children, newNode, COMPARATOR); }
getNodeIndex
285,114
int (@NotNull Node node, @NotNull List<? extends Node> children) { int i = getNodeIndex(node, children); return i >= 0 ? i : -i - 1; }
getNodeInsertionIndex
285,115
void () { ThreadingAssertions.assertEventDispatchThread(); super.removeAllChildren(); synchronized (this) { myChildren.clear(); } myRecursiveUsageCount = 0; }
removeAllChildren
285,116
UsageNode (@NotNull Usage usage) { if (!(usage instanceof MergeableUsage mergeableUsage)) return null; for (UsageNode node : getUsageNodes()) { Usage original = node.getUsage(); if (original == mergeableUsage) { // search returned duplicate usage, ignore return node; } if (original instanceof MergeableUsage) { if (((MergeableUsage)original).merge(mergeableUsage)) return node; } } return null; }
tryMerge
285,117
void (@NotNull DefaultTreeModel treeModel, @NotNull GroupNode parent, @NotNull List<? extends MutableTreeNode> nodes) { int count = nodes.size(); if (count == 0) { return; } Object2IntMap<MutableTreeNode> ordering = new Object2IntOpenHashMap<>(count); ordering.defaultReturnValue(-1); for (MutableTreeNode node : nodes) { ordering.put(node, parent.getIndex(node)); } nodes.sort(Comparator.comparingInt(ordering::getInt)); // need ascending order int[] indices = ordering.values().toIntArray(); Arrays.sort(indices); for (int i = count - 1; i >= 0; i--) { parent.remove(indices[i]); } treeModel.nodesWereRemoved(parent, indices, nodes.toArray()); }
removeNodesFromParent
285,118
boolean () { UsageGroup group = getGroup(); return group == null || group.isValid(); }
isDataValid
285,119
boolean () { Enumeration<?> enumeration = children(); while (enumeration.hasMoreElements()) { Object element = enumeration.nextElement(); if (element instanceof Node && ((Node)element).isReadOnly()) return true; } return false; }
isDataReadOnly
285,120
ClassIndex (@NotNull DefaultMutableTreeNode node) { if (node instanceof UsageNode) return ClassIndex.USAGE; if (node instanceof GroupNode) return ClassIndex.GROUP; if (node instanceof UsageTargetNode) return ClassIndex.USAGE_TARGET; return ClassIndex.UNKNOWN; }
getClassIndex
285,121
int (DefaultMutableTreeNode n1, DefaultMutableTreeNode n2) { ClassIndex classIdx1 = getClassIndex(n1); ClassIndex classIdx2 = getClassIndex(n2); if (classIdx1 != classIdx2) return classIdx1.compareTo(classIdx2); if (classIdx1 == ClassIndex.GROUP) { int c = ((GroupNode)n1).compareTo((GroupNode)n2); if (c != 0) return c; } else if (classIdx1 == ClassIndex.USAGE) { int c = ((UsageNode)n1).compareTo((UsageNode)n2); if (c != 0) return c; } // return 0 only for the same Usages inside // (e.g. when tried to insert the UsageNode for the same Usage when interrupted by write action and resumed) Object u1 = n1.getUserObject(); Object u2 = n2.getUserObject(); if (Comparing.equal(u1, u2)) return 0; return System.identityHashCode(u1) - System.identityHashCode(u2); }
compare
285,122
int (@NotNull GroupNode groupNode) { if (myRuleIndex == groupNode.myRuleIndex) { return getGroup().compareTo(groupNode.getGroup()); } return Integer.compare(myRuleIndex, groupNode.myRuleIndex); }
compareTo
285,123
void (boolean requestFocus) { if (getGroup() != null) { getGroup().navigate(requestFocus); } }
navigate
285,124
boolean () { return getGroup() != null && getGroup().canNavigate(); }
canNavigate
285,125
boolean () { return getGroup() != null && getGroup().canNavigateToSource(); }
canNavigateToSource
285,126
boolean () { for (Node node : myChildren) { if (!node.isExcluded()) return false; } return true; }
isDataExcluded
285,127
String () { return getGroup().getPresentableGroupText(); }
getNodeText
285,128
void () { UsageGroup group = getGroup(); if (group == null || !group.isValid()) { return; } PsiElement element = group instanceof DataProvider ? CommonDataKeys.PSI_ELEMENT.getData((DataProvider)group) : null; FileStatus fileStatus = group.getFileStatus(); Color foregroundColor = fileStatus != null ? fileStatus.getColor() : null; var tagIconAndText = TagManager.getTagIconAndText(element); Icon icon = IconUtil.rowIcon(tagIconAndText.icon(), group.getIcon()); List<TextChunk> chunks = new ArrayList<>(); for (ColoredText.Fragment fragment : tagIconAndText.coloredText().fragments()) { chunks.add(new TextChunk(fragment.fragmentAttributes().toTextAttributes(), fragment.fragmentText())); } TextAttributes attributes = SimpleTextAttributes.REGULAR_ATTRIBUTES.toTextAttributes(); attributes.setForegroundColor(foregroundColor); chunks.add(new TextChunk(attributes, group.getPresentableGroupText())); myCachedPresentation = new UsageNodePresentation(icon, chunks.toArray(TextChunk.EMPTY_ARRAY), null); }
updateCachedPresentation
285,129
Root () { return new Root(); }
createRoot
285,130
String () { return "Root " + super.toString(); }
toString
285,131
String () { return ""; }
getNodeText
285,132
void () { }
updateCachedPresentation
285,133
boolean () { return !isFlagSet(CACHED_INVALID_MASK); }
isValid
285,134
boolean () { boolean result; boolean computed = isFlagSet(READ_ONLY_COMPUTED_MASK); if (computed) { result = isFlagSet(CACHED_READ_ONLY_MASK); } else { result = isDataReadOnly(); setFlag(READ_ONLY_COMPUTED_MASK, true); setFlag(CACHED_READ_ONLY_MASK, result); } return result; }
isReadOnly
285,135
boolean () { return isFlagSet(EXCLUDED_MASK); }
isExcluded
285,136
void (@NotNull Consumer<? super Node> edtFireTreeNodesChangedQueue) { // performance: always update in background because smart pointer' isValid() can cause PSI chameleons expansion which is ridiculously expensive in cpp ApplicationManager.getApplication().assertIsNonDispatchThread(); boolean isDataValid = isDataValid(); boolean isReadOnly = isDataReadOnly(); String text = getNodeText(); updateCachedPresentation(); doUpdate(isDataValid, isReadOnly, text, edtFireTreeNodesChangedQueue); }
update
285,137
void () { }
updateNotify
285,138
boolean (@NotNull AnActionEvent e) { return getUsageViewSettings(e).isGroupByModule(); }
getOptionValue
285,139
void (@NotNull AnActionEvent e, boolean value) { getUsageViewSettings(e).setGroupByModule(value); }
setOptionValue
285,140
boolean (@NotNull AnActionEvent e) { return getUsageViewSettings(e).isGroupByScope(); }
getOptionValue
285,141
void (@NotNull AnActionEvent e, boolean value) { getUsageViewSettings(e).setGroupByScope(value); }
setOptionValue
285,142
boolean (@NotNull AnActionEvent e) { return getUsageViewSettings(e).isGroupByDirectoryStructure(); }
getOptionValue
285,143
void (@NotNull AnActionEvent e, boolean value) { getUsageViewSettings(e).setGroupByDirectoryStructure(value); if (value) { getUsageViewSettings(e).setGroupByPackage(false); // mutually exclusive } }
setOptionValue
285,144
boolean (@NotNull AnActionEvent e) { return getUsageViewSettings(e).isGroupByPackage(); }
getOptionValue
285,145
void (@NotNull AnActionEvent e, boolean value) { getUsageViewSettings(e).setGroupByPackage(value); if (value) { getUsageViewSettings(e).setGroupByDirectoryStructure(false); // mutually exclusive } }
setOptionValue
285,146
boolean (@NotNull AnActionEvent e) { return getUsageViewSettings(e).isFlattenModules(); }
getOptionValue
285,147
void (@NotNull AnActionEvent e, boolean value) { getUsageViewSettings(e).setFlattenModules(value); }
setOptionValue
285,148
void (@NotNull AnActionEvent e) { super.update(e); Presentation presentation = e.getPresentation(); presentation.setEnabled(presentation.isEnabled() && getUsageViewSettings(e).isGroupByModule()); }
update
285,149
boolean (@NotNull AnActionEvent e) { return getUsageViewSettings(e).isFilterDuplicatedLine(); }
getOptionValue
285,150
void (@NotNull AnActionEvent e, boolean value) { getUsageViewSettings(e).setFilterDuplicatedLine(value); }
setOptionValue
285,151
boolean (@NotNull AnActionEvent e) { return getUsageViewSettings(e).isGroupByUsageType(); }
getOptionValue
285,152
void (@NotNull AnActionEvent e, boolean value) { getUsageViewSettings(e).setGroupByUsageType(value); }
setOptionValue
285,153
boolean (@NotNull AnActionEvent e) { return getUsageViewSettings(e).isGroupByFileStructure(); }
getOptionValue
285,154
void (@NotNull AnActionEvent e, boolean value) { getUsageViewSettings(e).setGroupByFileStructure(value); }
setOptionValue
285,155
boolean (@NotNull AnActionEvent e) { return getOptionValue(e); }
isSelected
285,156
void (@NotNull AnActionEvent e) { super.update(e); e.getPresentation().setEnabled(getUsageViewSettingsOrNull(e) != null); }
update
285,157
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
285,158
void (@NotNull AnActionEvent e, boolean state) { setOptionValue(e, state); Project project = e.getProject(); if (project != null) { project.getMessageBus().syncPublisher(UsageFilteringRuleProvider.RULES_CHANGED).run(); } }
setSelected
285,159
UsageViewSettings (@NotNull AnActionEvent e) { UsageViewSettings settings = getUsageViewSettingsOrNull(e); return settings != null ? settings : UsageViewSettings.getInstance(); }
getUsageViewSettings
285,160
UsageGroup (@NotNull Usage usage, UsageTarget @NotNull [] targets) { VirtualFile virtualFile; if (usage instanceof UsageInFile && (virtualFile = ((UsageInFile)usage).getFile()) != null) { return new FileUsageGroup(myProject, virtualFile); } return null; }
getParentGroupFor
285,161
int () { return UsageGroupingRulesDefaultRanks.FILE_STRUCTURE.getAbsoluteRank(); }
getRank
285,162
boolean () { return true; }
isGroupingActionInverted
285,163
Icon () { return IconUtil.getIcon(myFile, Iconable.ICON_FLAG_READ_STATUS, myProject); }
getIconImpl
285,164
void () { if (isValid()) { myIcon = getIconImpl(); myPresentableName = myFile.getName(); } }
update
285,165
boolean (Object o) { if (this == o) return true; if (!(o instanceof FileUsageGroup fileUsageGroup)) return false; return myFile.equals(fileUsageGroup.myFile); }
equals
285,166
int () { return myFile.hashCode(); }
hashCode
285,167
Icon () { return myIcon; }
getIcon
285,168
String () { return myPresentableName; }
getPresentableGroupText
285,169
FileStatus () { return !myProject.isDisposed() && isValid() ? FileStatusManager.getInstance(myProject).getStatus(myFile) : null; }
getFileStatus
285,170
boolean () { return myFile.isValid(); }
isValid
285,171
boolean () { return myFile.isValid(); }
canNavigate
285,172
boolean () { return canNavigate(); }
canNavigateToSource
285,173
int (@NotNull UsageGroup otherGroup) { int compareTexts = getPresentableGroupText().compareToIgnoreCase(otherGroup.getPresentableGroupText()); if (compareTexts != 0) return compareTexts; if (otherGroup instanceof FileUsageGroup) { return myFile.getPath().compareTo(((FileUsageGroup)otherGroup).myFile.getPath()); } return 0; }
compareTo
285,174
Object (@NotNull String dataId) { if (CommonDataKeys.VIRTUAL_FILE.is(dataId)) { return myFile; } if (PlatformCoreDataKeys.BGT_DATA_PROVIDER.is(dataId)) { return (DataProvider)slowId -> getSlowData(slowId); } return null; }
getData
285,175
PsiFile () { return myFile.isValid() ? PsiManager.getInstance(myProject).findFile(myFile) : null; }
getPsiFile
285,176
String () { return myPresentableName; }
getPresentableName
285,177
String () { return myTextSupplier.get(); }
getPresentableGroupText
285,178
DirectoryGroupingRule (Project project) { return project.getService(DirectoryGroupingRule.class); }
getInstance
285,179
UsageGroup (@NotNull Usage usage, UsageTarget @NotNull [] targets) { if (usage instanceof UsageInFile usageInFile) { VirtualFile file = usageInFile.getFile(); if (file != null) { if (file instanceof VirtualFileWindow) { file = ((VirtualFileWindow)file).getDelegate(); } VirtualFile dir = file.getParent(); if (dir == null) return null; return getGroupForFile(dir); } } return null; }
getParentGroupFor
285,180
UsageGroup (@NotNull VirtualFile dir) { return new DirectoryGroup(dir); }
getGroupForFile
285,181
int () { return UsageGroupingRulesDefaultRanks.DIRECTORY_STRUCTURE.getAbsoluteRank(); }
getRank
285,182
String () { return "UsageGrouping.Directory"; }
getGroupingActionId
285,183
void () { if (isValid()) { myIcon = IconUtil.getIcon(myDir, 0, myProject); } }
update
285,184
Icon () { return myIcon; }
getIcon
285,185
String () { if (compactMiddleDirectories) { List<String> parentPathList = CompactGroupHelper.pathToPathList(myDir.getPath()); List<String> relativePathList = CompactGroupHelper.pathToPathList(relativePathText); String rel = relativePathText.startsWith("/") ? relativePathText.substring(1) : relativePathText; if (parentPathList.size() == relativePathList.size()) { VirtualFile baseDir = ProjectUtil.guessProjectDir(myProject); String relativePath = null; if (baseDir != null && baseDir.getParent() != null) { relativePath = VfsUtilCore.getRelativePath(myDir, baseDir.getParent(), File.separatorChar); } return relativePath == null ? rel : relativePath.replace("\\", "/"); } return rel; } else { if (myFlattenDirs || myDir.getParent() == null) { VirtualFile baseDir = ProjectUtil.guessProjectDir(myProject); String relativePath = baseDir == null ? null : VfsUtilCore.getRelativePath(myDir, baseDir, File.separatorChar); return relativePath == null ? myDir.getPresentableUrl() : relativePath; } } return myDir.getName(); }
getPresentableGroupText
285,186
FileStatus () { return isValid() ? FileStatusManager.getInstance(myProject).getStatus(myDir) : null; }
getFileStatus
285,187
boolean () { return myDir.isValid(); }
isValid
285,188
PsiDirectory () { return myDir.isValid() ? PsiManager.getInstance(myProject).findDirectory(myDir) : null; }
getDirectory
285,189
boolean () { final PsiDirectory directory = getDirectory(); return directory != null && directory.canNavigate(); }
canNavigate
285,190
boolean () { return false; }
canNavigateToSource
285,191
int (@NotNull UsageGroup usageGroup) { return getPresentableGroupText().compareToIgnoreCase(usageGroup.getPresentableGroupText()); }
compareTo
285,192
boolean (Object o) { if (this == o) return true; if (!(o instanceof DirectoryGroup)) return false; return myDir.equals(((DirectoryGroup)o).myDir); }
equals
285,193
int () { return myDir.hashCode(); }
hashCode
285,194
Object (@NotNull String dataId) { if (CommonDataKeys.VIRTUAL_FILE.is(dataId)) { return myDir; } if (PlatformCoreDataKeys.BGT_DATA_PROVIDER.is(dataId)) { return (DataProvider)slowId -> getSlowData(slowId); } return null; }
getData
285,195
String () { return UsageViewBundle.message("directory.0", myDir.getName()); }
toString
285,196
String () { return "CodeUsages"; }
toString
285,197
String () { return "DynamicUsages"; }
toString
285,198
String () { return "NonCodeUsages"; }
toString
285,199
String () { return getPresentableGroupText(); }
toString