本文整理汇总了Java中com.intellij.util.containers.ContainerUtil.sorted方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerUtil.sorted方法的具体用法?Java ContainerUtil.sorted怎么用?Java ContainerUtil.sorted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.containers.ContainerUtil
的用法示例。
在下文中一共展示了ContainerUtil.sorted方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createActionGroup
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
protected ActionGroup createActionGroup() {
Set<VirtualFile> roots = getAllRoots();
List<AnAction> rootActions = new ArrayList<AnAction>();
if (myColorManager.isMultipleRoots()) {
for (VirtualFile root : ContainerUtil.sorted(roots, FILE_BY_NAME_COMPARATOR)) {
rootActions.add(new SelectVisibleRootAction(root));
}
}
List<AnAction> structureActions = new ArrayList<AnAction>();
for (VcsLogStructureFilter filter : myHistory) {
structureActions.add(new SelectFromHistoryAction(filter));
}
if (roots.size() > 15) {
return new DefaultActionGroup(createAllAction(), new SelectFoldersAction(),
new Separator("Recent"), new DefaultActionGroup(structureActions),
new Separator("Roots"), new DefaultActionGroup(rootActions));
}
else {
return new DefaultActionGroup(createAllAction(), new SelectFoldersAction(),
new Separator("Roots"), new DefaultActionGroup(rootActions),
new Separator("Recent"), new DefaultActionGroup(structureActions));
}
}
示例2: build
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public static GraphLayoutImpl build(@NotNull LinearGraph graph, @NotNull Comparator<Integer> headerNodeIndexComparator) {
List<Integer> heads = new ArrayList<Integer>();
for (int i = 0; i < graph.nodesCount(); i++) {
if (getUpNodes(graph, i).size() == 0) {
heads.add(i);
}
}
try {
heads = ContainerUtil.sorted(heads, headerNodeIndexComparator);
}
catch (ProcessCanceledException pce) {
throw pce;
}
catch (Exception e) {
// protection against possible comparator flaws
LOG.error(e);
}
GraphLayoutBuilder builder = new GraphLayoutBuilder(graph, heads, new DfsUtil());
return builder.build();
}
示例3: performCopy
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public void performCopy(@NotNull DataContext dataContext) {
List<TreePath> paths = ContainerUtil.sorted(Arrays.asList(ObjectUtils.assertNotNull(myTree.getSelectionPaths())),
TreeUtil.getDisplayOrderComparator(myTree));
CopyPasteManager.getInstance().setContents(new StringSelection(StringUtil.join(paths, new Function<TreePath, String>() {
@Override
public String fun(TreePath path) {
Object node = path.getLastPathComponent();
if (node instanceof ChangesBrowserNode) {
return ((ChangesBrowserNode)node).getTextPresentation();
}
else {
return node.toString();
}
}
}, "\n")));
}
示例4: Merger
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public Merger(final SvnVcs vcs,
final List<CommittedChangeList> changeLists,
final File target,
final UpdateEventHandler handler,
final SVNURL currentBranchUrl,
String branchName,
boolean recordOnly,
boolean invertRange,
boolean groupSequentialChangeLists) {
myBranchName = branchName;
myVcs = vcs;
myProject = vcs.getProject();
mySvnConfig = SvnConfiguration.getInstance(vcs.getProject());
myCurrentBranchUrl = currentBranchUrl;
myChangeLists = ContainerUtil.sorted(changeLists, ByNumberChangeListComparator.getInstance());
myTarget = target;
myProgressIndicator = ProgressManager.getInstance().getProgressIndicator();
myHandler = handler;
myCommitMessage = new StringBuilder();
myRecordOnly = recordOnly;
myInvertRange = invertRange;
myGroupSequentialChangeLists = groupSequentialChangeLists;
}
示例5: getSelectedTopLevelSymbols
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
/**
* @return selected elements in the same order as they are declared in the original file
*/
@NotNull
public List<PyElement> getSelectedTopLevelSymbols() {
final Collection<PyModuleMemberInfo> selectedMembers = myMemberSelectionTable.getSelectedMemberInfos();
final List<PyElement> selectedElements = ContainerUtil.map(selectedMembers, new Function<PyModuleMemberInfo, PyElement>() {
@Override
public PyElement fun(PyModuleMemberInfo info) {
return info.getMember();
}
});
return ContainerUtil.sorted(selectedElements, new Comparator<PyElement>() {
@Override
public int compare(PyElement e1, PyElement e2) {
return PyPsiUtils.isBefore(e1, e2) ? -1 : 1;
}
});
}
示例6: calcLogProvidersHash
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static int calcLogProvidersHash(@NotNull final Map<VirtualFile, VcsLogProvider> logProviders) {
List<VirtualFile> sortedRoots = ContainerUtil.sorted(logProviders.keySet(), new Comparator<VirtualFile>() {
@Override
public int compare(@NotNull VirtualFile o1, @NotNull VirtualFile o2) {
return o1.getPath().compareTo(o2.getPath());
}
});
return StringUtil.join(sortedRoots, new Function<VirtualFile, String>() {
@Override
public String fun(VirtualFile root) {
return root.getPath() + "." + logProviders.get(root).getSupportedVcs().getName();
}
}, ".").hashCode();
}
示例7: getContainingBranches
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public List<String> getContainingBranches(VcsLogDataHolder dataHolder) {
try {
VcsLogProvider provider = dataHolder.getLogProvider(root);
if (graph != null && refs != null && VcsLogProperties.get(provider, VcsLogProperties.LIGHTWEIGHT_BRANCHES)) {
Set<Integer> branchesIndexes = graph.getContainingBranches(dataHolder.getCommitIndex(hash));
Collection<VcsRef> branchesRefs = new HashSet<VcsRef>();
for (Integer index : branchesIndexes) {
branchesRefs.addAll(refs.refsToCommit(index));
}
branchesRefs = ContainerUtil.sorted(branchesRefs, provider.getReferenceManager().getLabelsOrderComparator());
ArrayList<String> branchesList = new ArrayList<String>();
for (VcsRef ref : branchesRefs) {
if (ref.getType().isBranch()) {
branchesList.add(ref.getName());
}
}
return branchesList;
}
else {
List<String> branches = new ArrayList<String>(provider.getContainingBranches(root, hash));
Collections.sort(branches);
return branches;
}
}
catch (VcsException e) {
LOG.warn(e);
return Collections.emptyList();
}
}
示例8: collectLabelsForRefs
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
private Map<String, Color> collectLabelsForRefs(@NotNull Collection<VcsRef> refs) {
if (refs.isEmpty()) {
return Collections.emptyMap();
}
VirtualFile root = refs.iterator().next().getRoot(); // all refs are from the same commit => they have the same root
refs = ContainerUtil.sorted(refs, myDataHolder.getLogProvider(root).getReferenceManager().getLabelsOrderComparator());
List<VcsRef> branches = getBranches(refs);
Collection<VcsRef> tags = ContainerUtil.subtract(refs, branches);
return getLabelsForRefs(branches, tags);
}
示例9: Selection
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public Selection(@NotNull VcsLogGraphTable table) {
myTable = table;
List<Integer> selectedRows = ContainerUtil.sorted(toList(myTable.getSelectedRows()));
Couple<Integer> visibleRows = ScrollingUtil.getVisibleRows(myTable);
myScrollToTop = visibleRows.first - 1 == 0;
VisibleGraph<Integer> graph = myTable.getVisibleGraph();
mySelectedCommits = new TIntHashSet();
Integer visibleSelectedCommit = null;
Integer delta = null;
for (int row : selectedRows) {
if (row < graph.getVisibleCommitCount()) {
Integer commit = graph.getRowInfo(row).getCommit();
mySelectedCommits.add(commit);
if (visibleRows.first - 1 <= row && row <= visibleRows.second && visibleSelectedCommit == null) {
visibleSelectedCommit = commit;
delta = myTable.getCellRect(row, 0, false).y - myTable.getVisibleRect().y;
}
}
}
if (visibleSelectedCommit == null && visibleRows.first - 1 >= 0) {
visibleSelectedCommit = graph.getRowInfo(visibleRows.first - 1).getCommit();
delta = myTable.getCellRect(visibleRows.first - 1, 0, false).y - myTable.getVisibleRect().y;
}
myVisibleSelectedCommit = visibleSelectedCommit;
myDelta = delta;
}
示例10: PointMerger
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public PointMerger(final SvnVcs vcs,
CommittedChangeList selectedChangeList,
final File target,
final UpdateEventHandler handler,
final SVNURL currentBranchUrl,
@NotNull List<Change> selectedChanges,
String branchName) {
super(vcs, ContainerUtil.newArrayList(selectedChangeList), target, handler, currentBranchUrl, branchName);
mySelectedChanges = ContainerUtil.sorted(selectedChanges, ChangesComparator.getInstance());
}
示例11: getFragment
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
public MergeFragment getFragment(int mergeCommit) {
List<Integer> downNodes = ContainerUtil.sorted(LinearGraphUtils.getDownNodes(myLinearBekGraph, mergeCommit));
if (downNodes.size() != 2) return null;
return getFragment(downNodes.get(1), downNodes.get(0), mergeCommit);
}
示例12: sortChanges
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
protected List<Change> sortChanges(final List<Change> list) {
List<Change> sortedList;
try {
sortedList = ContainerUtil.sorted(list, ChangesComparator.getInstance(myViewer.isShowFlatten()));
}
catch (IllegalArgumentException e) {
sortedList = ContainerUtil.newArrayList(list);
LOG.error("Couldn't sort these changes: " + list, e);
}
return sortedList;
}
示例13: PyMoveSymbolProcessor
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public PyMoveSymbolProcessor(@NotNull final PsiNamedElement element,
@NotNull PyFile destination,
@NotNull Collection<UsageInfo> usages,
@NotNull PsiElement[] otherElements) {
myMovedElement = element;
myDestinationFile = destination;
myAllMovedElements = otherElements;
myUsages = ContainerUtil.sorted(usages, new Comparator<UsageInfo>() {
@Override
public int compare(UsageInfo u1, UsageInfo u2) {
return PsiUtilCore.compareElementsByPosition(u1.getElement(), u2.getElement());
}
});
}
示例14: getTargetNames
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public static List<String> getTargetNames(@NotNull HgRepository repository) {
return ContainerUtil.sorted(ContainerUtil.map(repository.getRepositoryConfig().getPaths(), new Function<String, String>() {
@Override
public String fun(String s) {
return removePasswordIfNeeded(s);
}
}));
}
示例15: getTargetNames
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
private static List<String> getTargetNames(@NotNull GitRepository repository) {
List<GitRemoteBranch> remoteBranches = ContainerUtil.sorted(repository.getBranches().getRemoteBranches(), REMOTE_BRANCH_COMPARATOR);
return ContainerUtil.map(remoteBranches, new Function<GitRemoteBranch, String>() {
@Override
public String fun(GitRemoteBranch branch) {
return branch.getNameForRemoteOperations();
}
});
}