Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
6,100
void (AntBeforeRunTask task) { task.setAntFileUrl(null); task.setTargetName(null); }
clear
6,101
Object () { return myTarget; }
getElement
6,102
AntBuildTargetBase () { return myTarget; }
getTarget
6,103
boolean () { final CompositeAppearance oldText = myHighlightedText; final boolean isMeta = myTarget instanceof MetaTarget; setIcon(isMeta ? AntIcons.MetaTarget : AllIcons.Nodes.Target); myHighlightedText = new CompositeAppearance(); final AntBuildFile buildFile = isMeta ? ((MetaTarget)myTarget).getBuildFile() : myTarget.getModel().getBuildFile(); final Color color = buildFile.isTargetVisible(myTarget) ? UIUtil.getLabelForeground() : UIUtil.getLabelDisabledForeground(); TextAttributes nameAttributes = new TextAttributes(color, null, null, EffectType.BOXED, myTarget.isDefault() ? Font.BOLD : Font.PLAIN); myHighlightedText.getEnding().addText(myTarget.getDisplayName(), nameAttributes); AntConfigurationBase antConfiguration = AntConfigurationBase.getInstance(myProject); final ArrayList<String> addedNames = new ArrayList<>(4); for (final ExecutionEvent event : antConfiguration.getEventsForTarget(myTarget)) { final String presentableName; if ((event instanceof ExecuteCompositeTargetEvent)) { presentableName = ((ExecuteCompositeTargetEvent)event).getMetaTargetName(); if (presentableName.equals(myTarget.getName())) { continue; } } else { presentableName = event.getPresentableName(); } if (!addedNames.contains(presentableName)) { addedNames.add(presentableName); myHighlightedText.getEnding().addText(" (" + presentableName + ')', ourPostfixAttributes); } } final VirtualFile vFile = buildFile.getVirtualFile(); if (vFile != null) { for (AntBeforeRunTask task : RunManagerEx.getInstanceEx(myProject).getBeforeRunTasks(AntBeforeRunTaskProvider.ID)) { if (task.isRunningTarget(myTarget)) { myHighlightedText.getEnding().addText(AntBundle.message("ant.target.node.before.run.debug"), ourPostfixAttributes); break; } } } myName = myHighlightedText.getText(); final AntBuildTargetBase target = getTarget(); if (!addShortcutText(target.getActionId())) { if (target.isDefault()) { addShortcutText(((AntBuildModelBase)target.getModel()).getDefaultTargetActionId()); } } return !Comparing.equal(myHighlightedText, oldText); }
update
6,104
boolean (String actionId) { return addShortcutText(actionId, myHighlightedText); }
addShortcutText
6,105
boolean (String actionId, CompositeAppearance appearance) { Shortcut shortcut = KeymapUtil.getPrimaryShortcut(actionId); if (shortcut != null) { appearance.getEnding().addText(" (" + KeymapUtil.getShortcutText(shortcut) + ")", SimpleTextAttributes.GRAY_ATTRIBUTES); return true; } else return false; }
addShortcutText
6,106
CellAppearanceEx () { return myHighlightedText; }
getHighlightedText
6,107
void (@NotNull SimpleColoredComponent component) { getHighlightedText().customize(component); component.setIcon(getIcon()); String toolTipText = getTarget().getNotEmptyDescription(); component.setToolTipText(toolTipText); }
customize
6,108
Object () { return myBuildFile; }
getElement
6,109
AntBuildFile () { return myBuildFile; }
getBuildFile
6,110
boolean () { CompositeAppearance oldAppearance = myAppearance; myAppearance = new CompositeAppearance(); myAppearance.getEnding().addText(myBuildFile.getPresentableName(), SimpleTextAttributes.REGULAR_ATTRIBUTES); final AntBuildModelBase buildModel = myBuildFile.getModelIfRegistered(); if (buildModel != null) { AntTargetNodeDescriptor.addShortcutText(buildModel.getDefaultTargetActionId(), myAppearance); } myAppearance.setIcon(AntIcons.Build); myName = myBuildFile.getPresentableName(); return !Comparing.equal(myAppearance, oldAppearance); }
update
6,111
void (@NotNull SimpleColoredComponent component) { if (myAppearance != null) { myAppearance.customize(component); } else { super.customize(component); } }
customize
6,112
boolean (@NotNull final Object element) { return true; }
isToBuildChildrenInBackground
6,113
boolean (@NotNull Object element) { return element != myRoot && !(element instanceof AntBuildFile); }
isAlwaysLeaf
6,114
AntNodeDescriptor (@NotNull Object element, NodeDescriptor parentDescriptor) { if (element == myRoot) { return new RootNodeDescriptor(myProject, parentDescriptor); } if (element instanceof String) { return new TextInfoNodeDescriptor(myProject, parentDescriptor, (String)element); } if (element instanceof AntBuildFileBase) { return new AntBuildFileNodeDescriptor(myProject, parentDescriptor, (AntBuildFileBase)element); } if (element instanceof AntBuildTargetBase) { return new AntTargetNodeDescriptor(myProject, parentDescriptor, (AntBuildTargetBase)element); } LOG.error("Unknown element for this tree structure " + element); return null; }
createDescriptor
6,115
Object (@NotNull Object element) { if (element instanceof AntBuildTarget) { if (element instanceof MetaTarget) { return ((MetaTarget)element).getBuildFile(); } return ((AntBuildTarget)element).getModel().getBuildFile(); } if (element instanceof AntBuildFile) { return myRoot; } return null; }
getParentElement
6,116
void () { PsiDocumentManager.getInstance(myProject).commitAllDocuments(); }
commit
6,117
boolean () { return PsiDocumentManager.getInstance(myProject).hasUncommitedDocuments(); }
hasSomethingToCommit
6,118
ActionCallback () { return asyncCommitDocuments(myProject); }
asyncCommit
6,119
Object () { return myRoot; }
getRootElement
6,120
void (boolean value) { myFilteredTargets = value; }
setFilteredTargets
6,121
Object () { return myRoot; }
getElement
6,122
boolean () { myName = ""; return false; }
update
6,123
Object () { return myName; }
getElement
6,124
boolean () { return true; }
update
6,125
boolean (@NotNull CompileContext context) { return AntConfigurationBase.getInstance(context.getProject()).executeTargetAfterCompile(context, createDataContext(context)); }
execute
6,126
Project () { return project; }
getProject
6,127
void (String url) { myAntFileUrl = url; }
setAntFileUrl
6,128
void (String targetName) { myTargetName = targetName; }
setTargetName
6,129
void (@NotNull Element element) { super.writeExternal(element); if (myAntFileUrl != null && myTargetName != null) { element.setAttribute("antfile", myAntFileUrl); element.setAttribute("target", myTargetName); } }
writeExternal
6,130
void (@NotNull Element element) { super.readExternal(element); final String url = element.getAttributeValue("antfile"); final String targetName = element.getAttributeValue("target"); if (url != null && targetName != null) { myAntFileUrl = url; myTargetName = targetName; } }
readExternal
6,131
boolean (AntBuildTarget target) { final VirtualFile vFile = target.getModel().getBuildFile().getVirtualFile(); if (vFile == null) { return false; } if (myAntFileUrl == null || !VfsUtilCore.pathEqualsTo(vFile, VfsUtilCore.urlToPath(myAntFileUrl))) { return false; } return Objects.equals(myTargetName, target.getName()); }
isRunningTarget
6,132
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; AntBeforeRunTask that = (AntBeforeRunTask)o; if (myAntFileUrl != null ? !myAntFileUrl.equals(that.myAntFileUrl) : that.myAntFileUrl != null) return false; if (myTargetName != null ? !myTargetName.equals(that.myTargetName) : that.myTargetName != null) return false; return true; }
equals
6,133
int () { int result = super.hashCode(); result = 31 * result + (myTargetName != null ? myTargetName.hashCode() : 0); result = 31 * result + (myAntFileUrl != null ? myAntFileUrl.hashCode() : 0); return result; }
hashCode
6,134
Project () { return myBuildFile.getProject(); }
getProject
6,135
AntBuildFile () { return myBuildFile; }
getBuildFile
6,136
boolean () { return false; }
isDefault
6,137
AntBuildModelBase () { return myBuildFile.getModel(); }
getModel
6,138
Navigatable () { return null; }
getOpenFileDescriptor
6,139
BuildTask (final String taskName) { return null; }
findTask
6,140
void (DataContext dataContext, List<BuildFileProperty> additionalProperties, AntBuildListener buildListener) { ExecutionHandler.runBuild(myBuildFile, myTargets, null, dataContext, additionalProperties, buildListener); }
run
6,141
VirtualFile () { return myBuildFile.getVirtualFile(); }
getContainingFile
6,142
boolean (Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final MetaTarget that = (MetaTarget)o; if (!myBuildFile.equals(that.myBuildFile)) { return false; } if (!Comparing.equal(myTargets, that.myTargets)) { return false; } return true; }
equals
6,143
int () { int code = myBuildFile.hashCode(); for (String name : myTargets) { code += name.hashCode(); } return code; }
hashCode
6,144
Key<AntBeforeRunTask> () { return ID; }
getId
6,145
String () { return AntBundle.message("ant.target.before.run.description.empty"); }
getName
6,146
Icon () { return AllIcons.Nodes.Target; }
getIcon
6,147
Icon (AntBeforeRunTask task) { AntBuildTarget antTarget = findTargetToExecute(task); return antTarget instanceof MetaTarget ? AntIcons.MetaTarget : AllIcons.Nodes.Target; }
getTaskIcon
6,148
String (AntBeforeRunTask task) { final String targetName = task.getTargetName(); if (targetName == null) { return AntBundle.message("ant.target.before.run.description.empty"); } return AntBundle.message("ant.target.before.run.description", targetName); }
getDescription
6,149
boolean () { return true; }
isConfigurable
6,150
boolean (@NotNull RunConfiguration runConfiguration, @NotNull AntBeforeRunTask task) { AntBuildTarget buildTarget = findTargetToExecute(task); final TargetChooserDialog dlg = new TargetChooserDialog(task.getProject(), buildTarget); if (dlg.showAndGet()) { task.setTargetName(null); task.setAntFileUrl(null); buildTarget = dlg.getSelectedTarget(); if (buildTarget != null) { final VirtualFile vFile = buildTarget.getModel().getBuildFile().getVirtualFile(); if (vFile != null) { task.setAntFileUrl(vFile.getUrl()); task.setTargetName(buildTarget.getName()); } } return true; } return false; }
configureTask
6,151
AntBeforeRunTask (@NotNull RunConfiguration runConfiguration) { return new AntBeforeRunTask(runConfiguration.getProject()); }
createTask
6,152
boolean (@NotNull RunConfiguration configuration, @NotNull AntBeforeRunTask task) { return findTargetToExecute(task) != null; }
canExecuteTask
6,153
boolean (@NotNull DataContext context, @NotNull RunConfiguration configuration, @NotNull ExecutionEnvironment env, @NotNull AntBeforeRunTask task) { AntBuildTarget target = findTargetToExecute(task); return target == null || AntConfigurationImpl.executeTargetSynchronously(context, target); }
executeTask
6,154
AntBuildTarget (@NotNull AntBeforeRunTask task) { return GlobalAntConfiguration.getInstance().findTarget(task.getProject(), task.getAntFileUrl(), task.getTargetName()); }
findTargetToExecute
6,155
int () { return myHashCode; }
hashCode
6,156
boolean (Object obj) { if (!(obj instanceof AntBuildTargetImpl that)) { return false; } return Objects.equals(myName, that.myName) && Comparing.equal(myFile, that.myFile); }
equals
6,157
Project () { return myProject; }
getProject
6,158
boolean () { return myIsDefault; }
isDefault
6,159
VirtualFile () { return myFile; }
getContainingFile
6,160
AntBuildModelBase () { return myModel; }
getModel
6,161
String () { final StringBuilder name = new StringBuilder(); name.append(AntConfiguration.getActionIdPrefix(myModel.getBuildFile().getProject())); final String modelName = myModel.getName(); if (!StringUtil.isEmptyOrSpaces(modelName)) { name.append("_").append(modelName.trim()); } name.append('_').append(getName()); return name.toString(); }
getActionId
6,162
String (@Nullable Project project, @NotNull String actionId) { // expected format antIdPrefix{_modelName}_targetName String idPrefix = project != null? AntConfiguration.getActionIdPrefix(project) : AntConfiguration.ACTION_ID_PREFIX; if (actionId.length() <= idPrefix.length() || !actionId.startsWith(idPrefix)) { return null; } if (actionId.charAt(idPrefix.length()) != '_') { return null; } int nextSeparatorIndex = actionId.indexOf('_', idPrefix.length() + 1); return nextSeparatorIndex > idPrefix.length()? actionId.substring(idPrefix.length() + 1, nextSeparatorIndex) : null; }
parseBuildFileName
6,163
BuildTask (final String taskName) { final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(myFile); final AntDomProject domProject = AntSupport.getAntDomProject(psiFile); if (domProject != null) { final AntDomTarget antTarget = domProject.findDeclaredTarget(myName); if (antTarget != null) { final Ref<AntDomElement> result = new Ref<>(null); antTarget.accept(new AntDomRecursiveVisitor() { @Override public void visitAntDomElement(AntDomElement element) { if (result.get() != null) { return; } if (element.isTask() && taskName.equals(element.getXmlElementName())) { result.set(element); return; } super.visitAntDomElement(element); } }); final AntDomElement task = result.get(); if (task != null) { return new BuildTask(this, task); } } } return null; }
findTask
6,164
void (AntDomElement element) { if (result.get() != null) { return; } if (element.isTask() && taskName.equals(element.getXmlElementName())) { result.set(element); return; } super.visitAntDomElement(element); }
visitAntDomElement
6,165
Navigatable () { return (myFile == null) ? null : PsiNavigationSupport.getInstance().createNavigatable(myProject, myFile, myTextOffset); }
getOpenFileDescriptor
6,166
void (DataContext dataContext, List<BuildFileProperty> additionalProperties, AntBuildListener buildListener) { AntBuildModel model = getModel(); if (model == null) { buildListener.buildFinished(AntBuildListener.FAILED_TO_RUN, 0); throw new IllegalStateException("Target '" + getName() + "' is invalid: model is null"); } AntBuildFile buildFile = model.getBuildFile(); if (buildFile == null) { buildListener.buildFinished(AntBuildListener.FAILED_TO_RUN, 0); throw new IllegalStateException("Target '" + getName() + "' is invalid: build file is null"); } ExecutionHandler.runBuild((AntBuildFileBase)buildFile, isDefault()? Collections.emptyList() : getTargetNames(), null, dataContext, additionalProperties, buildListener); }
run
6,167
AntReference (Element dataElement) { if (Boolean.valueOf(dataElement.getAttributeValue(PROJECT_DEFAULT_ATTR)).booleanValue()) return PROJECT_DEFAULT; if (Boolean.valueOf(dataElement.getAttributeValue(BUNDLED_ANT_ATTR)).booleanValue()) return BUNDLED_ANT; String name = dataElement.getAttributeValue(NAME_ATTR); if (name == null) { throw new IllegalStateException("no name"); } return new MissingAntReference(name); }
readValue
6,168
void (Element dataElement, AntReference antReference) { antReference.writeExternal(dataElement); }
writeValue
6,169
int (AntReference reference, AntReference reference1) { if (reference.equals(reference1)) return 0; if (reference == BUNDLED_ANT) return -1; if (reference1 == BUNDLED_ANT) return 1; return reference.getName().compareToIgnoreCase(reference1.getName()); }
compare
6,170
String () { return getName(); }
toString
6,171
void (Element dataElement) { dataElement.setAttribute(PROJECT_DEFAULT_ATTR, Boolean.TRUE.toString()); }
writeExternal
6,172
AntInstallation (GlobalAntConfiguration ants) { throw new UnsupportedOperationException("Should not call"); }
find
6,173
AntReference (GlobalAntConfiguration antConfiguration) { return this; }
bind
6,174
String () { throw new UnsupportedOperationException("Should not call"); }
getName
6,175
String () { return "PROJECT_DEFAULT"; }
toString
6,176
boolean (Object obj) { return obj == this; }
equals
6,177
void (Element dataElement) { dataElement.setAttribute(BUNDLED_ANT_ATTR, Boolean.TRUE.toString()); }
writeExternal
6,178
boolean (Object obj) { return obj == this; }
equals
6,179
String () { return GlobalAntConfiguration.getBundledAntName(); }
getName
6,180
AntInstallation (GlobalAntConfiguration antConfiguration) { return antConfiguration.getBundledAnt(); }
find
6,181
AntReference (GlobalAntConfiguration antConfiguration) { return this; }
bind
6,182
int () { return getName().hashCode(); }
hashCode
6,183
boolean (Object obj) { if (obj == PROJECT_DEFAULT) return this == PROJECT_DEFAULT; if (obj == BUNDLED_ANT) return this == BUNDLED_ANT; return obj instanceof AntReference && Objects.equals(getName(), ((AntReference)obj).getName()); }
equals
6,184
AntInstallation (AbstractProperty<? extends AntReference> property, AbstractProperty.AbstractPropertyContainer container) { GlobalAntConfiguration antConfiguration = GlobalAntConfiguration.INSTANCE.get(container); LOG.assertTrue(antConfiguration != null); AntReference antReference = property.get(container); if (antReference == PROJECT_DEFAULT) { antReference = AntConfigurationImpl.DEFAULT_ANT.get(container); } if (antReference == null) return null; return antReference.find(antConfiguration); }
findAnt
6,185
AntInstallation (AbstractProperty.AbstractPropertyContainer container) { GlobalAntConfiguration antConfiguration = GlobalAntConfiguration.INSTANCE.get(container); if (container.hasProperty(AntBuildFileImpl.ANT_REFERENCE)) return findAnt(AntBuildFileImpl.ANT_REFERENCE, container); return antConfiguration.getBundledAnt(); }
findAntOrBundled
6,186
void (Element dataElement) { dataElement.setAttribute(NAME_ATTR, myName); }
writeExternal
6,187
String () { return myName; }
getName
6,188
AntInstallation (GlobalAntConfiguration antConfiguration) { return antConfiguration.getConfiguredAnts().get(this); }
find
6,189
AntReference (GlobalAntConfiguration antConfiguration) { AntInstallation antInstallation = find(antConfiguration); if (antInstallation != null) return new BindedReference(antInstallation); return this; }
bind
6,190
AntInstallation (GlobalAntConfiguration antConfiguration) { return myAnt; }
find
6,191
String () { return myAnt.getName(); }
getName
6,192
void (Element dataElement) { dataElement.setAttribute(NAME_ATTR, getName()); }
writeExternal
6,193
AntReference (GlobalAntConfiguration antConfiguration) { return this; }
bind
6,194
void (final Element dataElement) { String url = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, myDir.getAbsolutePath().replace(File.separatorChar, '/')); dataElement.setAttribute(DIR, url); }
writeExternal
6,195
void (final List<? super File> files) { File[] children = myDir.listFiles(FileFilters.filesWithExtension("jar")); if (children != null) ContainerUtil.addAll(files, children); }
addFilesTo
6,196
CellAppearanceEx () { CellAppearanceEx appearance = FileAppearanceService.getInstance().forIoFile(myDir); if (appearance instanceof ModifiableCellAppearanceEx) { ((ModifiableCellAppearanceEx)appearance).setIcon(AllIcons.Nodes.JarDirectory); } return appearance; }
getAppearance
6,197
AntClasspathEntry (final VirtualFile file) { return new AllJarsUnderDirEntry(file.getPath()); }
fromVirtualFile
6,198
KeymapGroup (final Condition<? super AnAction> filtered, Project project) { final KeymapGroup result = KeymapGroupFactory.getInstance().createGroup(AntBundle.message("ant.targets.group.title"), AllIcons.Nodes.KeymapAnt); if (project != null) { final Map<String, KeymapGroup> buildFileNameToGroup = new HashMap<>(); ActionManagerEx actionManager = ActionManagerEx.getInstanceEx(); final String actionIdPrefix = AntConfiguration.getActionIdPrefix(project); List<String> ids = actionManager.getActionIdList(actionIdPrefix); ids.sort(null); for (final String id : ids) { if (filtered != null && !filtered.value(actionManager.getActionOrStub(id))) { continue; } String buildFileName = AntBuildTargetImpl.parseBuildFileName(project, id); if (buildFileName != null) { KeymapGroup subGroup = buildFileNameToGroup.get(buildFileName); if (subGroup == null) { subGroup = KeymapGroupFactory.getInstance().createGroup(buildFileName); buildFileNameToGroup.put(buildFileName, subGroup); result.addGroup(subGroup); } subGroup.addActionId(id); } } } return result; }
createGroup
6,199
String () { return myTargetName; }
getTargetName