Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
20,600
PsiFile () { return myParent.getRelativePath().getValue(); }
resolveBySpecifiedPath
20,601
String (@Nullable String s, ConvertContext context) { return MavenDomBundle.message("dependency.0.not.found", MavenArtifactCoordinatesHelper.getId(context)); }
getErrorMessage
20,602
PsiFile (MavenId id, ConvertContext context) { PsiFile res = super.resolve(id, context); if (res != null) return res; DomElement parent = context.getInvocationElement().getParent(); if (!(parent instanceof MavenDomDependency)) return null; DependencyConflictId dependencyId = DependencyConflictId.create((MavenDomDependency)parent); if (dependencyId == null) return null; MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(context.getProject()); VirtualFile file = getMavenProjectFile(context); MavenProject mavenProject = file == null ? null : projectsManager.findProject(file); if (mavenProject != null) { MavenArtifact artifact = mavenProject.getDependencyArtifactIndex().findArtifacts(dependencyId); if (artifact != null && MavenArtifactUtilKt.resolved(artifact)) { return super.resolve(new MavenId(id.getGroupId(), id.getArtifactId(), artifact.getVersion()), context); } } if (StringUtil.isEmpty(id.getVersion())) { MavenDomDependency managedDependency = MavenDomProjectProcessorUtils.searchManagingDependency((MavenDomDependency)parent); if (managedDependency != null) { final GenericDomValue<String> managedDependencyArtifactId = managedDependency.getArtifactId(); return RecursionManager.doPreventingRecursion(managedDependencyArtifactId, false, () -> { PsiElement res1 = new GenericDomValueReference(managedDependencyArtifactId).resolve(); return res1 instanceof PsiFile ? (PsiFile)res1 : null; }); } } return null; }
resolve
20,603
PsiFile () { return myDependency.getSystemPath().getValue(); }
resolveBySpecifiedPath
20,604
PsiFile (MavenId id, ConvertContext context) { return null; }
resolve
20,605
boolean (MavenId id, MavenIndicesManager manager, ConvertContext context) { return true; }
isValid
20,606
String (@Nullable String s, ConvertContext context) { return myPlugin ? MavenDomBundle.message("plugin.0.not.found", MavenArtifactCoordinatesHelper.getId(context)) : MavenDomBundle.message("build.extension.0.not.found", MavenArtifactCoordinatesHelper.getId(context)); }
getErrorMessage
20,607
boolean (MavenId id, MavenIndicesManager manager, ConvertContext context) { if (StringUtil.isEmpty(id.getGroupId())) { for (String each : MavenArtifactUtil.DEFAULT_GROUPS) { id = new MavenId(each, id.getArtifactId(), id.getVersion()); if (super.isValid(id, manager, context)) return true; } return false; } return super.isValid(id, manager, context); }
isValid
20,608
Set<String> (MavenId id, DependencySearchService searchService, MavenDomShortArtifactCoordinates coordinates) { if (StringUtil.isEmpty(id.getGroupId())) { Set<String> result = new HashSet<>(); for (String each : MavenArtifactUtil.DEFAULT_GROUPS) { id = new MavenId(each, id.getArtifactId(), id.getVersion()); result.addAll(super.getVariants(id, searchService, coordinates)); } return result; } return super.getVariants(id, searchService, coordinates); }
getVariants
20,609
PsiFile (MavenId id, ConvertContext context) { if (StringUtil.isEmpty(id.getGroupId())) { for (String each : MavenArtifactUtil.DEFAULT_GROUPS) { MavenId withGroupId = new MavenId(each, id.getArtifactId(), id.getVersion()); PsiFile res = super.resolve(withGroupId, context); if (res != null) return res; } } PsiFile res = super.resolve(id, context); if (res != null) return res; MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(context.getProject()); if (StringUtil.isEmpty(id.getGroupId())) { for (String each : MavenArtifactUtil.DEFAULT_GROUPS) { MavenId withGroupId = new MavenId(each, id.getArtifactId(), id.getVersion()); res = super.resolve(withGroupId, context); if (res != null) return res; } } res = tryToResolveToImportedPlugins(id, context); if (res != null) return res; // Try to resolve to plugin with latest version PsiManager psiManager = context.getPsiManager(); Path artifactFile = MavenArtifactUtil .getArtifactNioPath(projectsManager.getLocalRepository(), id.getGroupId(), id.getArtifactId(), id.getVersion(), "pom"); VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByNioFile(artifactFile); if (virtualFile != null) { return psiManager.findFile(virtualFile); } return null; }
resolve
20,610
MavenDomConvertersRegistry () { return ApplicationManager.getApplication().getService(MavenDomConvertersRegistry.class); }
getInstance
20,611
void () { myConvertersRegistry.registerDefaultConverters(); myConvertersRegistry.registerConverter(new MavenPathReferenceConverter(), File.class); }
initConverters
20,612
GenericDomValueConvertersRegistry () { return myConvertersRegistry; }
getConvertersRegistry
20,613
boolean (@NotNull String type) { return mySoftConverterTypes.contains(type); }
isSoft
20,614
PsiFile (@Nullable @NonNls String s, ConvertContext context) { throw new UnsupportedOperationException(); }
fromString
20,615
String (@Nullable PsiFile psiFile, ConvertContext context) { VirtualFile file = context.getFile().getOriginalFile().getVirtualFile(); return MavenModulePsiReference.calcRelativeModulePath(file, psiFile.getVirtualFile()); }
toString
20,616
PsiReference (PsiElement element, String text, TextRange range) { return new MavenModulePsiReference(element, text, range); }
createReference
20,617
PsiFile (@Nullable @NonNls String s, ConvertContext context) { if (StringUtil.isEmptyOrSpaces(s)) return null; VirtualFile contextFile = context.getFile().getVirtualFile(); if (contextFile == null) return null; VirtualFile parent = contextFile.getParent(); if (parent == null) { return null; } VirtualFile f = parent.findFileByRelativePath(s); if (f == null) return null; if (f.isDirectory()) f = f.findChild(MavenConstants.POM_XML); if (f == null) return null; return context.getPsiManager().findFile(f); }
fromString
20,618
String (@Nullable PsiFile f, ConvertContext context) { if (f == null) return null; VirtualFile currentFile = context.getFile().getOriginalFile().getVirtualFile(); if (currentFile == null) return null; return MavenDomUtil.calcRelativePath(currentFile.getParent(), f.getVirtualFile()); }
toString
20,619
Collection<PsiFile> (ConvertContext context) { List<PsiFile> result = new ArrayList<>(); PsiFile currentFile = context.getFile().getOriginalFile(); for (DomFileElement<MavenDomProjectModel> each : MavenDomUtil.collectProjectModels(context.getFile().getProject())) { PsiFile file = each.getOriginalFile(); if (file == currentFile) continue; result.add(file); } return result; }
getVariants
20,620
LocalQuickFix[] (ConvertContext context) { return ArrayUtil.append(super.getQuickFixes(context), new RelativePathFix(context)); }
getQuickFixes
20,621
String () { return MavenDomBundle.message("fix.parent.path"); }
getName
20,622
String () { return MavenDomBundle.message("inspection.group"); }
getFamilyName
20,623
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { MavenId id = MavenArtifactCoordinatesHelper.getId(myContext); MavenProjectsManager manager = MavenProjectsManager.getInstance(project); MavenProject parentFile = manager.findProject(id); if (parentFile != null) { VirtualFile currentFile = myContext.getFile().getVirtualFile(); String relativePath = MavenDomUtil.calcRelativePath(currentFile.getParent(), parentFile.getFile()); var xmlTag = (XmlTag)descriptor.getPsiElement(); xmlTag.getValue().setText(relativePath); } }
applyFix
20,624
Collection<String> (@NotNull ConvertContext context) { DomElement element = context.getInvocationElement(); MavenProject project = MavenDomUtil.findContainingProject(element); if (project == null) return Collections.emptyList(); return getValues(context, project); }
getValues
20,625
String (@Nullable @NonNls String s, ConvertContext context) { return s; }
fromString
20,626
String (@Nullable String text, ConvertContext context) { return text; }
toString
20,627
PsiReference (PsiElement element, String text, TextRange range) { return new WebReference(element, range); }
createReference
20,628
Collection<String> (@NotNull ConvertContext context, @NotNull MavenProject project) { return project.getSupportedPackagings(); }
getValues
20,629
String (@Nullable @NonNls String s, ConvertContext context) { if (s != null && s.startsWith(INTERVAL)) return s; return super.fromString(s, context); }
fromString
20,630
Collection<String> (@NotNull ConvertContext context) { return VALUES; }
getValues
20,631
boolean (@NotNull MavenDomShortArtifactCoordinates dependency) { return dependency instanceof MavenDomPlugin; }
isPlugin
20,632
MavenDomPlugin (MavenDomProjectModel domModel, Project project, @NotNull final String groupId, @NotNull final String artifactId) { final Ref<MavenDomPlugin> ref = new Ref<>(); MavenDomProjectProcessorUtils.processPluginsInPluginManagement(domModel, plugin -> { if (groupId.equals(plugin.getGroupId().getStringValue()) && artifactId.equals(plugin.getArtifactId().getStringValue()) && null != plugin.getVersion().getStringValue()) { ref.set(plugin); return true; } return false; }, project); return ref.get(); }
findManagedPlugin
20,633
MavenDomDependency (MavenDomProjectModel domModel, Project project, @NotNull final String groupId, @NotNull final String artifactId) { final Ref<MavenDomDependency> ref = new Ref<>(); MavenDomProjectProcessorUtils.processDependenciesInDependencyManagement(domModel, dependency -> { if (groupId.equals(dependency.getGroupId().getStringValue()) && artifactId.equals( dependency.getArtifactId().getStringValue())) { ref.set(dependency); return true; } return false; }, project); return ref.get(); }
findManagedDependency
20,634
boolean (@NotNull MavenDomShortArtifactCoordinates dependency) { DomElement parent = dependency.getParent(); if (!(parent instanceof MavenDomDependencies)) return false; return parent.getParent() instanceof MavenDomDependencyManagement; }
isInsideManagedDependency
20,635
void (@NotNull final InsertionContext context, final CompletionType completionType) { context.setLaterRunnable( () -> new CodeCompletionHandlerBase(completionType).invokeCompletion(context.getProject(), context.getEditor())); }
invokeCompletion
20,636
LookupElementBuilder (MavenDependencyCompletionItem item, String lookup) { return LookupElementBuilder.create(item, lookup) .withIcon(getIcon(item.getType())); }
lookupElement
20,637
MavenDependencyCompletionItem (MavenArtifactSearchResult searchResult) { return Collections.max(Arrays.asList(searchResult.getSearchResults().getItems()), Comparator.comparing(r -> { if (r.getType() == null) { return Integer.MIN_VALUE; } return r.getType().getWeight(); })); }
getMaxIcon
20,638
LookupElementBuilder (MavenRepositoryArtifactInfo info) { return lookupElement(info, getPresentableText(info)); }
lookupElement
20,639
LookupElementBuilder (MavenRepositoryArtifactInfo info, String presentableText) { LookupElementBuilder elementBuilder = LookupElementBuilder.create(info, getLookupString(info)) .withPresentableText(presentableText); elementBuilder.putUserData(BaseCompletionLookupArranger.FORCE_MIDDLE_MATCH, new Object()); if (info.getItems().length == 1) { return elementBuilder.withIcon(getIcon(info.getItems()[0].getType())); } return elementBuilder; }
lookupElement
20,640
String (MavenRepositoryArtifactInfo info) { if (info.getItems().length == 1) { return getLookupString(info.getItems()[0]); } return IndicesBundle.message("maven.dependency.completion.presentable", info.getGroupId(), info.getArtifactId()); }
getPresentableText
20,641
Icon (@Nullable MavenDependencyCompletionItem.Type type) { if (type == PROJECT) { return AllIcons.Nodes.Module; } return null; }
getIcon
20,642
String (MavenRepositoryArtifactInfo info) { MavenDependencyCompletionItem[] infoItems = info.getItems(); if (infoItems.length > 0) { return getLookupString(infoItems[0]); } return info.getGroupId() + ":" + info.getArtifactId(); }
getLookupString
20,643
String (MavenDependencyCompletionItem description) { StringBuilder builder = new StringBuilder(description.getGroupId()); if (description.getArtifactId() == null) { builder.append(":..."); } else { builder.append(":").append(description.getArtifactId()); if (description.getPackaging() != null) { builder.append(":").append(description.getPackaging()); } if (description.getVersion() != null) { builder.append(":").append(description.getVersion()); } else { builder.append(":..."); } } return builder.toString(); }
getLookupString
20,644
PsiFile (@Nullable @NonNls String s, ConvertContext context) { if (s == null) return null; VirtualFile f = LocalFileSystem.getInstance().findFileByPath(s); if (f == null) return null; return context.getPsiManager().findFile(f); }
fromString
20,645
String (@Nullable PsiFile file, ConvertContext context) { if (file == null) return null; return file.getVirtualFile().getPath(); }
toString
20,646
Collection<PsiFile> (ConvertContext context) { return Collections.emptyList(); }
getVariants
20,647
Collection<String> (@NotNull ConvertContext context, @NotNull MavenProject project) { Set<String> scopes = project.getSupportedDependencyScopes(); boolean isDependencyManagement = context.getInvocationElement().getParentOfType(MavenDomDependencyManagement.class, false) != null; if (isDependencyManagement) scopes.add(MavenConstants.SCOPE_IMPORT); return scopes; }
getValues
20,648
boolean (MavenId id, MavenIndicesManager manager, ConvertContext context) { if (StringUtil.isEmpty(id.getGroupId()) || StringUtil.isEmpty(id.getArtifactId())) return false; MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(context.getProject()); if (StringUtil.isNotEmpty(id.getVersion())) { if (projectsManager.findProject(id) != null) return true; } else { for (MavenProject project : projectsManager.getProjects()) { MavenId mavenId = project.getMavenId(); if (id.getGroupId().equals(mavenId.getGroupId()) && id.getArtifactId().equals(mavenId.getArtifactId())) return true; } } // Check if artifact was found on importing. VirtualFile projectFile = getMavenProjectFile(context); MavenProject mavenProject = projectFile == null ? null : projectsManager.findProject(projectFile); if (mavenProject != null) { for (MavenArtifact artifact : mavenProject.findDependencies(id.getGroupId(), id.getArtifactId())) { if (MavenArtifactUtilKt.resolved(artifact)) { return true; } } } return manager.hasLocalArtifactId(id.getGroupId(), id.getArtifactId()); }
doIsValid
20,649
Set<String> (MavenId id, DependencySearchService searchService) { return Collections.emptySet(); }
doGetVariants
20,650
String (@Nullable @NonNls String s, ConvertContext context) { return getVariants(context).contains(s) ? s : null; }
fromString
20,651
String (@Nullable String s, ConvertContext context) { return s; }
toString
20,652
Collection<String> (ConvertContext context) { MavenDomPluginModel model = MavenPluginDomUtil.getMavenPluginModel(context.getInvocationElement()); if (model == null) return Collections.emptyList(); List<String> result = new ArrayList<>(); for (MavenDomMojo each : model.getMojos().getMojos()) { String goal = each.getGoal().getStringValue(); if (goal != null) result.add(goal); } return result; }
getVariants
20,653
PsiElement (String text, ConvertContext context) { MavenDomPluginModel model = MavenPluginDomUtil.getMavenPluginModel(context.getInvocationElement()); if (model == null) return null; for (MavenDomMojo each : model.getMojos().getMojos()) { String goal = each.getGoal().getStringValue(); if (text.equals(goal)) return each.getXmlElement(); } return super.resolve(text, context); }
resolve
20,654
boolean (@NotNull DomElement element) { return MavenPluginDomUtil.getMavenPluginModel(element) == null; }
isSoft
20,655
Collection<String> (@NotNull ConvertContext context) { return VALUES; }
getValues
20,656
String (@Nullable String s, ConvertContext context) { return MavenDomBundle.message("inspection.message.unsupported.model.version.only.version.supported", VERSION); }
getErrorMessage
20,657
Collection<String> (@NotNull ConvertContext context) { return VALUES; }
getValues
20,658
Collection<String> (@NotNull ConvertContext context) { return Arrays.asList("append", "override"); }
getValues
20,659
Collection<String> (@NotNull ConvertContext context) { return VALUES; }
getValues
20,660
boolean (MavenId id, MavenIndicesManager manager, ConvertContext context) { if (StringUtil.isEmpty(id.getGroupId())) return false; MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(context.getProject()); if (StringUtil.isNotEmpty(id.getArtifactId()) && StringUtil.isNotEmpty(id.getVersion())) { if (projectsManager.findProject(id) != null) return true; } else { for (MavenProject project : projectsManager.getProjects()) { if (id.getGroupId().equals(project.getMavenId().getGroupId())) return true; } } // Check if artifact was found on importing. VirtualFile projectFile = getMavenProjectFile(context); MavenProject mavenProject = projectFile == null ? null : projectsManager.findProject(projectFile); if (mavenProject != null) { for (MavenArtifact artifact : mavenProject.findDependencies(id.getGroupId(), id.getArtifactId())) { if (MavenArtifactUtilKt.resolved(artifact)) { return true; } } } return manager.hasLocalGroupId(id.getGroupId()); }
doIsValid
20,661
Set<String> (MavenId id, DependencySearchService searchService) { return Collections.emptySet(); }
doGetVariants
20,662
Collection<String> (ConvertContext convertContext) { return Collections.emptySet(); }
getSmartVariants
20,663
String (@Nullable @NonNls String s, ConvertContext context) { if (!myStrict) return s; return getValues(context).contains(s) ? s : null; }
fromString
20,664
String (@Nullable String s, ConvertContext context) { return s; }
toString
20,665
Collection<String> (ConvertContext context) { return getValues(context); }
getVariants
20,666
String (@Nullable String s, ConvertContext context) { return new HtmlBuilder() .append(MavenDomBundle.message("specified.value.is.not.acceptable.here")) .append(HtmlChunk.br()) .append(MavenDomBundle.message("acceptable.values")) .appendWithSeparators(HtmlChunk.text(", "), ContainerUtil.map(getValues(context), it -> HtmlChunk.text(it))) .toString(); }
getErrorMessage
20,667
Collection<String> (@NotNull ConvertContext context) { return VALUES; }
getValues
20,668
Collection<String> (@NotNull ConvertContext context, @NotNull MavenProject project) { Set<String> res = new LinkedHashSet<>(MavenProjectsManager.getInstance(context.getProject()).getImportingSettings().getDependencyTypesAsSet()); res.add(MavenConstants.TYPE_POM); res.addAll(project.getDependencyTypesFromImporters(SupportedRequestType.FOR_COMPLETION)); return res; }
getValues
20,669
MavenRepositoriesProvider () { return ApplicationManager.getApplication().getService(MavenRepositoriesProvider.class); }
getInstance
20,670
void (@NotNull String id, RepositoryBeanInfo info) { myRepositoriesMap.put(id, info); }
registerRepository
20,671
Set<String> () { return myRepositoriesMap.keySet(); }
getRepositoryIds
20,672
String (@Nullable String id) { RepositoryBeanInfo pair = myRepositoriesMap.get(id); return pair != null ? pair.getName() : null; }
getRepositoryName
20,673
String (@Nullable String id) { RepositoryBeanInfo pair = myRepositoriesMap.get(id); return pair != null ? pair.getUrl() : null; }
getRepositoryUrl
20,674
Collection<String> (final ConvertContext context) { Module module = context.getModule(); if (module != null) { return MavenRepositoriesProvider.getInstance().getRepositoryIds(); } return Collections.emptySet(); }
getVariants
20,675
LookupElement (String s) { return LookupElementBuilder.create(s) .withIcon(MavenIcons.MavenPlugin) .withTailText(" (" + MavenRepositoriesProvider.getInstance().getRepositoryUrl(s) + ")", true); }
createLookupElement
20,676
Collection<String> (final ConvertContext context) { Module module = context.getModule(); if (module != null) { String name = MavenRepositoriesProvider.getInstance().getRepositoryName(getRepositoryId(context)); if (!StringUtil.isEmptyOrSpaces(name)) return Collections.singleton(name); } return Collections.emptySet(); }
getVariants
20,677
String (ConvertContext context) { MavenDomRepositoryBase repository = context.getInvocationElement().getParentOfType(MavenDomRepositoryBase.class, false); if (repository != null) return repository.getId().getStringValue(); return null; }
getRepositoryId
20,678
String (@Nullable @NonNls final String s, final ConvertContext context) { return s; }
fromString
20,679
String (@Nullable String s, ConvertContext convertContext) { return s; }
toString
20,680
String () { return myId; }
getId
20,681
String () { return myName; }
getName
20,682
String () { return myUrl; }
getUrl
20,683
RepositoryBeanInfo[] () { return myRepositories; }
getRepositories
20,684
List<String> (@NotNull Project project) { MavenProjectsManager manager = MavenProjectsManager.getInstance(project); if (!manager.isMavenizedProject()) return Collections.emptyList(); if (MavenVersionSupportUtil.isMaven2Used(project)) return Collections.singletonList("maven2"); return Collections.emptyList(); }
collectDependencies
20,685
String () { return "-" + key; }
getKey
20,686
String () { return "--" + longKey; }
getLongKey
20,687
boolean (@NotNull MavenConfigSettings configSetting) { return optionMap.containsKey(configSetting.key); }
hasOption
20,688
String (@NotNull MavenConfigSettings configSetting) { Option option = optionMap.get(configSetting.key); return option == null ? null : option.getValue(); }
getOptionValue
20,689
boolean () { return optionMap.isEmpty(); }
isEmpty
20,690
MavenConfig (@NotNull String baseDir) { Options options = new Options(); for (MavenConfigSettings value : MavenConfigSettings.values()) { options.addOption(value.toOption()); } File configFile = new File(baseDir, MavenConstants.MAVEN_CONFIG_RELATIVE_PATH); List<String> configArgs = new ArrayList<>(); try { if (configFile.isFile()) { for (String arg : Files.readString(configFile.toPath(), Charset.defaultCharset()).split("\\s+")) { if (!arg.isEmpty()) { configArgs.add(arg); } } String[] cleanArgs = CleanArgument.cleanArgs(ArrayUtil.toStringArray(configArgs)); CommandLineParser parser = new GnuParser(); CommandLine parse = parser.parse(options, cleanArgs, true); return new MavenConfig(Arrays.stream(parse.getOptions()).collect(Collectors.toMap(o -> o.getOpt(), Function.identity())), baseDir); } } catch (Exception e) { MavenLog.LOG.error("error read maven config " + configFile.getAbsolutePath(), e); } return null; }
parse
20,691
String[] (String[] args) { List<String> cleaned = new ArrayList<>(); StringBuilder currentArg = null; for (String arg : args) { boolean addedToBuffer = false; if (arg.startsWith("\"")) { if (currentArg != null) { cleaned.add(currentArg.toString()); } currentArg = new StringBuilder(arg.substring(1)); addedToBuffer = true; } if (addedToBuffer && arg.endsWith("\"")) { currentArg.setLength(currentArg.length() - 1); cleaned.add(currentArg.toString()); currentArg = null; continue; } if (!addedToBuffer) { if (currentArg != null) { currentArg.append(' ').append(arg); } else { cleaned.add(arg); } } } if (currentArg != null) { cleaned.add(currentArg.toString()); } int cleanedSz = cleaned.size(); String[] cleanArgs; if (cleanedSz == 0) { cleanArgs = args; } else { cleanArgs = ArrayUtil.toStringArray(cleaned); } return cleanArgs; }
cleanArgs
20,692
boolean (@NotNull Module module) { return MavenUtil.isMavenizedModule(module); }
isApplicable
20,693
OrderEnumerationHandler (@NotNull Module module) { return INSTANCE; }
createHandler
20,694
boolean () { return true; }
shouldAddRuntimeDependenciesToTestCompilationClasspath
20,695
boolean () { return false; }
shouldIncludeTestsFromDependentModulesToTestClasspath
20,696
boolean () { return false; }
shouldProcessDependenciesRecursively
20,697
boolean () { return false; }
areResourceFilesFromSourceRootsCopiedToOutput
20,698
boolean () { MavenRunnerSettings s = new MavenRunnerSettings(); setData(s); return !s.equals(getState()); }
isModified
20,699
void () { getData(getState()); }
reset