Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
275,800
void (@NotNull Integer extension, final @NotNull PluginDescriptor pluginDescriptor) { added[0] = true; }
extensionAdded
275,801
void (@NotNull Integer extension, final @NotNull PluginDescriptor pluginDescriptor) { removed[0] = true; }
extensionRemoved
275,802
void () { ExtensionPoint<@NotNull Integer> extensionPoint = buildExtensionPoint(Integer.class); final boolean[] added = new boolean[1]; extensionPoint.registerExtension(123, disposable); //noinspection ConstantConditions assertThat(added[0]).isFalse(); extensionPoint.addExtensionPointListener(new ExtensionPointListener<Integer>() { @Override public void extensionAdded(@NotNull Integer extension, @NotNull PluginDescriptor pluginDescriptor) { added[0] = true; } }, true, null); assertThat(added[0]).isTrue(); }
testLateListener
275,803
void (@NotNull Integer extension, @NotNull PluginDescriptor pluginDescriptor) { added[0] = true; }
extensionAdded
275,804
void () { @SuppressWarnings("rawtypes") ExtensionPoint extensionPoint = buildExtensionPoint(Integer.class); try { extensionPoint.registerExtension((double)0, disposable); fail("must throw"); } catch (RuntimeException ignored) { } assertThat(extensionPoint.getExtensionList()).isEmpty(); extensionPoint.registerExtension(0, disposable); assertThat(extensionPoint.getExtensionList()).hasSize(1); }
testIncompatibleExtension
275,805
void () { DefaultLogger.disableStderrDumping(disposable); ExtensionPointImpl<@NotNull Integer> extensionPoint = buildExtensionPoint(Integer.class); extensionPoint.addExtensionAdapter(newStringAdapter()); assertThatThrownBy(() -> { extensionPoint.getExtensionList(); }).hasMessageContaining("Extension java.lang.String does not implement class java.lang.Integer"); }
testIncompatibleAdapter
275,806
void () { ExtensionPointImpl<@NotNull Integer> extensionPoint = buildExtensionPoint(Integer.class); extensionPoint.registerExtension(0, disposable); assertThat(extensionPoint.getExtensions()).hasSize(1); }
testCompatibleAdapter
275,807
void () { doTestInterruptedAdapterProcessing(() -> { throw new ProcessCanceledException(); }, (extensionPoint, adapter) -> { assertThatThrownBy(extensionPoint::getExtensionList).isInstanceOf(ProcessCanceledException.class); adapter.setFire(null); List<String> extensions = extensionPoint.getExtensionList(); assertThat(extensionPoint.getExtensionList()).hasSize(3); assertThat(extensions.get(0)).isEqualTo("second"); assertThat(extensions.get(1)).isIn("", "first"); assertThat(extensions.get(2)).isIn("", "first"); assertThat(extensions.get(2)).isNotEqualTo(extensions.get(1)); }); }
cancelledRegistration
275,808
void () { doTestInterruptedAdapterProcessing(() -> { throw ExtensionNotApplicableException.create(); }, (extensionPoint, adapter) -> { assertThat(extensionPoint.getExtensionList()).hasSize(2); adapter.setFire(null); // even if now extension is applicable, adapters is not reprocessed and result is the same assertThat(extensionPoint.getExtensionList()).hasSize(2); }); }
notApplicableRegistration
275,809
void () { ExtensionPointImpl<@NotNull String> extensionPoint = buildExtensionPoint(String.class); extensionPoint.registerExtension("first", disposable); MyShootingComponentAdapter adapter = newStringAdapter(); extensionPoint.addExtensionAdapter(adapter); adapter.setFire(() -> { throw ExtensionNotApplicableException.create(); }); extensionPoint.registerExtension("third", disposable); Iterator<String> iterator = extensionPoint.asSequence().iterator(); assertThat(iterator.hasNext()).isTrue(); assertThat(iterator.next()).isEqualTo("first"); assertThat(iterator.hasNext()).isTrue(); assertThat(iterator.next()).isEqualTo("third"); assertThat(iterator.hasNext()).isFalse(); }
iteratorAndNotApplicableRegistration
275,810
void (@NotNull Runnable firework, @NotNull BiConsumer<ExtensionPointImpl<@NotNull String>, MyShootingComponentAdapter> test) { ExtensionPointImpl<@NotNull String> extensionPoint = buildExtensionPoint(String.class); MyShootingComponentAdapter adapter = newStringAdapter(); extensionPoint.registerExtension("first", disposable); assertThat(extensionPoint.getExtensionList()).hasSize(1); // registers a wrapping adapter extensionPoint.registerExtension("second", LoadingOrder.FIRST, disposable); extensionPoint.addExtensionAdapter(adapter); adapter.setFire(firework); test.accept(extensionPoint, adapter); }
doTestInterruptedAdapterProcessing
275,811
void () { ExtensionPoint<@NotNull String> extensionPoint = buildExtensionPoint(String.class); final List<String> extensions = new ArrayList<>(); extensionPoint.addExtensionPointListener(new ExtensionPointListener<String>() { @Override public void extensionAdded(@NotNull String extension, @NotNull PluginDescriptor pluginDescriptor) { extensions.add(extension); } }, true, null); extensionPoint.registerExtension("first", disposable); assertThat(extensions).contains("first"); extensionPoint.registerExtension("second", LoadingOrder.FIRST, disposable); MyShootingComponentAdapter adapter = newStringAdapter(); ((ExtensionPointImpl<?>)extensionPoint).addExtensionAdapter(adapter); adapter.setFire(() -> { throw new ProcessCanceledException(); }); assertThatThrownBy(extensionPoint::getExtensionList).isInstanceOf(ProcessCanceledException.class); assertThat(extensions).contains("first", "second"); adapter.setFire(null); extensionPoint.getExtensionList(); assertThat(extensions).contains("first", "second", ""); }
testListenerNotifications
275,812
void (@NotNull String extension, @NotNull PluginDescriptor pluginDescriptor) { extensions.add(extension); }
extensionAdded
275,813
void () { ExtensionPoint<@NotNull String> extensionPoint = buildExtensionPoint(String.class); List<Integer> sizeList = new ArrayList<>(); extensionPoint.addExtensionPointListener(new ExtensionPointListener<String>() { @Override public void extensionRemoved(@NotNull String extension, @NotNull PluginDescriptor pluginDescriptor) { sizeList.add(extensionPoint.getExtensionList().size()); } }, true, null); //noinspection deprecation extensionPoint.registerExtension("first"); assertThat(extensionPoint.getExtensionList().size()).isEqualTo(1); extensionPoint.unregisterExtensions((adapterName, adapter) -> false, false); assertThat(sizeList).contains(0); }
testClearCacheOnUnregisterExtensions
275,814
void (@NotNull String extension, @NotNull PluginDescriptor pluginDescriptor) { sizeList.add(extensionPoint.getExtensionList().size()); }
extensionRemoved
275,815
void () { ExtensionPointImpl<@NotNull Integer> extensionPoint = buildExtensionPoint(Integer.class); extensionPoint.registerExtension(4, disposable); extensionPoint.registerExtension(2, disposable); Integer[] extensions = extensionPoint.getExtensions(); assertThat(extensions).containsExactly(4, 2); Arrays.sort(extensions); assertThat(extensions).containsExactly(2, 4); assertThat(extensionPoint.getExtensionList()).containsExactly(4, 2); Function<Integer, String> f = it -> "foo"; assertThat(ExtensionProcessingHelper.INSTANCE.getByGroupingKey(extensionPoint, f.getClass(), "foo", f)).isEqualTo( extensionPoint.getExtensionList()); assertThat(ExtensionProcessingHelper.INSTANCE.getByKey(extensionPoint, 2, ExtensionPointImplTest.class, Function.identity(), Function.identity())).isEqualTo(2); Function<Integer, Integer> f2 = (Integer it) -> it * 2; assertThat(ExtensionProcessingHelper.INSTANCE.getByKey(extensionPoint, 2, f2.getClass(), Function.identity(), f2)).isEqualTo(4); Function<Integer, Integer> filteringKeyMapper = it -> it < 3 ? it : null; assertThat(ExtensionProcessingHelper.INSTANCE.getByKey(extensionPoint, 2, filteringKeyMapper.getClass(), filteringKeyMapper, Function.identity())).isEqualTo(2); assertThat(ExtensionProcessingHelper.INSTANCE.getByKey(extensionPoint, 4, filteringKeyMapper.getClass(), filteringKeyMapper, Function.identity())).isNull(); Function<@NotNull Integer, @Nullable Integer> f3 = (Integer it) -> (Integer)null; assertThat(ExtensionProcessingHelper.INSTANCE.getByKey(extensionPoint, 4, f3.getClass(), Function.identity(), f3)).isNull(); }
clientsCannotModifyCachedExtensions
275,816
void () { BeanExtensionPoint<KeyedLazyInstance<Integer>> extensionPoint = new BeanExtensionPoint<>("foo", KeyedLazyInstance.class.getName(), new DefaultPluginDescriptor("test"), new MyComponentManager(), true); KeyedLazyInstance<Integer> extension = new KeyedLazyInstance<Integer>() { @Override public String getKey() { return "one"; } @Override public @NotNull Integer getInstance() { return 1; } }; extensionPoint.registerExtension(extension); Disposable disposable = ExtensionPointUtil.createKeyedExtensionDisposable(extension.getInstance(), extensionPoint); extensionPoint.unregisterExtension(extension); assertThat(Disposer.isDisposed(disposable)).isTrue(); Disposer.dispose(extensionPoint.componentManager); }
keyedExtensionDisposable
275,817
String () { return "one"; }
getKey
275,818
Integer () { return 1; }
getInstance
275,819
MyShootingComponentAdapter () { return new MyShootingComponentAdapter(String.class.getName()); }
newStringAdapter
275,820
boolean (@NotNull Class<?> interfaceClass) { throw new UnsupportedOperationException(); }
hasComponent
275,821
boolean () { return false; }
isInjectionForExtensionSupported
275,822
MessageBus () { throw new UnsupportedOperationException(); }
getMessageBus
275,823
boolean () { return false; }
isDisposed
275,824
ExtensionsArea () { throw new UnsupportedOperationException(); }
getExtensionArea
275,825
ActivityCategory (boolean isExtension) { return ActivityCategory.APP_EXTENSION; }
getActivityCategory
275,826
void () { }
dispose
275,827
RuntimeException (@NotNull @NonNls String message, @NotNull PluginId pluginId) { return new RuntimeException(message); }
createError
275,828
RuntimeException (@NotNull @NonNls String message, @Nullable Throwable error, @NotNull PluginId pluginId, @Nullable Map<String, String> attachments) { return new RuntimeException(message); }
createError
275,829
RuntimeException (@NotNull Throwable error, @NotNull PluginId pluginId) { return new RuntimeException(error); }
createError
275,830
void () { assertSequence( "1 Any Any 2", Arrays.asList( createElement(LoadingOrder.ANY, null, "Any"), createElement(LoadingOrder.FIRST, null, "1"), createElement(LoadingOrder.LAST, null, "2"), createElement(LoadingOrder.ANY, null, "Any") ) ); }
testSimpleSorting
275,831
void () { assertSequence( "1 2 3 4", Arrays.asList( createElement(LoadingOrder.ANY, null, "1"), createElement(LoadingOrder.ANY, null, "2"), createElement(LoadingOrder.ANY, null, "3"), createElement(LoadingOrder.ANY, null, "4") ) ); }
testStability
275,832
void () { String idOne = "idOne"; String idTwo = "idTwo"; assertSequence( "0 1 2 3 4 5", Arrays.asList( createElement(LoadingOrder.before(idTwo), idOne, "2"), createElement(LoadingOrder.FIRST, null, "0"), createElement(LoadingOrder.LAST, null, "5"), createElement(LoadingOrder.after(idTwo), null, "4"), createElement(LoadingOrder.ANY, idTwo, "3"), createElement(LoadingOrder.before(idOne), null, "1") ) ); }
testComplexSorting
275,833
void () { String idOne = "idOne"; assertSequence( "1 2 3 4 5 6", Arrays.asList( createElement(LoadingOrder.before(idOne), null, "2"), createElement(LoadingOrder.after(idOne), null, "4"), createElement(LoadingOrder.FIRST, null, "1"), createElement(LoadingOrder.ANY, idOne, "3"), createElement(LoadingOrder.ANY, null, "5"), createElement(LoadingOrder.LAST, null, "6") ) ); }
testComplexSorting2
275,834
void () { assertSequence( "3 4 2 1", Arrays.asList( createElement(LoadingOrder.LAST, "1", "1"), createElement(LoadingOrder.readOrder("last,before 1"), null, "2"), createElement(LoadingOrder.ANY, null, "3"), createElement(LoadingOrder.before("1'"), null, "4") ) ); }
testComplexSortingBeforeLast
275,835
void () { checkSortingFailure( Arrays.asList( createElement(LoadingOrder.ANY, null, "good"), createElement(LoadingOrder.FIRST, "first", "bad"), createElement(LoadingOrder.LAST, null, "good"), createElement(LoadingOrder.before("first"), null, "bad") ) ); }
testFailingSortingBeforeFirst
275,836
void () { assertSequence( "1 1 2 3", Arrays.asList( createElement(LoadingOrder.ANY, null, "2"), createElement(LoadingOrder.FIRST, "first", "1"), createElement(LoadingOrder.LAST, null, "3"), createElement(LoadingOrder.FIRST, null, "1") ) ); }
testFailingSortingFirst
275,837
void () { checkSortingFailure( Arrays.asList( createElement(LoadingOrder.after("last"), null, "bad"), createElement(LoadingOrder.FIRST, null, "good"), createElement(LoadingOrder.LAST, "last", "bad"), createElement(LoadingOrder.ANY, null, "good") ) ); }
testFailingSortingAfterLast
275,838
void () { assertSequence( "1 2 3 3", Arrays.asList( createElement(LoadingOrder.LAST, null, "3"), createElement(LoadingOrder.FIRST, null, "1"), createElement(LoadingOrder.LAST, "last", "3"), createElement(LoadingOrder.ANY, null, "2") ) ); }
testFailingSortingLast
275,839
void () { checkSortingFailure(new ArrayList<>(Arrays.asList(createElement(LoadingOrder.after("2"), "1", "bad"), createElement(LoadingOrder.after("3"), "2", "bad"), createElement(LoadingOrder.after("1"), "3", "bad"))) ); }
testFailingSortingComplex
275,840
void (String expected, @NotNull List<LoadingOrder.Orderable> list) { LoadingOrder.Companion.sortByLoadingOrder(list); String sequence = list.stream().map(o -> ((MyOrderable)o).getName()).collect(Collectors.joining(" ")); assertEquals(expected, sequence); }
assertSequence
275,841
void (@NotNull List<LoadingOrder.Orderable> list) { try { LoadingOrder.Companion.sortByLoadingOrder(list); fail("Should have failed"); } catch (SortingException e) { LoadingOrder.Orderable[] conflictingElements = e.getConflictingElements(); assertEquals(2, conflictingElements.length); assertEquals("bad", ((MyOrderable)conflictingElements[0]).getName()); assertEquals("bad", ((MyOrderable)conflictingElements[1]).getName()); } }
checkSortingFailure
275,842
String () { return myOrderId; }
getOrderId
275,843
LoadingOrder () { return myOrder; }
getOrder
275,844
String () { return myName; }
getName
275,845
State () { return myState; }
getState
275,846
void (@NotNull State state) { myState = state; }
loadState
275,847
void (@NotNull String url) { addUrl(url, ""); }
addUrl
275,848
void (@NotNull String url, @NotNull String userName) { for (UrlAndUserName visitedUrl : myState.visitedUrls) { if (visitedUrl.url.equalsIgnoreCase(url)) { // don't add multiple entries for a single url if (!userName.isEmpty()) { // rewrite username, unless no username is specified visitedUrl.userName = userName; } return; } } UrlAndUserName urlAndUserName = new UrlAndUserName(); urlAndUserName.url = url; urlAndUserName.userName = userName; myState.visitedUrls.add(urlAndUserName); }
addUrl
275,849
String (@NotNull String url) { for (UrlAndUserName urlAndUserName : myState.visitedUrls) { if (urlAndUserName.url.equalsIgnoreCase(url)) { return urlAndUserName.userName; } } return null; }
getUserNameForUrl
275,850
List<String> () { List<String> urls = new ArrayList<>(myState.visitedUrls.size()); for (UrlAndUserName urlAndUserName : myState.visitedUrls) { urls.add(urlAndUserName.url); } return urls; }
getVisitedUrls
275,851
String () { return myState.cloneParentDir; }
getCloneParentDir
275,852
void (String cloneParentDir) { myState.cloneParentDir = cloneParentDir; }
setCloneParentDir
275,853
void () { myState.visitedUrls.clear(); myState.cloneParentDir = ""; }
clear
275,854
List<VirtualFile> (@NotNull Collection<? extends VirtualFile> virtualFiles) { return ContainerUtil.sorted(virtualFiles, VIRTUAL_FILE_PRESENTATION_COMPARATOR); }
sortVirtualFilesByPresentation
275,855
List<VirtualFile> (@NotNull List<? extends File> files) { RefreshVFsSynchronously.refreshFiles(files); return ContainerUtil.mapNotNull(files, file -> VfsUtil.findFileByIoFile(file, false)); }
findVirtualFilesWithRefresh
275,856
String (@NotNull Repository repository) { return VcsImplUtil.getShortVcsRootName(repository.getProject(), repository.getRoot()); }
getShortRepositoryName
275,857
String (@NotNull Collection<? extends Repository> repositories) { return StringUtil.join(repositories, repository -> getShortRepositoryName(repository), ", "); }
getShortNames
275,858
String (@NotNull Collection<String> messages) { String joined = StringUtil.join(messages, "\n"); return StringUtil.isEmptyOrSpaces(joined) ? null : joined; }
joinMessagesOrNull
275,859
VirtualFile (@NotNull Project project) { FileEditor fileEditor = FileEditorManager.getInstance(project).getSelectedEditor(); return fileEditor == null ? null : fileEditor.getFile(); }
getSelectedFile
275,860
VirtualFile (@NotNull DataContext dataProvider) { FileEditor fileEditor = PlatformDataKeys.LAST_ACTIVE_FILE_EDITOR.getData(dataProvider); return fileEditor == null ? null : fileEditor.getFile(); }
getSelectedFile
275,861
String (@NotNull String hash) { if (hash.length() < VcsLogUtil.SHORT_HASH_LENGTH) { LOG.debug("Unexpectedly short hash: [" + hash + "]"); } if (hash.length() > VcsLogUtil.FULL_HASH_LENGTH) { LOG.debug("Unexpectedly long hash: [" + hash + "]"); } return VcsLogUtil.getShortHash(hash); }
getShortHash
275,862
String (@NotNull TimedVcsCommit commit) { return DateFormatUtil.formatPrettyDateTime(commit.getTimestamp()) + " "; }
getDateString
275,863
AccessToken (@NotNull Project project) { return workingTreeChangeStarted(project, null); }
workingTreeChangeStarted
275,864
AccessToken (@NotNull Project project, @Nullable @Nls String activityName) { BackgroundTaskUtil.syncPublisher(BatchFileChangeListener.TOPIC).batchChangeStarted(project, activityName); return new AccessToken() { @Override public void finish() { BackgroundTaskUtil.syncPublisher(BatchFileChangeListener.TOPIC).batchChangeCompleted(project); } }; }
workingTreeChangeStarted
275,865
void () { BackgroundTaskUtil.syncPublisher(BatchFileChangeListener.TOPIC).batchChangeCompleted(project); }
finish
275,866
String (@NotNull final File file, @Nullable @NlsSafe String defaultValue) { return tryLoadFileOrReturn(file, defaultValue, null); }
tryLoadFileOrReturn
275,867
String (@NotNull final File file, @Nullable @NlsSafe String defaultValue, @Nullable @NonNls String encoding) { try { return tryLoadFile(file, encoding); } catch (RepoStateException e) { LOG.warn(e); return defaultValue; } }
tryLoadFileOrReturn
275,868
void (@NotNull VirtualFile vcsDir, @NotNull Collection<String> subDirs) { vcsDir.getChildren(); for (String subdir : subDirs) { VirtualFile dir = vcsDir.findFileByRelativePath(subdir); // process recursively, because we need to visit all branches under refs/heads and refs/remotes ensureAllChildrenInVfs(dir); } }
visitVcsDirVfs
275,869
void (@Nullable VirtualFile dir) { if (dir != null) { VfsUtilCore.processFilesRecursively(dir, CommonProcessors.alwaysTrue()); } }
ensureAllChildrenInVfs
275,870
void (@NotNull Project project, @NotNull @NonNls String newRepositoryPath, @NotNull @NonNls String vcsName) { if (!project.isDisposed() && project.getBasePath() != null && FileUtil.isAncestor(project.getBasePath(), newRepositoryPath, true)) { ProjectLevelVcsManager manager = ProjectLevelVcsManager.getInstance(project); manager.setDirectoryMappings(VcsUtil.addMapping(manager.getDirectoryMappings(), newRepositoryPath, vcsName)); } }
addMappingIfSubRoot
275,871
Repository (@NotNull Project project, @NotNull DataContext dataContext) { VcsRepositoryManager manager = VcsRepositoryManager.getInstance(project); VirtualFile file = dataContext.getData(CommonDataKeys.VIRTUAL_FILE); Repository repository = manager.getRepositoryForRootQuick(findVcsRootFor(project, file)); if (repository != null) return repository; VirtualFile selectedFile = getSelectedFile(dataContext); repository = manager.getRepositoryForRootQuick(findVcsRootFor(project, selectedFile)); if (repository != null) return repository; return null; }
guessRepositoryForOperation
275,872
VirtualFile (@NotNull Project project, @NotNull AbstractVcs vcs, @Nullable @NonNls String defaultRootPathValue) { if (project.isDisposed()) return null; LOG.debug("Guessing vcs root..."); ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project); String vcsName = vcs.getDisplayName(); VirtualFile[] vcsRoots = vcsManager.getRootsUnderVcs(vcs); if (vcsRoots.length == 0) { LOG.debug("No " + vcsName + " roots in the project."); return null; } if (vcsRoots.length == 1) { VirtualFile onlyRoot = vcsRoots[0]; LOG.debug("Only one " + vcsName + " root in the project, returning: " + onlyRoot); return onlyRoot; } // get remembered last visited repository root if (defaultRootPathValue != null) { VirtualFile recentRoot = VcsUtil.getVirtualFile(defaultRootPathValue); if (ArrayUtil.contains(recentRoot, vcsRoots)) { LOG.debug("Returning the recent root: " + recentRoot); return recentRoot; } } // otherwise return the root of the project dir or the root containing the project dir, if there is such VirtualFile projectBaseDir = project.getBaseDir(); if (projectBaseDir == null) { VirtualFile firstRoot = vcsRoots[0]; LOG.debug("Project base dir is null, returning the first root: " + firstRoot); return firstRoot; } for (VirtualFile root : vcsRoots) { if (root.equals(projectBaseDir) || VfsUtilCore.isAncestor(root, projectBaseDir, true)) { LOG.debug("The best candidate: " + root); return root; } } VirtualFile rootCandidate = vcsRoots[0]; LOG.debug("Returning the best candidate: " + rootCandidate); return rootCandidate; }
guessRootForVcs
275,873
VirtualFile (@NotNull Project project, @NotNull VirtualFile file) { ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project); // For a file inside .jar/.zip, check VCS for the .jar/.zip file itself VirtualFile root = vcsManager.getVcsRootFor(VfsUtilCore.getVirtualFileForJar(file)); if (root != null) { LOG.debug("Found root for zip/jar file: " + root); return root; } // For libraries, check VCS for the owner module List<OrderEntry> entries = ProjectRootManager.getInstance(project).getFileIndex().getOrderEntriesForFile(file); Set<VirtualFile> modulesVcsRoots = new HashSet<>(); for (OrderEntry entry : entries) { if (entry instanceof LibraryOrderEntry || entry instanceof JdkOrderEntry) { VirtualFile moduleVcsRoot = vcsManager.getVcsRootFor(entry.getOwnerModule().getModuleFile()); if (moduleVcsRoot != null) { modulesVcsRoots.add(moduleVcsRoot); } } } if (modulesVcsRoots.isEmpty()) { LOG.debug("No library roots"); return null; } // If the lib is used in several modules under different VCS roots, take the topmost one. // For modules not sharing ancestry, we can't guess anything => take the first one. VirtualFile topRoot = null; for (VirtualFile vcsRoot : modulesVcsRoots) { if (topRoot == null || VfsUtilCore.isAncestor(vcsRoot, topRoot, true)) { topRoot = vcsRoot; } } LOG.debug("Several library roots, returning " + topRoot); return topRoot; }
getVcsRootForLibraryFile
275,874
VirtualFile (@NotNull Project project, @Nullable VirtualFile file) { return findVcsRootFor(project, file); }
guessVcsRoot
275,875
VirtualFile (@NotNull Project project, @Nullable VirtualFile file) { VirtualFile root = ProjectLevelVcsManager.getInstance(project).getVcsRootFor(file); if (root != null) return root; if (file != null) { root = getVcsRootForLibraryFile(project, file); if (root != null) return root; } return null; }
findVcsRootFor
275,876
PushSupport (@NotNull final AbstractVcs vcs) { return ContainerUtil.find(PushSupport.PUSH_SUPPORT_EP.getExtensions(vcs.getProject()), support -> support.getVcs().equals(vcs)); }
getPushSupport
275,877
String (@NotNull Collection<? extends Repository> repositories) { return joinShortNames(repositories, -1); }
joinShortNames
275,878
String (@NotNull Collection<? extends Repository> repositories, int limit) { return joinWithAnd(ContainerUtil.map(repositories, repository -> getShortRepositoryName(repository)), limit); }
joinShortNames
275,879
String (@NotNull List<@Nls String> strings, int limit) { return VcsUtil.joinWithAnd(strings, limit); }
joinWithAnd
275,880
void (@NotNull Repository repository, @NotNull List<? extends VcsFullCommitDetails> headToBranch, @NotNull List<? extends VcsFullCommitDetails> branchToHead) { //noinspection unchecked myInfo.put(repository, (Pair)Couple.of(headToBranch, branchToHead)); }
put
275,881
void (@NotNull Repository repository, @NotNull Collection<Change> totalDiff) { myTotalDiff.put(repository, totalDiff); }
putTotalDiff
275,882
List<VcsFullCommitDetails> (@NotNull Repository repo) { return getCompareInfo(repo).getFirst(); }
getHeadToBranchCommits
275,883
List<VcsFullCommitDetails> (@NotNull Repository repo) { return getCompareInfo(repo).getSecond(); }
getBranchToHeadCommits
275,884
Collection<Repository> () { return myTotalDiff.keySet(); }
getRepositories
275,885
boolean () { return myInfo.isEmpty(); }
isEmpty
275,886
InfoType () { return myInfoType; }
getInfoType
275,887
List<Change> () { List<Change> changes = new ArrayList<>(); for (Collection<Change> changeCollection : myTotalDiff.values()) { changes.addAll(changeCollection); } return changes; }
getTotalDiff
275,888
void (@NotNull Map<Repository, Collection<Change>> newDiff) { myTotalDiff.clear(); myTotalDiff.putAll(newDiff); }
updateTotalDiff
275,889
ListPopup () { return myPopup; }
asListPopup
275,890
ActionGroup () { LightActionGroup popupGroup = new LightActionGroup(false); AbstractRepositoryManager<Repo> repositoryManager = myRepositoryManager; if (repositoryManager.moreThanOneRoot()) { if (userWantsSyncControl()) { fillWithCommonRepositoryActions(popupGroup, repositoryManager); } else { fillPopupWithCurrentRepositoryActions(popupGroup, createRepositoriesActions()); } } else { fillPopupWithCurrentRepositoryActions(popupGroup, null); } popupGroup.addSeparator(); return popupGroup; }
createActions
275,891
boolean () { return (myVcsSettings.getSyncSetting() != DvcsSyncSettings.Value.DONT_SYNC); }
userWantsSyncControl
275,892
List<Repo> (@NotNull final String branch, @NotNull List<? extends Repo> allRepositories) { return ContainerUtil.filter(allRepositories, repository -> !branch.equals(repository.getCurrentBranchName())); }
filterRepositoriesNotOnThisBranch
275,893
void () { if (isBranchesDiverged()) { myPopup.setWarning(DvcsBundle.message("branch.popup.warning.branches.have.diverged")); } }
warnThatBranchesDivergedIfNeeded
275,894
boolean () { return myRepositoryManager.moreThanOneRoot() && myMultiRootBranchConfig.diverged() && userWantsSyncControl(); }
isBranchesDiverged
275,895
DvcsSyncSettings (@NotNull AnActionEvent e) { return myVcsSettings; }
getSettings
275,896
boolean () { return getCurrentBranch() == null; }
diverged
275,897
String () { return MultiRootBranches.getCommonCurrentBranch(myRepositories); }
getCurrentBranch
275,898
boolean () { return !myRepositoryManager.getRepositories().isEmpty(); }
isEnabled
275,899
TaskInfo (@NotNull final String taskName) { List<R> repositories = myRepositoryManager.getRepositories(); List<R> problems = ContainerUtil.filter(repositories, repository -> hasBranch(repository, new TaskInfo(taskName, Collections.emptyList()))); List<R> map = new ArrayList<>(); if (!problems.isEmpty()) { if (ApplicationManager.getApplication().isUnitTestMode() || MessageDialogBuilder .yesNo(DvcsBundle.message("dialog.title.already.exists", StringUtil.capitalize(myBranchType)), DvcsBundle.message("dialog.message.following.repositories.already.have.specified", myBranchType, taskName, StringUtil.join(problems, UIUtil.BR), myBranchType)) .icon(Messages.getWarningIcon()) .ask(myProject)) { checkout(taskName, problems, null); map.addAll(problems); } repositories = ContainerUtil.filter(repositories, r->!problems.contains(r)); } if (!repositories.isEmpty()) { checkoutAsNewBranch(taskName, repositories); } map.addAll(repositories); return new TaskInfo(taskName, ContainerUtil.map(map, r -> r.getPresentableUrl())); }
startNewTask