Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
276,600
void (@NotNull Listener listener) { listeners.add(listener); }
addListener
276,601
ActionGroup () { ActionManager actionManager = ActionManager.getInstance(); DefaultActionGroup group = new DefaultActionGroup(); String[] ids = new String[]{"ExternalSystem.GroupModules", "ExternalSystem.GroupTasks", "ExternalSystem.ShowInheritedTasks", "ExternalSystem.ShowIgnored"}; for (String id : ids) { final AnAction gearAction = actionManager.getAction(id); if (gearAction instanceof ExternalSystemViewGearAction) { ((ExternalSystemViewGearAction)gearAction).setView(this); group.add(gearAction); Disposer.register(this, () -> ((ExternalSystemViewGearAction)gearAction).setView(null)); } } return group; }
createAdditionalGearActionsGroup
276,602
void () { myStructure = new ExternalProjectsStructure(myProject, myTree); Disposer.register(this, myStructure); myStructure.init(this); }
initStructure
276,603
void () { myTree = new ExternalProjectTree(myProject); myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); final ActionManager actionManager = ActionManager.getInstance(); ActionToolbar actionToolbar = actionManager.createActionToolbar(myExternalSystemId.getReadableName() + " View Toolbar", (DefaultActionGroup)actionManager .getAction("ExternalSystemView.ActionsToolbar"), true); // make the view data context available for the toolbar actions actionToolbar.setTargetComponent(this); setToolbar(actionToolbar.getComponent()); setContent(ScrollPaneFactory.createScrollPane(myTree)); myTree.addMouseListener(new PopupHandler() { @Override public void invokePopup(final Component comp, final int x, final int y) { final String id = getMenuId(getSelectedNodes(ExternalSystemNode.class)); if (id != null) { final ActionGroup actionGroup = (ActionGroup)actionManager.getAction(id); if (actionGroup != null) { actionManager.createActionPopupMenu(ExternalProjectsViewImpl.this.getName(), actionGroup).getComponent().show(comp, x, y); } } } private static @Nullable String getMenuId(Collection<? extends ExternalSystemNode> nodes) { String id = null; for (ExternalSystemNode node : nodes) { String menuId = node.getMenuId(); if (menuId == null) { return null; } if (id == null) { id = menuId; } else if (!id.equals(menuId)) { return null; } } return id; } }); }
initTree
276,604
void (final Component comp, final int x, final int y) { final String id = getMenuId(getSelectedNodes(ExternalSystemNode.class)); if (id != null) { final ActionGroup actionGroup = (ActionGroup)actionManager.getAction(id); if (actionGroup != null) { actionManager.createActionPopupMenu(ExternalProjectsViewImpl.this.getName(), actionGroup).getComponent().show(comp, x, y); } } }
invokePopup
276,605
void () { scheduleStructureRequest(() -> { final Collection<ExternalProjectInfo> projectsData = ProjectDataManager.getInstance().getExternalProjectsData(myProject, myExternalSystemId); final List<DataNode<ProjectData>> toImport = ContainerUtil.mapNotNull(projectsData, info -> info.getExternalProjectStructure()); assert myStructure != null; myStructure.updateProjects(toImport); }); }
scheduleStructureUpdate
276,606
void () { scheduleStructureRequest(() -> { if (myStructure != null) { myStructure.cleanupCache(); } }); }
scheduleStructureCleanupCache
276,607
void (Project p, Runnable r) { invokeLater(p, ModalityState.defaultModalityState(), r); }
invokeLater
276,608
void (final Project p, final ModalityState state, final Runnable r) { if (isNoBackgroundMode()) { r.run(); } else { ApplicationManager.getApplication().invokeLater(r, state, p.getDisposed()); } }
invokeLater
276,609
boolean () { return ApplicationManager.getApplication().isUnitTestMode() || ApplicationManager.getApplication().isHeadlessEnvironment(); }
isNoBackgroundMode
276,610
void (ExternalSystemNode node) { ExternalProjectsStructure structure = getStructure(); if (structure != null) { structure.updateUpTo(node); } }
updateUpTo
276,611
void (ExternalProjectsViewState state) { myState = state; }
loadState
276,612
boolean () { return myState.showIgnored; }
getShowIgnored
276,613
void (boolean value) { if (myState.showIgnored != value) { myState.showIgnored = value; scheduleStructureUpdate(); } }
setShowIgnored
276,614
boolean () { return myState.groupTasks; }
getGroupTasks
276,615
boolean () { return myState.groupModules; }
getGroupModules
276,616
boolean () { return true; }
useTasksNode
276,617
void (boolean value) { if (myState.groupTasks != value) { myState.groupTasks = value; scheduleNodesRebuild(TasksNode.class); } }
setGroupTasks
276,618
void (boolean value) { if (myState.groupModules != value) { myState.groupModules = value; scheduleNodesRebuild(ModuleNode.class); scheduleNodesRebuild(ProjectNode.class); } }
setGroupModules
276,619
boolean () { return myState.showInheritedTasks; }
showInheritedTasks
276,620
void (boolean value) { if (myState.showInheritedTasks != value) { myState.showInheritedTasks = value; scheduleStructureUpdate(); } }
setShowInheritedTasks
276,621
void (final Runnable r) { invokeLater(myProject, () -> { if (!ToolWindowManagerEx.getInstanceEx(myProject).shouldUpdateToolWindowContent(myToolWindow)) return; boolean shouldCreate = myStructure == null; if (shouldCreate) { initStructure(); } myTree.setPaintBusy(true); try { r.run(); if (shouldCreate) { restoreTreeState(); } } finally { myTree.setPaintBusy(false); } }); }
scheduleStructureRequest
276,622
void () { TreeState.createFrom(myState.treeState).applyTo(myTree); }
restoreTreeState
276,623
List<ProjectNode> () { return getSelectedNodes(ProjectNode.class); }
getSelectedProjectNodes
276,624
VirtualFile () { for (ExternalSystemNode each : getSelectedNodes(ExternalSystemNode.class)) { VirtualFile file = each.getVirtualFile(); if (file != null && file.isValid()) return file; } final ProjectNode projectNode = getSelectedProjectNode(); if (projectNode == null) return null; VirtualFile file = projectNode.getVirtualFile(); if (file == null || !file.isValid()) return null; return file; }
extractVirtualFile
276,625
Object () { final List<VirtualFile> files = new ArrayList<>(); for (ExternalSystemNode each : getSelectedNodes(ExternalSystemNode.class)) { VirtualFile file = each.getVirtualFile(); if (file != null && file.isValid()) files.add(file); } return files.isEmpty() ? null : VfsUtilCore.toVirtualFileArray(files); }
extractVirtualFiles
276,626
Object () { final List<Navigatable> navigatables = new ArrayList<>(); for (ExternalSystemNode each : getSelectedNodes(ExternalSystemNode.class)) { Navigatable navigatable = each.getNavigatable(); if (navigatable != null) navigatables.add(navigatable); } return navigatables.isEmpty() ? null : navigatables.toArray(Navigatable.EMPTY_NAVIGATABLE_ARRAY); }
extractNavigatables
276,627
void () { this.listeners.clear(); this.myViewContributors.clear(); this.myStructure = null; this.myTree = null; }
dispose
276,628
void (@NotNull PresentationData presentation) { super.update(presentation); presentation.setIcon(AllIcons.Nodes.ConfigFolder); }
update
276,629
String () { return "Tasks"; }
getName
276,630
boolean () { return super.isVisible() && hasChildren(); }
isVisible
276,631
void (@NotNull PresentationData presentation) { super.update(presentation); presentation.setIcon(AllIcons.Nodes.ConfigFolder); }
update
276,632
String () { return group; }
getName
276,633
boolean () { return super.isVisible() && hasChildren(); }
isVisible
276,634
int (@NotNull ExternalSystemNode node) { return "other".equals(group) ? 1 : super.compareTo(node); }
compareTo
276,635
int (@NotNull ExternalSystemNode<?> o1, @NotNull ExternalSystemNode<?> o2) { int order1 = getOrder(o1); int order2 = getOrder(o2); if (order1 == order2) return o1.compareTo(o2); return order1 < order2 ? -1 : 1; }
compare
276,636
int (@NotNull ExternalSystemNode<?> o) { Order annotation = o.getClass().getAnnotation(Order.class); if (annotation != null) { return annotation.value(); } return 0; }
getOrder
276,637
boolean () { SimpleNode parent = getParent(); return parent != null && parent.getChildCount() == 1; }
isAutoExpandNode
276,638
void (@Nullable ExternalSystemNode<?> parent) { myParent = parent; }
setParent
276,639
T () { return myDataNode != null ? myDataNode.getData() : null; }
getData
276,640
NodeDescriptor () { return myParent; }
getParentDescriptor
276,641
ExternalProjectsView () { return myExternalProjectsView; }
getExternalProjectsView
276,642
ExternalSystemUiAware () { return myExternalProjectsView.getUiAware(); }
getUiAware
276,643
ExternalProjectsStructure () { return myExternalProjectsView.getStructure(); }
getStructure
276,644
ExternalSystemShortcutsManager () { return myExternalProjectsView.getShortcutsManager(); }
getShortcutsManager
276,645
ExternalSystemTaskActivator () { return myExternalProjectsView.getTaskActivator(); }
getTaskActivator
276,646
boolean () { return getDisplayKind() != ExternalProjectsStructure.DisplayKind.NEVER && !(isIgnored() && !myExternalProjectsView.getShowIgnored()); }
isVisible
276,647
boolean () { if (myDataNode != null) { return myDataNode.isIgnored(); } final SimpleNode parent = getParent(); return parent instanceof ExternalSystemNode && ((ExternalSystemNode<?>)parent).isIgnored(); }
isIgnored
276,648
void (final boolean ignored) { if (myDataNode != null) { ExternalProjectsManager.getInstance(myExternalProjectsView.getProject()).setIgnored(myDataNode, ignored); } }
setIgnored
276,649
void () { }
onChildrenBuilt
276,650
void () { myChildren = null; myChildrenList = NO_CHILDREN_LIST; myTotalErrorLevel = null; }
cleanUpCache
276,651
void (List<? extends ExternalSystemNode<?>> list) { if (!list.isEmpty()) { list.sort(ORDER_AWARE_COMPARATOR); } }
sort
276,652
boolean (Collection<? extends ExternalSystemNode<?>> externalSystemNodes) { return addAll(externalSystemNodes, false); }
addAll
276,653
boolean (Collection<? extends ExternalSystemNode<?>> externalSystemNodes, boolean silently) { if (externalSystemNodes.isEmpty()) return false; if (myChildrenList == NO_CHILDREN_LIST) { myChildrenList = new CopyOnWriteArrayList<>(); } for (ExternalSystemNode<?> externalSystemNode : externalSystemNodes) { externalSystemNode.setParent(this); myChildrenList.add(externalSystemNode); } if (!silently) { childrenChanged(); } return true; }
addAll
276,654
boolean (ExternalSystemNode<?> externalSystemNode) { return addAll(Collections.singletonList(externalSystemNode)); }
add
276,655
boolean (Collection<? extends ExternalSystemNode<?>> externalSystemNodes) { return removeAll(externalSystemNodes, false); }
removeAll
276,656
boolean (Collection<? extends ExternalSystemNode<?>> externalSystemNodes, boolean silently) { if (externalSystemNodes.isEmpty()) return false; for (ExternalSystemNode<?> externalSystemNode : externalSystemNodes) { externalSystemNode.setParent(null); if (myChildrenList != NO_CHILDREN_LIST) myChildrenList.remove(externalSystemNode); } if (!silently) { childrenChanged(); } return true; }
removeAll
276,657
void (ExternalSystemNode<?> externalSystemNode) { removeAll(Collections.singletonList(externalSystemNode)); }
remove
276,658
void () { ExternalSystemNode<?> each = this; while (each != null) { each.myTotalErrorLevel = null; each = (ExternalSystemNode<?>)each.getParent(); } sort(myChildrenList); final List<ExternalSystemNode<?>> visibleNodes = ContainerUtil.filter(myChildrenList, node -> node.isVisible()); myChildren = visibleNodes.toArray(new ExternalSystemNode[0]); myExternalProjectsView.updateUpTo(this); }
childrenChanged
276,659
boolean () { return getChildren().length > 0; }
hasChildren
276,660
void (DataNode<T> dataNode) { myDataNode = dataNode; }
setDataNode
276,661
void (ExternalProjectsStructure.ErrorLevel level, String... errors) { if (myErrorLevel == level) return; myErrorLevel = level; if (errors.length == 0) { myErrors = NO_ERRORS_LIST; } else { myErrors = Arrays.asList(errors); } myExternalProjectsView.updateUpTo(this); }
setErrorLevel
276,662
void (@NotNull PresentationData presentation) { setNameAndTooltip(presentation, getName(), null); }
doUpdate
276,663
void (@NotNull PresentationData presentation, @NlsSafe String name, @Nullable @Tooltip String tooltip) { setNameAndTooltip(presentation, name, tooltip, (String)null); }
setNameAndTooltip
276,664
void (@NotNull PresentationData presentation, @NlsSafe String name, @Nullable @Tooltip String tooltip, @Nullable @NlsSafe String hint) { final boolean ignored = isIgnored(); final SimpleTextAttributes textAttributes = ignored ? SimpleTextAttributes.GRAYED_ITALIC_ATTRIBUTES : getPlainAttributes(); setNameAndTooltip(presentation, name, tooltip, textAttributes); if (!StringUtil.isEmptyOrSpaces(hint)) { presentation.addText(" (" + hint + ")", ignored ? SimpleTextAttributes.GRAYED_ITALIC_ATTRIBUTES : SimpleTextAttributes.GRAY_ATTRIBUTES); } }
setNameAndTooltip
276,665
void (@NotNull PresentationData presentation, @NlsSafe String name, @Nullable @Tooltip String tooltip, SimpleTextAttributes attributes) { presentation.clearText(); presentation.addText(name, prepareAttributes(attributes)); final String s = (tooltip != null ? tooltip + "\n\r" : "") + StringUtil.join(myErrors, "\n\r"); presentation.setTooltip(s); }
setNameAndTooltip
276,666
SimpleTextAttributes (SimpleTextAttributes from) { ExternalProjectsStructure.ErrorLevel level = getTotalErrorLevel(); Color waveColor = level == ExternalProjectsStructure.ErrorLevel.NONE ? null : JBColor.RED; int style = from.getStyle(); if (waveColor != null) style |= SimpleTextAttributes.STYLE_WAVED; return new SimpleTextAttributes(from.getBgColor(), from.getFgColor(), waveColor, style); }
prepareAttributes
276,667
String () { return null; }
getActionId
276,668
String () { return null; }
getMenuId
276,669
VirtualFile () { return null; }
getVirtualFile
276,670
Navigatable () { return null; }
getNavigatable
276,671
void (SimpleTree tree, InputEvent inputEvent) { String actionId = getActionId(); getExternalProjectsView().handleDoubleClickOrEnter(this, actionId, inputEvent); }
handleDoubleClickOrEnter
276,672
int (@NotNull ExternalSystemNode node) { return StringUtil.compare(this.getName(), node.getName(), true); }
compareTo
276,673
void (ExternalSystemNode<T> node) { setDataNode(node.myDataNode); }
mergeWith
276,674
void (ExternalProjectsView externalProjectsView) { myExternalProjectsView = externalProjectsView; myRoot = new RootNode(); myTreeModel = new StructureTreeModel<>(this, this); myAsyncTreeModel = new AsyncTreeModel(myTreeModel, this); myTree.setModel(myAsyncTreeModel); TreeUtil.expand(myTree, 1); }
init
276,675
Project () { return myProject; }
getProject
276,676
void (SimpleNode node) { if (node != null) { myTreeModel.invalidate(node, true); } }
updateFrom
276,677
void (SimpleNode node) { SimpleNode each = node; while (each != null) { myTreeModel.invalidate(each, false); each = each.getParent(); } }
updateUpTo
276,678
Object () { return myRoot; }
getRootElement
276,679
void () { myRoot.cleanUpCache(); myNodeMapping.clear(); myTreeModel.invalidateAsync(); }
cleanupCache
276,680
void (final Tree tree) { tree.setRootVisible(false); tree.setShowsRootHandles(true); }
configureTree
276,681
void (@NotNull SimpleNode node) { myTreeModel.select(node, myTree, path -> {}); }
select
276,682
void (@NotNull SimpleNode node) { myTreeModel.expand(node, myTree, path -> {}); }
expand
276,683
void (Collection<? extends DataNode<ProjectData>> toImport) { List<String> toImportPaths = ContainerUtil.map(toImport, pd -> pd.getData().getLinkedExternalProjectPath()); Collection<String> orphanProjects = ContainerUtil.subtract(ContainerUtil.mapNotNull(myNodeMapping.entrySet(), entry -> entry.getValue() instanceof ProjectNode ? entry.getKey() : null), toImportPaths); for (DataNode<ProjectData> each : toImport) { final ProjectData projectData = each.getData(); final String projectPath = projectData.getLinkedExternalProjectPath(); ExternalSystemNode<?> projectNode = findNodeFor(projectPath); if (projectNode instanceof ProjectNode) { doMergeChildrenChanges(projectNode, each, new ProjectNode(myExternalProjectsView, each)); } else { ExternalSystemNode<?> node = myNodeMapping.remove(projectPath); if (node != null) { SimpleNode parent = node.getParent(); if (parent instanceof ExternalSystemNode) { ((ExternalSystemNode<?>)parent).remove(projectNode); } } projectNode = new ProjectNode(myExternalProjectsView, each); myNodeMapping.put(projectPath, projectNode); } if (toImport.size() == 1) { TreeUtil.expand(myTree, 1); } doUpdateProject((ProjectNode)projectNode); } //remove orphan projects from view for (String orphanProjectPath : orphanProjects) { ExternalSystemNode<?> projectNode = myNodeMapping.remove(orphanProjectPath); if (projectNode instanceof ProjectNode) { SimpleNode parent = projectNode.getParent(); if (parent instanceof ExternalSystemNode) { ((ExternalSystemNode<?>)parent).remove(projectNode); updateUpTo(projectNode); } } } }
updateProjects
276,684
void (ExternalSystemNode<?> currentNode, DataNode<?> newDataNode, ExternalSystemNode newNode) { final ExternalSystemNode<?>[] cached = currentNode.getCached(); if (cached == null) { //noinspection unchecked currentNode.mergeWith(newNode); } else { final List<Object> duplicates = new ArrayList<>(); final Map<Object, ExternalSystemNode<?>> oldDataMap = new LinkedHashMap<>(); for (ExternalSystemNode<?> node : cached) { Object key = node.getData() != null ? node.getData() : node.getName(); final Object systemNode = oldDataMap.put(key, node); if(systemNode != null) { duplicates.add(key); } } Map<Object, ExternalSystemNode<?>> newDataMap = new LinkedHashMap<>(); Map<Object, ExternalSystemNode<?>> unchangedNewDataMap = new LinkedHashMap<>(); for (ExternalSystemNode<?> node : newNode.getChildren()) { Object key = node.getData() != null ? node.getData() : node.getName(); if (oldDataMap.remove(key) == null) { newDataMap.put(key, node); } else { unchangedNewDataMap.put(key, node); } } for (Object duplicate : duplicates) { newDataMap.remove(duplicate); } currentNode.removeAll(oldDataMap.values()); for (ExternalSystemNode<?> node : currentNode.getChildren()) { Object key = node.getData() != null ? node.getData() : node.getName(); final ExternalSystemNode<?> unchangedNewNode = unchangedNewDataMap.get(key); if (unchangedNewNode != null) { doMergeChildrenChanges(node, unchangedNewNode.myDataNode, unchangedNewNode); } } updateFrom(currentNode); //noinspection unchecked currentNode.mergeWith(newNode); currentNode.addAll(newDataMap.values()); } }
doMergeChildrenChanges
276,685
void (ProjectNode node) { ExternalSystemNode<?> newParentNode = myRoot; if (!node.isVisible()) { newParentNode.remove(node); } else { node.updateProject(); reconnectNode(node, newParentNode); } }
doUpdateProject
276,686
void (ProjectNode node, ExternalSystemNode<?> newParentNode) { ExternalSystemNode<?> oldParentNode = node.getGroup(); if (oldParentNode == null || !oldParentNode.equals(newParentNode)) { if (oldParentNode != null) { oldParentNode.remove(node); } newParentNode.add(node); } }
reconnectNode
276,687
ExternalSystemNode (String projectPath) { return myNodeMapping.get(projectPath); }
findNodeFor
276,688
void (@NotNull Collection<TreePath> paths, boolean structure) { if (paths.isEmpty()) { return; } paths.forEach(p -> myTreeModel.invalidate(p, structure)); }
invalidatePaths
276,689
void () { this.myExternalProjectsView = null; this.myNodeMapping.clear(); this.myRoot = null; }
dispose
276,690
Action (@NotNull TreePath path) { Object object = TreeUtil.getLastUserObject(path); if (object != null && anyAssignableFrom(object.getClass())) { myCollector.add(path); } return Action.CONTINUE; }
visit
276,691
boolean () { return true; }
isVisible
276,692
void (@NotNull PresentationData presentation) { super.update(presentation); presentation.setIcon(getUiAware().getTaskIcon()); final String shortcutHint = StringUtil.nullize(getShortcutsManager().getDescription(myTaskData.getLinkedExternalProjectPath(), myTaskData.getName())); final String activatorHint = StringUtil.nullize(getTaskActivator().getDescription( myTaskData.getOwner(), myTaskData.getLinkedExternalProjectPath(), myTaskData.getName())); String hint; if (shortcutHint == null) { hint = activatorHint; } else if (activatorHint == null) { hint = shortcutHint; } else { hint = shortcutHint + ", " + activatorHint; } setNameAndTooltip(presentation, getName(), myTaskData.getDescription(), hint); }
update
276,693
boolean () { if (!super.isVisible()) return false; return !myTaskData.isInherited() || getExternalProjectsView().showInheritedTasks(); }
isVisible
276,694
boolean () { return myTaskData.isTest(); }
isTest
276,695
String () { return moduleOwnerName; }
getModuleOwnerName
276,696
String () { return "ExternalSystemView.TaskMenu"; }
getMenuId
276,697
String () { return "ExternalSystem.RunTask"; }
getActionId
276,698
boolean () { return true; }
isAlwaysLeaf
276,699
void (Collection<ModuleNode> allModules) { myAllModules = allModules; }
setAllModules