Unnamed: 0
int64 0
305k
| body
stringlengths 7
52.9k
| name
stringlengths 1
185
|
|---|---|---|
19,700
|
void (boolean entering, @NotNull Object modalEntity) { if (entering) { suspend(); } else { resume(); } }
|
beforeModalityStateChanged
|
19,701
|
void () { if (mySuspendCounter.incrementAndGet() == 1) { super.suspend(); } }
|
suspend
|
19,702
|
void () { int c = mySuspendCounter.decrementAndGet(); if (c <= 0) { if (c < 0) { mySuspendCounter.set(0); // todo ask build team to investigate why MavenSetupProjectTest `test project import` failed with that error if (!ApplicationManager.getApplication().isUnitTestMode()) { LOG.warn("Invalid suspend counter state", new Exception()); } } super.resume(); } }
|
resume
|
19,703
|
List<VirtualFile> (Project project) { return MavenProjectsManager.getInstance(project).getGeneralSettings().getEffectiveSettingsFiles(); }
|
getSettingsFiles
|
19,704
|
boolean (Collection<MavenProject> mavenProjects) { Iterator<MavenProject> itr = mavenProjects.iterator(); if (!itr.hasNext()) return true; String groupId = itr.next().getMavenId().getGroupId(); while (itr.hasNext()) { MavenProject mavenProject = itr.next(); if (!Objects.equals(groupId, mavenProject.getMavenId().getGroupId())) { return false; } } return true; }
|
allGroupsEqual
|
19,705
|
boolean (Collection<MavenProject> mavenProjects) { Set<String> exitingGroups = new HashSet<>(); for (MavenProject mavenProject : mavenProjects) { if (!exitingGroups.add(mavenProject.getMavenId().getGroupId())) { return false; } } return true; }
|
allGroupsAreDifferent
|
19,706
|
void (MavenProjectsManager manager, Map<MavenProject, Integer> res, List<MavenProject> rootProjects, int depth) { MavenProject[] rootProjectArray = rootProjects.toArray(new MavenProject[0]); Arrays.sort(rootProjectArray, new MavenProjectComparator()); for (MavenProject project : rootProjectArray) { if (!res.containsKey(project)) { res.put(project, depth); doBuildProjectTree(manager, res, manager.getModules(project), depth + 1); } } }
|
doBuildProjectTree
|
19,707
|
int (MavenProject o1, MavenProject o2) { MavenId id1 = o1.getMavenId(); MavenId id2 = o2.getMavenId(); int res = Comparing.compare(id1.getGroupId(), id2.getGroupId()); if (res != 0) return res; res = Comparing.compare(id1.getArtifactId(), id2.getArtifactId()); if (res != 0) return res; res = Comparing.compare(id1.getVersion(), id2.getVersion()); return res; }
|
compare
|
19,708
|
void (@NotNull Project project, @NotNull MavenProjectsManager projectsManager) { project.getService(MavenHighlightingUpdater.class).install(projectsManager); }
|
install
|
19,709
|
void (@NotNull Project project) { project.getService(MavenHighlightingUpdater.class).schedule(null); }
|
rehighlight
|
19,710
|
boolean (@NotNull VirtualFile f) { try { if (null != indicator) { indicator.checkCanceled(); indicator.setText2(f.getPresentableUrl()); } if (f.isDirectory()) { if (lookForNested) { f.refresh(false, false); } else { return false; } } else { if (MavenUtil.isPomFile(f)) { result.add(Pair.create(f.getParent(), f)); } } } catch (InvalidVirtualFileAccessException e) { // we are accessing VFS without read action here so such exception may occasionally occur MavenLog.LOG.info(e); } return true; }
|
visitFile
|
19,711
|
List<VirtualFile> (@NotNull List<VirtualFile> pomFiles) { if (pomFiles.size() < 2) return pomFiles; List<VirtualFile> originalPoms = new ArrayList<>(); for (VirtualFile file : pomFiles) { if (file.getName().equals(MavenConstants.POM_XML)) { return Collections.singletonList(file); } if (MavenUtil.isPomFileName(file.getName())) { originalPoms.add(file); } } return originalPoms.isEmpty() ? pomFiles : originalPoms; }
|
getOriginalPoms
|
19,712
|
Element (final VirtualFile file, @Nullable final ErrorHandler handler) { Application app = ApplicationManager.getApplication(); if (app == null || app.isDisposed()) { return null; } String text = ReadAction.compute(() -> { if (!file.isValid()) return null; try { return VfsUtilCore.loadText(file); } catch (IOException e) { if (handler != null) handler.onReadError(e); return null; } }); return text == null ? null : doRead(text, handler); }
|
read
|
19,713
|
Element (byte[] bytes, @Nullable ErrorHandler handler) { return doRead(CharsetToolkit.bytesToString(bytes, EncodingRegistry.getInstance().getDefaultCharset()), handler); }
|
read
|
19,714
|
Element (String text, final ErrorHandler handler) { final LinkedList<Element> stack = new LinkedList<>(); final Element[] result = {null}; XmlBuilderDriver driver = new XmlBuilderDriver(text); XmlBuilder builder = new XmlBuilder() { @Override public void doctype(@Nullable CharSequence publicId, @Nullable CharSequence systemId, int startOffset, int endOffset) { } @Override public ProcessingOrder startTag(CharSequence localName, String namespace, int startoffset, int endoffset, int headerEndOffset) { String name = localName.toString(); if (StringUtil.isEmptyOrSpaces(name)) return ProcessingOrder.TAGS; Element newElement; try { newElement = new Element(name); } catch (IllegalNameException e) { newElement = new Element("invalidName"); } Element parent = stack.isEmpty() ? null : stack.getLast(); if (parent == null) { result[0] = newElement; } else { parent.addContent(newElement); } stack.addLast(newElement); return ProcessingOrder.TAGS_AND_TEXTS; } @Override public void endTag(CharSequence localName, String namespace, int startoffset, int endoffset) { String name = localName.toString(); if (StringUtil.isEmptyOrSpaces(name)) return; for (Iterator<Element> itr = stack.descendingIterator(); itr.hasNext(); ) { Element element = itr.next(); if (element.getName().equals(name)) { while (stack.removeLast() != element) {} break; } } } @Override public void textElement(CharSequence text, CharSequence physical, int startoffset, int endoffset) { stack.getLast().addContent(JDOMUtil.legalizeText(text.toString())); } @Override public void attribute(CharSequence name, CharSequence value, int startoffset, int endoffset) { } @Override public void entityRef(CharSequence ref, int startOffset, int endOffset) { } @Override public void error(@NotNull String message, int startOffset, int endOffset) { if (handler != null) handler.onSyntaxError(); } }; driver.build(builder); return result[0]; }
|
doRead
|
19,715
|
void (@Nullable CharSequence publicId, @Nullable CharSequence systemId, int startOffset, int endOffset) { }
|
doctype
|
19,716
|
ProcessingOrder (CharSequence localName, String namespace, int startoffset, int endoffset, int headerEndOffset) { String name = localName.toString(); if (StringUtil.isEmptyOrSpaces(name)) return ProcessingOrder.TAGS; Element newElement; try { newElement = new Element(name); } catch (IllegalNameException e) { newElement = new Element("invalidName"); } Element parent = stack.isEmpty() ? null : stack.getLast(); if (parent == null) { result[0] = newElement; } else { parent.addContent(newElement); } stack.addLast(newElement); return ProcessingOrder.TAGS_AND_TEXTS; }
|
startTag
|
19,717
|
void (CharSequence localName, String namespace, int startoffset, int endoffset) { String name = localName.toString(); if (StringUtil.isEmptyOrSpaces(name)) return; for (Iterator<Element> itr = stack.descendingIterator(); itr.hasNext(); ) { Element element = itr.next(); if (element.getName().equals(name)) { while (stack.removeLast() != element) {} break; } } }
|
endTag
|
19,718
|
void (CharSequence text, CharSequence physical, int startoffset, int endoffset) { stack.getLast().addContent(JDOMUtil.legalizeText(text.toString())); }
|
textElement
|
19,719
|
void (CharSequence name, CharSequence value, int startoffset, int endoffset) { }
|
attribute
|
19,720
|
void (CharSequence ref, int startOffset, int endOffset) { }
|
entityRef
|
19,721
|
void (@NotNull String message, int startOffset, int endOffset) { if (handler != null) handler.onSyntaxError(); }
|
error
|
19,722
|
Element (@Nullable Element element, String path) { int i = 0; while (element != null) { int dot = path.indexOf('.', i); if (dot == -1) { return element.getChild(path.substring(i)); } element = element.getChild(path.substring(i, dot)); i = dot + 1; } return null; }
|
findChildByPath
|
19,723
|
String (@Nullable Element element, String path, String defaultValue) { Element child = findChildByPath(element, path); if (child == null) return defaultValue; String childValue = child.getTextTrim(); return childValue.isEmpty() ? defaultValue : childValue; }
|
findChildValueByPath
|
19,724
|
String (@Nullable Element element, String path) { return findChildValueByPath(element, path, null); }
|
findChildValueByPath
|
19,725
|
boolean (@Nullable Element element, String path) { return findChildByPath(element, path) != null; }
|
hasChildByPath
|
19,726
|
List<Element> (@Nullable Element element, String path, String subPath) { return collectChildren(findChildByPath(element, path), subPath); }
|
findChildrenByPath
|
19,727
|
List<String> (@Nullable Element element, String path, String childrenName) { List<String> result = new ArrayList<>(); for (Element each : findChildrenByPath(element, path, childrenName)) { String value = each.getTextTrim(); if (!value.isEmpty()) { result.add(value); } } return result; }
|
findChildrenValuesByPath
|
19,728
|
List<Element> (@Nullable Element container, String subPath) { if (container == null) return Collections.emptyList(); int firstDot = subPath.indexOf('.'); if (firstDot == -1) { return container.getChildren(subPath); } String childName = subPath.substring(0, firstDot); String pathInChild = subPath.substring(firstDot + 1); List<Element> result = new ArrayList<>(); for (Element each : container.getChildren(childName)) { Element child = findChildByPath(each, pathInChild); if (child != null) result.add(child); } return result; }
|
collectChildren
|
19,729
|
FileTemplateGroupDescriptor () { FileTemplateGroupDescriptor group = new FileTemplateGroupDescriptor("Maven", RepositoryLibraryLogo); //NON-NLS group.addTemplate(new FileTemplateDescriptor(MAVEN_PROJECT_XML_TEMPLATE, RepositoryLibraryLogo)); group.addTemplate(new FileTemplateDescriptor(MAVEN_SETTINGS_XML_TEMPLATE, RepositoryLibraryLogo)); return group; }
|
getFileTemplatesDescriptor
|
19,730
|
boolean () { return !appendModuleName || canRealModuleNameBeHidden(); }
|
shouldShowModuleName
|
19,731
|
void (@NotNull PresentationData data) { super.updateImpl(data); if (appendModuleName) { if (!canRealModuleNameBeHidden()) { data.addText("[" + myModuleShortName + "]", REGULAR_BOLD_ATTRIBUTES); } } else { List<ColoredFragment> fragments = data.getColoredText(); ColoredFragment fragment = fragments.iterator().next(); data.clearText(); data.addText(fragment.getText().trim(), merge(fragment.getAttributes(), REGULAR_BOLD_ATTRIBUTES)); } }
|
updateImpl
|
19,732
|
boolean (@NotNull PsiFile psiFile) { VirtualFile virtualFile = psiFile.getOriginalFile().getVirtualFile(); do { if (virtualFile == null) return true; if (virtualFile.getName().equals("archetype-resources")) { if (virtualFile.getPath().endsWith("src/main/resources/archetype-resources")) { return false; } } virtualFile = virtualFile.getParent(); } while (true); }
|
shouldHighlight
|
19,733
|
MavenPluginInfo (File localRepository, MavenId mavenId) { Path file = getArtifactNioPath(localRepository, mavenId.getGroupId(), mavenId.getArtifactId(), mavenId.getVersion(), "jar"); MavenPluginInfo result = ourPluginInfoCache.get(file); if (result == null) { result = createPluginDocument(file); ourPluginInfoCache.put(file, result); } return result; }
|
readPluginInfo
|
19,734
|
boolean (File localRepository, MavenId id) { return hasArtifactFile(localRepository, id, "jar"); }
|
hasArtifactFile
|
19,735
|
boolean (File localRepository, MavenId id, String type) { return Files.exists(getArtifactFile(localRepository, id, type)); }
|
hasArtifactFile
|
19,736
|
Path (File localRepository, MavenId id, String type) { return getArtifactNioPath(localRepository, id.getGroupId(), id.getArtifactId(), id.getVersion(), type); }
|
getArtifactFile
|
19,737
|
Path (File localRepository, MavenId id) { return getArtifactNioPath(localRepository, id.getGroupId(), id.getArtifactId(), id.getVersion(), "pom"); }
|
getArtifactFile
|
19,738
|
boolean (@Nullable String groupId1, @Nullable String artifactId1, @Nullable String groupId2, @Nullable String artifactId2) { if (artifactId1 == null) return false; if (!artifactId1.equals(artifactId2)) return false; if (groupId1 != null) { for (String group : DEFAULT_GROUPS) { if (groupId1.equals(group)) { groupId1 = null; break; } } } if (groupId2 != null) { for (String group : DEFAULT_GROUPS) { if (groupId2.equals(group)) { groupId2 = null; break; } } } return Objects.equals(groupId1, groupId2); }
|
isPluginIdEquals
|
19,739
|
Path (File localRepository, String groupId, String artifactId, String version, String type) { Path dir = null; if (StringUtil.isEmpty(groupId)) { for (String each : DEFAULT_GROUPS) { dir = getArtifactDirectory(localRepository, each, artifactId); if (Files.exists(dir)) break; } } else { dir = getArtifactDirectory(localRepository, groupId, artifactId); } version = sanitizeFileName(version); if (StringUtil.isEmpty(version)) version = resolveVersion(dir); return dir.resolve(version).resolve(artifactId + "-" + version + "." + type); }
|
getArtifactNioPath
|
19,740
|
String (String name) { if (null == name) return ""; return Sanitize_nameKt.sanitizeFileName(name, null, false, null); }
|
sanitizeFileName
|
19,741
|
Path (File localRepository, String groupId, String artifactId) { String relativePath = StringUtil.replace(groupId, ".", File.separator) + File.separator + artifactId; return localRepository.toPath().resolve(relativePath); }
|
getArtifactDirectory
|
19,742
|
String (Path pluginDir) { List<String> versions = new ArrayList<>(); try (Stream<Path> children = Files.list(pluginDir)) { children.forEach(path -> { if (Files.isDirectory(path)) { versions.add(path.getFileName().toString()); } }); } catch (NoSuchFileException e) { return ""; } catch (Exception e) { MavenLog.LOG.warn(e.getMessage()); return ""; } if (versions.isEmpty()) return ""; Collections.sort(versions); return versions.get(versions.size() - 1); }
|
resolveVersion
|
19,743
|
MavenPluginInfo (Path file) { try { if (!Files.exists(file)) return null; try (ZipFile jar = new ZipFile(file.toFile())) { ZipEntry entry = jar.getEntry(MAVEN_PLUGIN_DESCRIPTOR); if (entry == null) { MavenLog.LOG.info(IndicesBundle.message("repository.plugin.corrupt", file)); return null; } try (InputStream is = jar.getInputStream(entry)) { byte[] bytes = FileUtil.loadBytes(is); return new MavenPluginInfo(bytes); } } } catch (IOException e) { MavenLog.LOG.info(e); return null; } }
|
createPluginDocument
|
19,744
|
Icon (@NotNull VirtualFile file, @Iconable.IconFlags int flags, @Nullable Project project) { if (project == null) return null; MavenProject mavenProject = MavenProjectsManager.getInstance(project).findProject(file); if (mavenProject != null) { if (MavenProjectsManager.getInstance(project).isIgnored(mavenProject)) { return MavenIcons.MavenIgnored; } return RepositoryLibraryLogo; } return null; }
|
getIcon
|
19,745
|
List<String> (final String string, final String delim) { final List<String> tokens = new ArrayList<>(); for (StringTokenizer tokenizer = new StringTokenizer(string, delim); tokenizer.hasMoreTokens(); ) { tokens.add(tokenizer.nextToken()); } return tokens; }
|
tokenize
|
19,746
|
String (final Collection<String> list, final char delim) { final StringBuilder buffer = new StringBuilder(); for (String goal : list) { if (buffer.length() != 0) { buffer.append(delim); } buffer.append(goal); } return buffer.toString(); }
|
detokenize
|
19,747
|
String (final Collection<String> masks) { final StringBuilder patterns = new StringBuilder(); for (String mask : masks) { if (patterns.length() != 0) { patterns.append('|'); } patterns.append(PatternUtil.convertToRegex(mask)); } return patterns.toString(); }
|
translateMasks
|
19,748
|
void (String text) { myText = text; }
|
setText
|
19,749
|
String () { return myText; }
|
getText
|
19,750
|
void (String text) { myText2 = text; }
|
setText2
|
19,751
|
String () { return myText2; }
|
getText2
|
19,752
|
void (double fraction) { myFraction = fraction; }
|
setFraction
|
19,753
|
double () { return myFraction; }
|
getFraction
|
19,754
|
void (@Nullable ProgressIndicator indicator) { if (myProject == null) return; // should we also wait for non-project process like MavenIndicesManager activities? if (indicator instanceof ProgressIndicatorEx) { myProject.getService(MavenProgressTracker.class).add(indicator); ((ProgressIndicatorEx)indicator).addStateDelegate(new AbstractProgressIndicatorExBase() { @Override public void start() { myProject.getService(MavenProgressTracker.class).add(indicator); } @Override public void stop() { myProject.getService(MavenProgressTracker.class).remove(indicator); } @Override public void cancel() { try { myProject.getService(MavenProgressTracker.class).remove(indicator); } catch (AlreadyDisposedException ignore) { } } }); } }
|
maybeTrackIndicator
|
19,755
|
void () { myProject.getService(MavenProgressTracker.class).add(indicator); }
|
start
|
19,756
|
void () { myProject.getService(MavenProgressTracker.class).remove(indicator); }
|
stop
|
19,757
|
void () { try { myProject.getService(MavenProgressTracker.class).remove(indicator); } catch (AlreadyDisposedException ignore) { } }
|
cancel
|
19,758
|
void () { while (hasMavenProgressRunning()) { final Object lock = new Object(); synchronized (lock) { try { lock.wait(100); } catch (InterruptedException ignore) { } } } }
|
waitForProgressCompletion
|
19,759
|
void () { synchronized (myLock) { if (!myIndicators.isEmpty()) { throw new AssertionError("Not finished tasks:\n" + StringUtil.join(myIndicators, ProgressIndicator::getText, "\n-----")); } } }
|
assertProgressTasksCompleted
|
19,760
|
void (@Nullable ProgressIndicator indicator) { synchronized (myLock) { myIndicators.add(indicator); } }
|
add
|
19,761
|
void (@Nullable ProgressIndicator indicator) { synchronized (myLock) { myIndicators.remove(indicator); } }
|
remove
|
19,762
|
boolean () { synchronized (myLock) { myIndicators.removeIf(indicator -> !indicator.isRunning()); return !myIndicators.isEmpty(); } }
|
hasMavenProgressRunning
|
19,763
|
void () { synchronized (myLock) { myIndicators.clear(); } }
|
dispose
|
19,764
|
boolean (@NotNull Project project, @NotNull VirtualFile file) { return FileTypeRegistry.getInstance().isFileOfType(file, XmlFileType.INSTANCE) && FileUtil.namesEqual(file.getName(), MavenConstants.POM_XML); }
|
describes
|
19,765
|
boolean () { return Registry.is("maven.preimport.project") && !ApplicationManager.getApplication().isUnitTestMode() && !ApplicationManager.getApplication().isHeadlessEnvironment(); }
|
enablePreimport
|
19,766
|
boolean () { return Registry.is("maven.preimport.only"); }
|
enablePreimportOnly
|
19,767
|
void (Project p, Runnable r) { invokeLater(p, ModalityState.defaultModalityState(), r); }
|
invokeLater
|
19,768
|
void (final Project p, final ModalityState state, final Runnable r) { startTestRunnable(r); ApplicationManager.getApplication().invokeLater(() -> { runAndFinishTestRunnable(r); }, state, p.getDisposed()); }
|
invokeLater
|
19,769
|
void (Runnable r) { if (!ApplicationManager.getApplication().isUnitTestMode()) return; synchronized (runnables) { runnables.add(r); } }
|
startTestRunnable
|
19,770
|
void (Runnable r) { if (!ApplicationManager.getApplication().isUnitTestMode()) { r.run(); return; } try { r.run(); } finally { synchronized (runnables) { runnables.remove(r); } } }
|
runAndFinishTestRunnable
|
19,771
|
boolean () { synchronized (runnables) { return runnables.isEmpty(); } }
|
noUncompletedRunnables
|
19,772
|
void () { synchronized (runnables) { runnables.clear(); } }
|
cleanAllRunnables
|
19,773
|
List<Runnable> () { List<Runnable> result; synchronized (runnables) { result = new ArrayList<>(runnables); } return result; }
|
getUncompletedRunnables
|
19,774
|
void (@NotNull Project p, @NotNull Runnable r) { invokeAndWait(p, ModalityState.defaultModalityState(), r); }
|
invokeAndWait
|
19,775
|
void (final Project p, final ModalityState state, @NotNull Runnable r) { startTestRunnable(r); ApplicationManager.getApplication().invokeAndWait(DisposeAwareRunnable.create(() -> runAndFinishTestRunnable(r), p), state); }
|
invokeAndWait
|
19,776
|
void (@NotNull Project p, @NotNull Runnable r) { startTestRunnable(r); if (ApplicationManager.getApplication().isWriteAccessAllowed()) { runAndFinishTestRunnable(r); } else if (ApplicationManager.getApplication().isDispatchThread()) { ApplicationManager.getApplication().runWriteAction(r); } else { ApplicationManager.getApplication().invokeAndWait(DisposeAwareRunnable.create( () -> ApplicationManager.getApplication().runWriteAction(() -> runAndFinishTestRunnable(r)), p), ModalityState.defaultModalityState()); } }
|
invokeAndWaitWriteAction
|
19,777
|
void (@NotNull Project project, @NotNull Runnable r) { startTestRunnable(r); if (DumbService.isDumbAware(r)) { runAndFinishTestRunnable(r); } else { DumbService.getInstance(project).runWhenSmart(DisposeAwareRunnable.create(() -> runAndFinishTestRunnable(r), project)); } }
|
runDumbAware
|
19,778
|
void (@NotNull Project project, @NotNull Runnable runnable) { if (project.isDisposed()) { return; } if (project.isInitialized()) { runDumbAware(project, runnable); } else { startTestRunnable(runnable); StartupManager.getInstance(project).runAfterOpened(() -> runAndFinishTestRunnable(runnable)); } }
|
runWhenInitialized
|
19,779
|
boolean () { return LaterInvocator.isInModalContext(); }
|
isInModalContext
|
19,780
|
void (Project project, @NlsContexts.NotificationTitle String title, Throwable e) { MavenLog.LOG.warn(title, e); Notifications.Bus.notify(new Notification(MAVEN_NOTIFICATION_GROUP, title, e.getMessage(), NotificationType.ERROR), project); }
|
showError
|
19,781
|
void (Project project, @NlsContexts.NotificationTitle String title, @NlsContexts.NotificationContent String message) { MavenLog.LOG.warn(title); Notifications.Bus.notify(new Notification(MAVEN_NOTIFICATION_GROUP, title, message, NotificationType.ERROR), project); }
|
showError
|
19,782
|
VirtualFile (@NotNull VirtualFile file) { VirtualFile baseDir = file.isDirectory() || file.getParent() == null ? file : file.getParent(); VirtualFile dir = baseDir; do { VirtualFile child = dir.findChild(".mvn"); if (child != null && child.isDirectory()) { if (MavenLog.LOG.isTraceEnabled()) { MavenLog.LOG.trace("found .mvn in " + child); } baseDir = dir; break; } } while ((dir = dir.getParent()) != null); if (MavenLog.LOG.isTraceEnabled()) { MavenLog.LOG.trace("return " + baseDir + " as baseDir"); } return baseDir; }
|
getVFileBaseDir
|
19,783
|
VirtualFile (VirtualFile pomFile) { if (pomFile == null) return null; VirtualFile parent = pomFile.getParent(); if (parent == null || !parent.isValid()) return null; return parent.findChild(MavenConstants.PROFILES_XML); }
|
findProfilesXmlFile
|
19,784
|
File (VirtualFile pomFile) { if (pomFile == null) return null; VirtualFile parent = pomFile.getParent(); if (parent == null) return null; return new File(parent.getPath(), MavenConstants.PROFILES_XML); }
|
getProfilesXmlIoFile
|
19,785
|
List<String> (List<? extends VirtualFile> files) { return ContainerUtil.map(files, file -> file.getPath()); }
|
collectPaths
|
19,786
|
List<VirtualFile> (Collection<? extends MavenProject> projects) { return ContainerUtil.map(projects, project -> project.getFile()); }
|
collectFiles
|
19,787
|
String (URL url) { return "<img src=\"" + url + "\"> "; }
|
formatHtmlImage
|
19,788
|
boolean (String relativeName, List<Pattern> includes, List<Pattern> excludes) { boolean result = false; for (Pattern each : includes) { if (each.matcher(relativeName).matches()) { result = true; break; } } if (!result) return false; for (Pattern each : excludes) { if (each.matcher(relativeName).matches()) return false; } return true; }
|
isIncluded
|
19,789
|
void (@NotNull ProgressIndicator i) { try { task.run(new MavenProgressIndicator(null, i, null)); } catch (MavenProcessCanceledException | ProcessCanceledException e) { canceledEx[0] = e; } catch (RuntimeException e) { runtimeEx[0] = e; } catch (Error e) { errorEx[0] = e; } }
|
run
|
19,790
|
MavenTaskHandler (@NotNull Project project, @NotNull @NlsContexts.Command String title, boolean cancellable, @NotNull MavenTask task) { MavenProjectsManager manager = MavenProjectsManager.getInstanceIfCreated(project); Supplier<MavenSyncConsole> syncConsoleSupplier = manager == null ? null : () -> manager.getSyncConsole(); MavenProgressIndicator indicator = new MavenProgressIndicator(project, syncConsoleSupplier); Runnable runnable = () -> { if (project.isDisposed()) return; try { task.run(indicator); } catch (MavenProcessCanceledException | ProcessCanceledException e) { indicator.cancel(); } }; Future<?> future; future = ApplicationManager.getApplication().executeOnPooledThread(runnable); MavenTaskHandler handler = new MavenTaskHandler() { @Override public void waitFor() { try { future.get(); } catch (InterruptedException | ExecutionException e) { MavenLog.LOG.error(e); } } }; invokeLater(project, () -> { if (future.isDone()) return; new Task.Backgroundable(project, title, cancellable) { @Override public void run(@NotNull ProgressIndicator i) { indicator.setIndicator(i); handler.waitFor(); } }.queue(); }); return handler; }
|
runInBackground
|
19,791
|
void () { try { future.get(); } catch (InterruptedException | ExecutionException e) { MavenLog.LOG.error(e); } }
|
waitFor
|
19,792
|
void (@NotNull ProgressIndicator i) { indicator.setIndicator(i); handler.waitFor(); }
|
run
|
19,793
|
File (@Nullable String overrideMavenHome) { if (!isEmptyOrSpaces(overrideMavenHome)) { return MavenUtil.getMavenHomeFile(staticOrBundled(resolveMavenHomeType(overrideMavenHome))); } String m2home = System.getenv(ENV_M2_HOME); if (!isEmptyOrSpaces(m2home)) { final File homeFromEnv = new File(m2home); if (isValidMavenHome(homeFromEnv)) { return homeFromEnv; } } String mavenHome = System.getenv("MAVEN_HOME"); if (!isEmptyOrSpaces(mavenHome)) { final File mavenHomeFile = new File(mavenHome); if (isValidMavenHome(mavenHomeFile)) { return mavenHomeFile; } } String userHome = SystemProperties.getUserHome(); if (!isEmptyOrSpaces(userHome)) { final File underUserHome = new File(userHome, M2_DIR); if (isValidMavenHome(underUserHome)) { return underUserHome; } } if (SystemInfo.isMac) { File home = fromBrew(); if (home != null) { return home; } if ((home = fromMacSystemJavaTools()) != null) { return home; } } else if (SystemInfo.isLinux) { File home = new File("/usr/share/maven"); if (isValidMavenHome(home)) { return home; } home = new File("/usr/share/maven2"); if (isValidMavenHome(home)) { return home; } } return MavenDistributionsCache.resolveEmbeddedMavenHome().getMavenHome().toFile(); }
|
resolveMavenHomeDirectory
|
19,794
|
List<MavenHomeType> () { List<MavenHomeType> result = new ArrayList<>(); String m2home = System.getenv(ENV_M2_HOME); if (!isEmptyOrSpaces(m2home)) { final File homeFromEnv = new File(m2home); if (isValidMavenHome(homeFromEnv)) { result.add(new MavenInSpecificPath(m2home)); } } String mavenHome = System.getenv("MAVEN_HOME"); if (!isEmptyOrSpaces(mavenHome)) { final File mavenHomeFile = new File(mavenHome); if (isValidMavenHome(mavenHomeFile)) { result.add(new MavenInSpecificPath(mavenHome)); } } String userHome = SystemProperties.getUserHome(); if (!isEmptyOrSpaces(userHome)) { final File underUserHome = new File(userHome, M2_DIR); if (isValidMavenHome(underUserHome)) { result.add(new MavenInSpecificPath(userHome)); } } if (SystemInfo.isMac) { File home = fromBrew(); if (home != null) { result.add(new MavenInSpecificPath(home.getAbsolutePath())); } if ((home = fromMacSystemJavaTools()) != null) { result.add(new MavenInSpecificPath(home.getAbsolutePath())); } } else if (SystemInfo.isLinux) { File home = new File("/usr/share/maven"); if (isValidMavenHome(home)) { result.add(new MavenInSpecificPath(home.getAbsolutePath())); } home = new File("/usr/share/maven2"); if (isValidMavenHome(home)) { result.add(new MavenInSpecificPath(home.getAbsolutePath())); } } result.add(BundledMaven3.INSTANCE); return result; }
|
getSystemMavenHomeVariants
|
19,795
|
void (@NotNull String mavenVersion, @NotNull SimpleJavaParameters params) { if (VersionComparatorUtil.compare(mavenVersion, "3.0.2") < 0) { MavenLog.LOG.warn("Maven version less than 3.0.2 are not correctly displayed in Build Window"); return; } String listenerPath = MavenServerManager.getInstance().getMavenEventListener().getAbsolutePath(); String userExtClassPath = StringUtils.stripToEmpty(params.getVMParametersList().getPropertyValue(MavenServerEmbedder.MAVEN_EXT_CLASS_PATH)); String vmParameter = "-D" + MavenServerEmbedder.MAVEN_EXT_CLASS_PATH + "="; String[] userListeners = userExtClassPath.split(File.pathSeparator); CompositeParameterTargetedValue targetedValue = new CompositeParameterTargetedValue(vmParameter) .addPathPart(listenerPath); for (String path : userListeners) { if (StringUtil.isEmptyOrSpaces(path)) continue; targetedValue = targetedValue.addPathSeparator().addPathPart(path); } params.getVMParametersList().add(targetedValue); }
|
addEventListener
|
19,796
|
File () { final File symlinkDir = new File("/usr/share/maven"); if (isValidMavenHome(symlinkDir)) { return symlinkDir; } // well, try to search final File dir = new File("/usr/share/java"); final String[] list = dir.list(); if (list == null || list.length == 0) { return null; } String home = null; final String prefix = "maven-"; final int versionIndex = prefix.length(); for (String path : list) { if (path.startsWith(prefix) && (home == null || compareVersionNumbers(path.substring(versionIndex), home.substring(versionIndex)) > 0)) { home = path; } } if (home != null) { File file = new File(dir, home); if (isValidMavenHome(file)) { return file; } } return null; }
|
fromMacSystemJavaTools
|
19,797
|
File () { final File brewDir = new File("/usr/local/Cellar/maven"); final String[] list = brewDir.list(); if (list == null || list.length == 0) { return null; } if (list.length > 1) { Arrays.sort(list, (o1, o2) -> compareVersionNumbers(o2, o1)); } final File file = new File(brewDir, list[0] + "/libexec"); return isValidMavenHome(file) ? file : null; }
|
fromBrew
|
19,798
|
boolean (@Nullable String str) { return str == null || str.length() == 0 || str.trim().length() == 0; }
|
isEmptyOrSpaces
|
19,799
|
boolean (@Nullable File home) { if (home == null) return false; return getMavenConfFile(home).exists(); }
|
isValidMavenHome
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.