Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
275,900
boolean (@NotNull TaskInfo taskInfo, @Nullable Runnable invokeAfter) { List<R> repositories = getRepositories(taskInfo.getRepositories()); List<R> notFound = ContainerUtil.filter(repositories, repository -> !hasBranch(repository, taskInfo)); final String branchName = taskInfo.getName(); if (!notFound.isEmpty()) { checkoutAsNewBranch(branchName, notFound); } repositories = new ArrayList<>(ContainerUtil.subtract(repositories, notFound)); if (!repositories.isEmpty()) { checkout(branchName, repositories, invokeAfter); return true; } return false; }
switchToTask
275,901
void (@NotNull final TaskInfo taskInfo, @NotNull TaskInfo original) { checkout(original.getName(), getRepositories(original.getRepositories()), () -> mergeAndClose(taskInfo.getName(), getRepositories(taskInfo.getRepositories()))); }
closeTask
275,902
boolean () { return myRepositoryManager.isSyncEnabled(); }
isSyncEnabled
275,903
TaskInfo[] () { List<R> repositories = myRepositoryManager.getRepositories(); MultiMap<String, TaskInfo> tasks = new MultiMap<>(); for (R repository : repositories) { for (TaskInfo branch : getAllBranches(repository)) { tasks.putValue(branch.getName(), branch); } } return ContainerUtil.map2Array(tasks.entrySet(), TaskInfo.class, entry -> { Set<String> repositories1 = new HashSet<>(); boolean remote = false; for (TaskInfo info : entry.getValue()) { remote |= info.isRemote(); repositories1.addAll(info.getRepositories()); } return new TaskInfo(entry.getKey(), repositories1, remote); }); }
getAllExistingTasks
275,904
List<R> (@NotNull Collection<String> urls) { final List<R> repositories = myRepositoryManager.getRepositories(); return ContainerUtil.mapNotNull(urls, s -> ContainerUtil.find(repositories, repository -> s.equals(repository.getPresentableUrl()))); }
getRepositories
275,905
boolean (@Nullable Repository repository, @NotNull String sourceBranch, @NotNull DvcsBranchInfo targetInfo) { return StringUtil.equals(targetInfo.sourceName, sourceBranch) && getPathFor(repository).equals(targetInfo.repoPath); }
repoAndSourceAreEqual
275,906
String (@Nullable Repository repository) { return repository == null ? "" : repository.getRoot().getPath(); }
getPathFor
275,907
List<Change> (@NotNull List<? extends Change> changes) { return ContainerUtil.map(changes, change -> { ContentRevision beforeRevision = change.getBeforeRevision(); ContentRevision afterRevision = change.getAfterRevision(); if (beforeRevision == null || afterRevision == null) return new Change(afterRevision, beforeRevision); return new Change(afterRevision, beforeRevision, change.getFileStatus()); }); }
swapRevisions
275,908
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DvcsBranchInfo info = (DvcsBranchInfo)o; if (repoPath != null ? !repoPath.equals(info.repoPath) : info.repoPath != null) return false; if (sourceName != null ? !sourceName.equals(info.sourceName) : info.sourceName != null) return false; return true; }
equals
275,909
int () { return Objects.hash(repoPath, sourceName); }
hashCode
275,910
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
275,911
boolean (@NotNull AnActionEvent e) { return getSettings(e).getSyncSetting() == DvcsSyncSettings.Value.SYNC; }
isSelected
275,912
void (@NotNull AnActionEvent e, boolean state) { getSettings(e).setSyncSetting(state ? DvcsSyncSettings.Value.SYNC : DvcsSyncSettings.Value.DONT_SYNC); }
setSelected
275,913
Collection<String> (@NotNull BranchType type) { return Collections.EMPTY_LIST; }
getDefaultBranchNames
275,914
boolean (@Nullable BranchType branchType, @Nullable Repository repository, @NotNull String branchName) { if (branchType == null) return false; String branchTypeName = branchType.getName(); if (myBranchSettings.getFavorites().contains(branchTypeName, repository, branchName)) return true; if (myBranchSettings.getExcludedFavorites().contains(branchTypeName, repository, branchName)) return false; return isPredefinedAsFavorite(branchType, branchName); }
isFavorite
275,915
boolean (@NotNull BranchType type, @NotNull String branchName) { Collection<String> predefinedNames = myPredefinedFavoriteBranches.get(type); return predefinedNames != null && predefinedNames.contains(branchName); }
isPredefinedAsFavorite
275,916
void (@Nullable BranchType branchType, @Nullable Repository repository, @NotNull String branchName, boolean shouldBeFavorite) { if (branchType == null) return; String branchTypeName = branchType.getName(); if (shouldBeFavorite) { myBranchSettings.getExcludedFavorites().remove(branchTypeName, repository, branchName); if (!isPredefinedAsFavorite(branchType, branchName)) { myBranchSettings.getFavorites().add(branchTypeName, repository, branchName); } } else { myBranchSettings.getFavorites().remove(branchTypeName, repository, branchName); if (isPredefinedAsFavorite(branchType, branchName)) { myBranchSettings.getExcludedFavorites().add(branchTypeName, repository, branchName); } } notifyFavoriteSettingsChanged(); }
setFavorite
275,917
void () { BackgroundTaskUtil.runUnderDisposeAwareIndicator(myProject, () -> { myProject.getMessageBus().syncPublisher(DVCS_BRANCH_SETTINGS_CHANGED).branchFavoriteSettingsChanged(); }); }
notifyFavoriteSettingsChanged
275,918
boolean (@NotNull GroupingKey key) { return myBranchSettings.getGroupingKeyIds().contains(key.getId()); }
isGroupingEnabled
275,919
void (@NotNull GroupingKey key, boolean state) { if (state) { myBranchSettings.getGroupingKeyIds().add(key.getId()); } else { myBranchSettings.getGroupingKeyIds().remove(key.getId()); } myBranchSettings.intIncrementModificationCount(); notifyGroupingSettingsChanged(key, state); }
setGrouping
275,920
void (@NotNull GroupingKey key, boolean state) { BackgroundTaskUtil.runUnderDisposeAwareIndicator(myProject, () -> { myProject.getMessageBus().syncPublisher(DVCS_BRANCH_SETTINGS_CHANGED).branchGroupingSettingsChanged(key, state); }); }
notifyGroupingSettingsChanged
275,921
void (@NotNull AnActionEvent e) { Project project = e.getRequiredData(CommonDataKeys.PROJECT); VirtualFile file = Objects.requireNonNull(JBIterable.from(e.getData(VcsDataKeys.VIRTUAL_FILES)).single()); T repository = Objects.requireNonNull(getRepositoryManager(project).getRepositoryForFileQuick(file)); assert !repository.isFresh(); JBPopup popup = createPopup(project, repository, file); if (popup == null) return; ApplicationManager.getApplication().invokeLater(() -> { IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> popup.showCenteredInCurrentWindow(project)); }); }
actionPerformed
275,922
void (@NotNull AnActionEvent e) { Presentation presentation = e.getPresentation(); Project project = e.getProject(); VirtualFile file = JBIterable.from(e.getData(VcsDataKeys.VIRTUAL_FILES)).single(); presentation.setVisible(project != null); presentation.setEnabled(project != null && file != null && isEnabled(getRepositoryManager(project).getRepositoryForFileQuick(file))); }
update
275,923
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
275,924
boolean (@Nullable T repository) { return repository != null && !repository.isFresh() && !nothingToCompare(repository); }
isEnabled
275,925
JBPopup (@NotNull @NlsContexts.PopupTitle String title, @NotNull List<String> options, @NotNull Consumer<? super String> onChosen) { return JBPopupFactory.getInstance() .createPopupChooserBuilder(options) .setTitle(title) .setMovable(true) .setItemChosenCallback(onChosen::accept) .setAutoselectOnMouseMove(true) .setNamerForFiltering(o -> o) .setRenderer(BuilderKt.textListCellRenderer((@NlsSafe var name) -> name)) .withFixedRendererSize(new Dimension(JBUI.scale(350), JBUI.CurrentTheme.List.rowHeight())) // do not freeze on huge lists .createPopup(); }
createPopup
275,926
void (@NotNull Project project, @NotNull VirtualFile file, @NotNull @Nls String revNumTitle1, @NotNull @Nls String revNumTitle2, @NotNull ThrowableComputable<? extends Collection<Change>, ? extends VcsException> changesLoader) { if (file.isDirectory()) { String dialogTitle = VcsBundle.message("history.dialog.title.difference.between.versions.in", revNumTitle1, revNumTitle2, file.getName()); CompareWithLocalDialog.showChanges(project, dialogTitle, CompareWithLocalDialog.LocalContent.AFTER, changesLoader); } else { DiffRequestChain requestChain = new ChangeDiffRequestChain.Async() { @Override protected @NotNull ListSelection<ChangeDiffRequestProducer> loadRequestProducers() throws DiffRequestProducerException { try { Collection<Change> changes = changesLoader.compute(); Map<Key<?>, Object> changeContext = new HashMap<>(2); changeContext.put(DiffUserDataKeysEx.VCS_DIFF_LEFT_CONTENT_TITLE, revNumTitle1); changeContext.put(DiffUserDataKeysEx.VCS_DIFF_RIGHT_CONTENT_TITLE, revNumTitle2); return ListSelection.createAt(new ArrayList<>(changes), 0) .map(change -> ChangeDiffRequestProducer.create(project, change, changeContext)); } catch (VcsException e) { throw new DiffRequestProducerException(e); } } }; DiffManager.getInstance().showDiff(project, requestChain, DiffDialogHints.DEFAULT); } }
showDiffBetweenRevision
275,927
String (Repository repository) { String branchName = repository.getCurrentBranchName(); if (branchName != null) return branchName; String revision = repository.getCurrentRevision(); if (revision != null) return DvcsUtil.getShortHash(revision); return VcsBundle.message("diff.title.local"); }
getPresentableCurrentBranchName
275,928
List<AnAction> (@Nullable Project project, @Nullable AbstractVcs activeVcs, @Nullable DataContext dataContext) { if (activeVcs == null || !replaceVcsActionsFor(activeVcs, dataContext)) return null; final ActionManager manager = ActionManager.getInstance(); final List<AnAction> actions = new ArrayList<>(); ActionGroup vcsGroup = (ActionGroup)CustomActionsSchema.getInstance().getCorrectedAction(VcsActions.VCS_OPERATIONS_POPUP); ActionGroup vcsAwareGroup = (ActionGroup)ContainerUtil.find(vcsGroup.getChildren(null), action -> { if (action instanceof CustomisedActionGroup) action = ((CustomisedActionGroup)action).getOrigin(); return action instanceof VcsQuickListPopupAction.VcsAware; }); if (vcsAwareGroup != null) ContainerUtil.addAll(actions, vcsAwareGroup.getChildren(null)); customizeActions(manager, actions); return actions; }
getVcsActions
275,929
void (@NotNull ActionManager manager, @NotNull List<? super AnAction> actions) { List<AnAction> providerActions = collectVcsSpecificActions(manager); actions.removeAll(providerActions); actions.add(Separator.getInstance()); actions.addAll(providerActions); }
customizeActions
275,930
boolean (@NotNull AbstractVcs activeVcs, @Nullable DataContext dataContext) { return getVcsName().equals(activeVcs.getName()); }
replaceVcsActionsFor
275,931
void (String actionName, ActionManager manager, List<? super AnAction> actions) { final AnAction action = manager.getAction(actionName); assert action != null : "Can not find action " + actionName; actions.add(action); }
add
275,932
JBPopup (@NotNull Project project, @NotNull T repository, @NotNull VirtualFile file) { String presentableRevisionName = getPresentableCurrentBranchName(repository); List<String> branchNames = getBranchNamesExceptCurrent(repository); return createPopup(DvcsBundle.message("popup.title.select.branch.to.compare"), branchNames, selected -> showDiffWithBranchUnderModalProgress(project, file, presentableRevisionName, selected)); }
createPopup
275,933
void (@NotNull final Project project, @NotNull final VirtualFile file, @NotNull final @NlsSafe String head, @NotNull final @NlsSafe String compare) { String revNumTitle1 = VcsDiffUtil.getRevisionTitle(compare, false); String revNumTitle2 = VcsDiffUtil.getRevisionTitle(head, true); showDiffBetweenRevision(project, file, revNumTitle1, revNumTitle2, () -> getDiffChanges(project, file, compare)); }
showDiffWithBranchUnderModalProgress
275,934
String (@NotNull VirtualFile file, @NotNull String branchToCompare) { return DvcsBundle.message("error.text.file.not.found.in.branch", file.isDirectory() ? 2 : 1, file.getPresentableUrl(), branchToCompare); }
fileDoesntExistInBranchError
275,935
void (@NotNull VcsLogCommitSelection commitSelection) { commitSelection.requestFullDetails(details -> myTaskQueue.run(new CherryPickingTask(ContainerUtil.reverse(details)))); }
cherryPick
275,936
boolean (@NotNull List<? extends CommitId> commits) { for (CommitId commit : commits) { if (myIdsInProgress.contains(commit)) { return true; } } return false; }
isCherryPickAlreadyStartedFor
275,937
void (@Nls @NotNull String message) { VcsNotifier.getInstance(myProject).notifyWeakError(CHERRY_PICK_ERROR, message); LOG.warn(message); }
showError
275,938
void (@NotNull ProgressIndicator indicator) { try { boolean isOk = true; MultiMap<VcsCherryPicker, VcsFullCommitDetails> groupedCommits = createArrayMultiMap(); for (VcsFullCommitDetails details : myAllDetailsInReverseOrder) { VcsCherryPicker cherryPicker = getCherryPickerOrReportError(details); if (cherryPicker == null) { isOk = false; break; } groupedCommits.putValue(cherryPicker, details); } if (isOk) { for (Map.Entry<VcsCherryPicker, Collection<VcsFullCommitDetails>> entry : groupedCommits.entrySet()) { entry.getKey().cherryPick(new ArrayList<>(entry.getValue())); } } } finally { ApplicationManager.getApplication().invokeLater(() -> { myChangeListManager.unblockModalNotifications(); for (VcsFullCommitDetails details : myAllDetailsInReverseOrder) { myIdsInProgress.remove(new CommitId(details.getId(), details.getRoot())); } }); } }
run
275,939
Collection<VcsFullCommitDetails> () { return new ArrayList<>(); }
createCollection
275,940
VcsCherryPickManager (@NotNull Project project) { return project.getService(VcsCherryPickManager.class); }
getInstance
275,941
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
275,942
void (@NotNull AnActionEvent e) { FileDocumentManager.getInstance().saveAllDocuments(); Project project = e.getRequiredData(CommonDataKeys.PROJECT); VcsLogCommitSelection selection = e.getRequiredData(VcsLogDataKeys.VCS_LOG_COMMIT_SELECTION); VcsCherryPickManager.getInstance(project).cherryPick(selection); }
actionPerformed
275,943
void (@NotNull AnActionEvent e) { super.update(e); e.getPresentation().setVisible(true); Project project = e.getProject(); VcsLogCommitSelection selection = e.getData(VcsLogDataKeys.VCS_LOG_COMMIT_SELECTION); if (selection == null || project == null) { e.getPresentation().setEnabledAndVisible(false); return; } VcsCherryPickManager cherryPickManager = VcsCherryPickManager.getInstance(project); List<VcsCherryPicker> cherryPickers = getActiveCherryPickersForProject(project); if (cherryPickers.isEmpty()) { e.getPresentation().setEnabledAndVisible(false); return; } List<CommitId> commits = ContainerUtil.getFirstItems(selection.getCommits(), VcsLogUtil.MAX_SELECTED_COMMITS); if (commits.isEmpty() || cherryPickManager.isCherryPickAlreadyStartedFor(commits)) { e.getPresentation().setEnabled(false); return; } final Map<VirtualFile, List<Hash>> groupedByRoot = groupByRoot(commits); VcsCherryPicker activeCherryPicker = getActiveCherryPicker(cherryPickers, groupedByRoot.keySet()); e.getPresentation().setEnabled(activeCherryPicker != null); e.getPresentation() .setText(activeCherryPicker == null ? concatActionNamesForAllAvailable(cherryPickers) : activeCherryPicker.getActionTitle()); e.getPresentation().setDescription(activeCherryPicker != null ? "" : DvcsBundle.message("cherry.pick.action.description")); }
update
275,944
VcsCherryPicker (@NotNull List<? extends VcsCherryPicker> cherryPickers, @NotNull Collection<? extends VirtualFile> roots) { return ContainerUtil.find(cherryPickers, picker -> picker.canHandleForRoots(roots)); }
getActiveCherryPicker
275,945
String (final @NotNull List<? extends VcsCherryPicker> pickers) { return StringUtil.join(pickers, VcsCherryPicker::getActionTitle, "/"); }
concatActionNamesForAllAvailable
275,946
List<VcsCherryPicker> (@Nullable final Project project) { if (project != null) { final ProjectLevelVcsManager projectLevelVcsManager = ProjectLevelVcsManager.getInstance(project); AbstractVcs[] vcss = projectLevelVcsManager.getAllActiveVcss(); return ContainerUtil.mapNotNull(vcss, vcs -> vcs != null ? VcsCherryPickManager.getInstance(project) .getCherryPickerFor(vcs.getKeyInstanceMethod()) : null); } return ContainerUtil.emptyList(); }
getActiveCherryPickersForProject
275,947
void () { ShelvedChangesViewManager shelveViewManager = myProject.getServiceIfCreated(ShelvedChangesViewManager.class); if (shelveViewManager != null) shelveViewManager.updateOnVcsMappingsChanged(); }
mappingChanged
275,948
void (@Nls String t) { super.setText(t); getPreferredSize(); }
setText
275,949
void (@NotNull HyperlinkEvent e) { swapSides(); }
hyperlinkActivated
275,950
void (@NotNull CommitCompareInfo compareInfo) { myCompareInfo = compareInfo; refreshView(false); }
setCompareInfo
275,951
ChangesBrowserBase () { return myChangesBrowser; }
getChangesBrowser
275,952
void () { boolean swapSides = myVcsSettings.shouldSwapSidesInCompareBranches(); myVcsSettings.setSwapSidesInCompareBranches(!swapSides); refreshView(true); }
swapSides
275,953
void (boolean onSwapSides) { if (myCompareInfo == null) return; boolean swapSides = myVcsSettings.shouldSwapSidesInCompareBranches(); updateLabelText(); List<Change> diff = myCompareInfo.getTotalDiff(); if (swapSides) diff = DvcsBranchUtil.swapRevisions(diff); if (onSwapSides) { myChangesBrowser.setChangesToDisplay(diff, new OnSwapSidesTreeStateStrategy()); } else { myChangesBrowser.setChangesToDisplay(diff); } }
refreshView
275,954
void () { boolean swapSides = myVcsSettings.shouldSwapSidesInCompareBranches(); HtmlChunk branchNameText = HtmlChunk.text(myBranchName).code().bold(); HtmlChunk currentBranchNameText = HtmlChunk.text(myCurrentBranchName).code().bold(); String diffBetween; if (swapSides) { diffBetween = DvcsBundle.message("compare.branches.diff.panel.diff.between.files.in.branch.and.current.working.tree.on.branch", branchNameText, currentBranchNameText); } else { diffBetween = DvcsBundle.message("compare.branches.diff.panel.difference.between.current.working.tree.on.branch.and.files.in.branch", currentBranchNameText, branchNameText); } String swapBranches = DvcsBundle.message("compare.branches.diff.panel.swap.branches"); myLabel.setText(XmlStringUtil.wrapInHtml(diffBetween + "&emsp;" + HtmlChunk.link("", swapBranches))); // NON-NLS }
updateLabelText
275,955
void (@NotNull @NlsContexts.Label String text) { myChangesBrowser.getViewer().setEmptyText(text); }
setEmptyText
275,956
void () { myLabel.setEnabled(false); }
disableControls
275,957
void () { myLabel.setEnabled(true); }
enableControls
275,958
JComponent () { return myChangesBrowser.getPreferredFocusedComponent(); }
getPreferredFocusComponent
275,959
List<AnAction> () { return ContainerUtil.append( super.createToolbarActions(), ActionManager.getInstance().getAction("Vcs.GetVersion") ); }
createToolbarActions
275,960
List<AnAction> () { return ContainerUtil.append( super.createPopupMenuActions(), ActionManager.getInstance().getAction("Vcs.GetVersion") ); }
createPopupMenuActions
275,961
boolean (@NotNull AnActionEvent e) { return e.getData(DATA_KEY) != null; }
isActive
275,962
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
275,963
void (@NotNull AnActionEvent e) { CompareBranchesDiffPanel panel = e.getRequiredData(DATA_KEY); Presentation presentation = e.getPresentation(); presentation.setText(DvcsBundle.messagePointer("compare.branches.diff.panel.get.from.branch.action")); presentation.setDescription(DvcsBundle.messagePointer("compare.branches.diff.panel.get.from.branch.action.description", panel.myBranchName)); boolean isEnabled = !panel.myChangesBrowser.getSelectedChanges().isEmpty(); boolean isVisible = panel.myCompareInfo instanceof LocalCommitCompareInfo; presentation.setEnabled(isEnabled && isVisible); presentation.setVisible(isVisible); }
update
275,964
void (@NotNull AnActionEvent e) { CompareBranchesDiffPanel panel = e.getRequiredData(DATA_KEY); Project project = panel.myProject; List<Change> changes = panel.myChangesBrowser.getSelectedChanges(); boolean swapSides = panel.myVcsSettings.shouldSwapSidesInCompareBranches(); CommitCompareInfo compareInfo = panel.myCompareInfo; String title = DvcsBundle.message("compare.branches.diff.panel.get.from.branch.title", panel.myBranchName); ReplaceFileConfirmationDialog confirmationDialog = new ReplaceFileConfirmationDialog(project, title); if (!confirmationDialog.confirmFor(ChangesUtil.getFilesFromChanges(changes))) return; FileDocumentManager.getInstance().saveAllDocuments(); LocalHistoryAction action = LocalHistory.getInstance().startAction(title); new Task.Modal(project, DvcsBundle.message("compare.branches.diff.panel.loading.content.from.branch.process"), false) { @Override public void run(@NotNull ProgressIndicator indicator) { try { if (compareInfo != null) { ((LocalCommitCompareInfo)compareInfo).copyChangesFromBranch(changes, swapSides); } } catch (VcsException err) { ApplicationManager.getApplication().invokeLater(() -> Messages.showErrorDialog(myProject, err.getMessage(), DvcsBundle .message("compare.branches.diff.panel.can.not.copy.changes.error"))); } } @Override public void onFinished() { action.finish(); panel.refreshView(false); } }.queue(); }
actionPerformed
275,965
void (@NotNull ProgressIndicator indicator) { try { if (compareInfo != null) { ((LocalCommitCompareInfo)compareInfo).copyChangesFromBranch(changes, swapSides); } } catch (VcsException err) { ApplicationManager.getApplication().invokeLater(() -> Messages.showErrorDialog(myProject, err.getMessage(), DvcsBundle .message("compare.branches.diff.panel.can.not.copy.changes.error"))); } }
run
275,966
void () { action.finish(); panel.refreshView(false); }
onFinished
275,967
MyState (@NotNull ChangesTree tree) { List<Change> changes = VcsTreeModelData.selected(tree).userObjects(Change.class); return new MyState(changes); }
saveState
275,968
void (@NotNull ChangesTree tree, MyState state, boolean scrollToSelection) { if (state != null && !state.selectedChanges.isEmpty()) { tree.setSelectedChanges(DvcsBranchUtil.swapRevisions(state.selectedChanges)); } else { tree.resetTreeState(); } }
restoreState
275,969
record (@NotNull List<Change> selectedChanges) { }
MyState
275,970
void () { if (myWrapper == null) { myWrapper = new WindowWrapperBuilder(myMode, myTabbedPane) .setProject(myProject) .setTitle(myTitle) .setPreferredFocusedComponent(myLogPanel) .setDimensionServiceKey(CompareBranchesDialog.class.getName()) .build(); } myWrapper.show(); }
show
275,971
void (final @NotNull Consumer<? super VcsFullCommitDetails> listener) { myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(final ListSelectionEvent e) { ListSelectionModel lsm = (ListSelectionModel)e.getSource(); int i = lsm.getMaxSelectionIndex(); int j = lsm.getMinSelectionIndex(); if (i >= 0 && i == j) { listener.consume(myCommits.get(i)); } } }); }
addListSelectionListener
275,972
void (final ListSelectionEvent e) { ListSelectionModel lsm = (ListSelectionModel)e.getSource(); int i = lsm.getMaxSelectionIndex(); int j = lsm.getMinSelectionIndex(); if (i >= 0 && i == j) { listener.consume(myCommits.get(i)); } }
valueChanged
275,973
void (final @NotNull Consumer<? super List<Change>> listener) { myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(final ListSelectionEvent e) { List<VcsFullCommitDetails> commits = myTable.getSelectedObjects(); final List<Change> changes = new ArrayList<>(); // We need changes in asc order for zipChanges, and they are in desc order in Table ListIterator<VcsFullCommitDetails> iterator = commits.listIterator(commits.size()); while (iterator.hasPrevious()) { changes.addAll(iterator.previous().getChanges()); } listener.consume(CommittedChangesTreeBrowser.zipChanges(changes)); } }); }
addListMultipleSelectionListener
275,974
void (final ListSelectionEvent e) { List<VcsFullCommitDetails> commits = myTable.getSelectedObjects(); final List<Change> changes = new ArrayList<>(); // We need changes in asc order for zipChanges, and they are in desc order in Table ListIterator<VcsFullCommitDetails> iterator = commits.listIterator(commits.size()); while (iterator.hasPrevious()) { changes.addAll(iterator.previous().getChanges()); } listener.consume(CommittedChangesTreeBrowser.zipChanges(changes)); }
valueChanged
275,975
void (@NotNull AnAction diffAction) { diffAction.registerCustomShortcutSet(diffAction.getShortcutSet(), myTable); }
registerDiffAction
275,976
Object (@NotNull String dataId) { // Make changes available for diff action if (VcsDataKeys.CHANGES.is(dataId)) { int[] rows = myTable.getSelectedRows(); if (rows.length != 1) return null; int row = rows[0]; VcsFullCommitDetails commit = myCommits.get(row); return commit.getChanges().toArray(Change.EMPTY_CHANGE_ARRAY); } return null; }
getData
275,977
JComponent () { return myTable; }
getPreferredFocusComponent
275,978
void () { myTable.clearSelection(); }
clearSelection
275,979
void (@NotNull List<? extends VcsFullCommitDetails> commits) { myCommits.clear(); myCommits.addAll(commits); updateModel(); myTable.repaint(); }
setCommits
275,980
void () { myTable.setModelAndUpdateColumns(new ListTableModel<>(generateColumnsInfo(myCommits), myCommits, 0)); }
updateModel
275,981
String (VcsFullCommitDetails commit) { return getHash(commit); }
valueOf
275,982
String (VcsFullCommitDetails commit) { return commit.getSubject(); }
valueOf
275,983
String (VcsFullCommitDetails commit) { return getAuthor(commit); }
valueOf
275,984
String (VcsFullCommitDetails commit) { return getTime(commit); }
valueOf
275,985
ItemAndWidth (ItemAndWidth current, String candidate) { int width = myTable.getFontMetrics(myTable.getFont()).stringWidth(candidate); if (width > current.myWidth) { return new ItemAndWidth(candidate, width); } return current; }
getMax
275,986
String (VcsFullCommitDetails commit) { return DvcsUtil.getShortHash(commit.getId().toString()); }
getHash
275,987
String (VcsFullCommitDetails commit) { return VcsUserUtil.getShortPresentation(commit.getAuthor()); }
getAuthor
275,988
String (VcsFullCommitDetails commit) { return DateFormatUtil.formatPrettyDateTime(commit.getAuthorTime()); }
getTime
275,989
String () { return myMaxString; }
getMaxStringValue
275,990
int () { return UIUtil.DEFAULT_HGAP; }
getAdditionalWidth
275,991
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
275,992
void (@NotNull AnActionEvent e) { Project project = e.getRequiredData(CommonDataKeys.PROJECT); VcsLogCommitSelection selection = e.getRequiredData(VcsLogDataKeys.VCS_LOG_COMMIT_SELECTION); selection.requestFullDetails(details -> { MultiMap<Repo, VcsFullCommitDetails> grouped = groupCommits(project, details, VcsShortCommitDetails::getRoot); if (grouped == null) return; actionPerformed(project, grouped); }); }
actionPerformed
275,993
void (@NotNull AnActionEvent e) { Project project = e.getProject(); VcsLogCommitSelection selection = e.getData(VcsLogDataKeys.VCS_LOG_COMMIT_SELECTION); if (project == null || selection == null) { e.getPresentation().setEnabledAndVisible(false); return; } MultiMap<Repo, Hash> grouped = groupFirstPackOfCommits(project, selection); if (grouped == null) { e.getPresentation().setEnabledAndVisible(false); } else { e.getPresentation().setVisible(isVisible(project, grouped)); e.getPresentation().setEnabled(!grouped.isEmpty() && isEnabled(grouped)); } }
update
275,994
boolean (@NotNull Project project, @NotNull MultiMap<Repo, Hash> grouped) { RepositoryManager<Repo> manager = getRepositoryManager(project); return grouped.keySet().stream().noneMatch(manager::isExternal); }
isVisible
275,995
void (@NotNull Icon favorite, @NotNull Icon notFavorite, @NotNull Icon favoriteOnHover, @NotNull Icon notFavoriteOnHover) { myIcon = LayeredIcon.layeredIcon(new Icon[]{favorite, notFavorite}); myHoveredIcon = LayeredIcon.layeredIcon(new Icon[]{favoriteOnHover, notFavoriteOnHover}); getTemplatePresentation().setIcon(myIcon); getTemplatePresentation().setSelectedIcon(myHoveredIcon); updateIcons(); }
setIcons
275,996
void () { myIcon.setLayerEnabled(0, myIsFavorite); myHoveredIcon.setLayerEnabled(0, myIsFavorite); myIcon.setLayerEnabled(1, !myIsFavorite); myHoveredIcon.setLayerEnabled(1, !myIsFavorite); }
updateIcons
275,997
boolean () { return myIsFavorite; }
isFavorite
275,998
void (boolean favorite) { myIsFavorite = favorite; updateIcons(); }
setFavorite
275,999
void () { setFavorite(!myIsFavorite); }
toggle