本文整理汇总了Java中com.intellij.util.containers.ContainerUtil.newLinkedHashSet方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerUtil.newLinkedHashSet方法的具体用法?Java ContainerUtil.newLinkedHashSet怎么用?Java ContainerUtil.newLinkedHashSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.containers.ContainerUtil
的用法示例。
在下文中一共展示了ContainerUtil.newLinkedHashSet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doReopenLastProject
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
protected void doReopenLastProject() {
GeneralSettings generalSettings = GeneralSettings.getInstance();
if (generalSettings.isReopenLastProject()) {
Set<String> openPaths;
boolean forceNewFrame = true;
synchronized (myStateLock) {
openPaths = ContainerUtil.newLinkedHashSet(myState.openPaths);
if (openPaths.isEmpty()) {
openPaths = ContainerUtil.createMaybeSingletonSet(myState.lastPath);
forceNewFrame = false;
}
}
for (String openPath : openPaths) {
if (isValidProjectPath(openPath)) {
doOpenProject(openPath, null, forceNewFrame);
}
}
}
}
示例2: collectRelatedItems
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public static List<GotoRelatedItem> collectRelatedItems(@NotNull PsiElement contextElement, @Nullable DataContext dataContext) {
Set<GotoRelatedItem> items = ContainerUtil.newLinkedHashSet();
for (GotoRelatedProvider provider : Extensions.getExtensions(GotoRelatedProvider.EP_NAME)) {
items.addAll(provider.getItems(contextElement));
if (dataContext != null) {
items.addAll(provider.getItems(dataContext));
}
}
GotoRelatedItem[] result = items.toArray(new GotoRelatedItem[items.size()]);
Arrays.sort(result, new Comparator<GotoRelatedItem>() {
@Override
public int compare(GotoRelatedItem i1, GotoRelatedItem i2) {
String o1 = i1.getGroup();
String o2 = i2.getGroup();
return StringUtil.isEmpty(o1) ? 1 : StringUtil.isEmpty(o2) ? -1 : o1.compareTo(o2);
}
});
return Arrays.asList(result);
}
示例3: DfaMemoryStateImpl
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
protected DfaMemoryStateImpl(DfaMemoryStateImpl toCopy) {
myFactory = toCopy.myFactory;
myEphemeral = toCopy.myEphemeral;
myDefaultVariableStates = toCopy.myDefaultVariableStates; // shared between all states
myStack = new Stack<DfaValue>(toCopy.myStack);
myDistinctClasses = new TLongHashSet(toCopy.myDistinctClasses.toArray());
myUnknownVariables = ContainerUtil.newLinkedHashSet(toCopy.myUnknownVariables);
myEqClasses = ContainerUtil.newArrayList(toCopy.myEqClasses);
myIdToEqClassesIndices = new MyIdMap(toCopy.myIdToEqClassesIndices.size());
toCopy.myIdToEqClassesIndices.forEachEntry(new TIntObjectProcedure<int[]>() {
@Override
public boolean execute(int id, int[] set) {
myIdToEqClassesIndices.put(id, set);
return true;
}
});
myVariableStates = ContainerUtil.newLinkedHashMap(toCopy.myVariableStates);
myCachedDistinctClassPairs = toCopy.myCachedDistinctClassPairs;
myCachedNonTrivialEqClasses = toCopy.myCachedNonTrivialEqClasses;
myCachedHash = toCopy.myCachedHash;
}
示例4: getDefaultMessageFor
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
public String getDefaultMessageFor(FilePath[] filesToCheckin) {
LinkedHashSet<String> messages = ContainerUtil.newLinkedHashSet();
for (VirtualFile root : GitUtil.gitRoots(Arrays.asList(filesToCheckin))) {
VirtualFile mergeMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_MERGE_MSG);
VirtualFile squashMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_SQUASH_MSG);
try {
if (mergeMsg == null && squashMsg == null) {
continue;
}
String encoding = GitConfigUtil.getCommitEncoding(myProject, root);
if (mergeMsg != null) {
messages.add(loadMessage(mergeMsg, encoding));
}
else {
messages.add(loadMessage(squashMsg, encoding));
}
}
catch (IOException e) {
if (log.isDebugEnabled()) {
log.debug("Unable to load merge message", e);
}
}
}
return DvcsUtil.joinMessagesOrNull(messages);
}
示例5: getCallCandidates
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static Set<Pair<PsiMethod, PsiSubstitutor>> getCallCandidates(PsiCall expression) {
Set<Pair<PsiMethod, PsiSubstitutor>> candidates = ContainerUtil.newLinkedHashSet();
JavaResolveResult[] results;
if (expression instanceof PsiMethodCallExpression) {
results = ((PsiMethodCallExpression)expression).getMethodExpression().multiResolve(false);
} else {
results = new JavaResolveResult[]{expression.resolveMethodGenerics()};
}
for (final JavaResolveResult candidate : results) {
final PsiElement element = candidate.getElement();
if (element instanceof PsiMethod) {
final PsiClass psiClass = ((PsiMethod)element).getContainingClass();
if (psiClass != null) {
for (Pair<PsiMethod, PsiSubstitutor> overload : psiClass.findMethodsAndTheirSubstitutorsByName(((PsiMethod)element).getName(), true)) {
candidates.add(Pair.create(overload.first, candidate.getSubstitutor().putAll(overload.second)));
}
break;
}
}
}
return candidates;
}
示例6: getWidestUseScope
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
private static GlobalSearchScope getWidestUseScope(@Nullable String key, @NotNull Project project, @NotNull Module ownModule) {
if (key == null) return null;
Set<Module> modules = ContainerUtil.newLinkedHashSet();
for (IProperty property : PropertiesImplUtil.findPropertiesByKey(project, key)) {
Module module = ModuleUtilCore.findModuleForPsiElement(property.getPsiElement());
if (module == null) {
return GlobalSearchScope.allScope(project);
}
if (module != ownModule) {
modules.add(module);
}
}
if (modules.isEmpty()) return null;
List<Module> list = ContainerUtil.newArrayList(modules);
GlobalSearchScope result = GlobalSearchScope.moduleWithDependentsScope(list.get(0));
for (int i = 1; i < list.size(); i++) {
result = result.uniteWith(GlobalSearchScope.moduleWithDependentsScope(list.get(i)));
}
return result;
}
示例7: getLibraryOrderEntries
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
private LinkedHashSet<OrderEntry> getLibraryOrderEntries(@NotNull List<VirtualFile> hierarchy,
@Nullable VirtualFile libraryClassRoot,
@Nullable VirtualFile librarySourceRoot,
@NotNull MultiMap<VirtualFile, OrderEntry> libClassRootEntries,
@NotNull MultiMap<VirtualFile, OrderEntry> libSourceRootEntries) {
LinkedHashSet<OrderEntry> orderEntries = ContainerUtil.newLinkedHashSet();
for (VirtualFile root : hierarchy) {
if (root.equals(libraryClassRoot) && !sourceRootOf.containsKey(root)) {
orderEntries.addAll(libClassRootEntries.get(root));
}
if (root.equals(librarySourceRoot) && libraryClassRoot == null) {
orderEntries.addAll(libSourceRootEntries.get(root));
}
if (libClassRootEntries.containsKey(root) || sourceRootOf.containsKey(root) && librarySourceRoot == null) {
break;
}
}
return orderEntries;
}
示例8: getSelectedElements
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
final Set<Object> getSelectedElements() {
TreePath[] paths = myTree.getSelectionPaths();
Set<Object> result = ContainerUtil.newLinkedHashSet();
if (paths != null) {
for (TreePath eachPath : paths) {
if (eachPath.getLastPathComponent() instanceof DefaultMutableTreeNode) {
DefaultMutableTreeNode eachNode = (DefaultMutableTreeNode)eachPath.getLastPathComponent();
if (eachNode == myRootNode && !myTree.isRootVisible()) continue;
Object eachElement = getElementFor(eachNode);
if (eachElement != null) {
result.add(eachElement);
}
}
}
}
return result;
}
示例9: collectFragmentsToCollapse
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
private Set<LinearBekGraphBuilder.MergeFragment> collectFragmentsToCollapse(GraphNode node) {
Set<LinearBekGraphBuilder.MergeFragment> result = ContainerUtil.newHashSet();
int mergesCount = 0;
LinkedHashSet<Integer> toProcess = ContainerUtil.newLinkedHashSet();
toProcess.add(node.getNodeIndex());
while (!toProcess.isEmpty()) {
Integer i = ContainerUtil.getFirstItem(toProcess);
toProcess.remove(i);
LinearBekGraphBuilder.MergeFragment fragment = myLinearBekGraphBuilder.getFragment(i);
if (fragment == null) continue;
result.add(fragment);
toProcess.addAll(fragment.getTailsAndBody());
mergesCount++;
if (mergesCount > 10) break;
}
return result;
}
示例10: getFileSet
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
/**
* @return a set of valid files that are in the history, oldest first.
*/
public LinkedHashSet<VirtualFile> getFileSet() {
LinkedHashSet<VirtualFile> result = ContainerUtil.newLinkedHashSet();
for (VirtualFile file : getFiles()) {
// if the file occurs several times in the history, only its last occurrence counts
result.remove(file);
result.add(file);
}
return result;
}
示例11: findAllStylintExe
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public static List<File> findAllStylintExe() {
Set<File> exes = ContainerUtil.newLinkedHashSet();
// TODO looks like on windows it only searches system path and not user's
List<File> fromPath = PathEnvironmentVariableUtil.findAllExeFilesInPath(NodeFinder.getBinName("stylint"));
exes.addAll(fromPath);
return ContainerUtil.newArrayList(exes);
}
示例12: getDistinctClassPairs
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
LinkedHashSet<UnorderedPair<EqClass>> getDistinctClassPairs() {
if (myCachedDistinctClassPairs != null) return myCachedDistinctClassPairs;
LinkedHashSet<UnorderedPair<EqClass>> result = ContainerUtil.newLinkedHashSet();
for (long encodedPair : myDistinctClasses.toArray()) {
result.add(new UnorderedPair<EqClass>(myEqClasses.get(low(encodedPair)), myEqClasses.get(high(encodedPair))));
}
return myCachedDistinctClassPairs = result;
}
示例13: flushFields
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public void flushFields() {
Set<DfaVariableValue> vars = ContainerUtil.newLinkedHashSet(getChangedVariables());
for (EqClass aClass : myEqClasses) {
if (aClass != null) {
vars.addAll(aClass.getVariables(true));
}
}
for (DfaVariableValue value : vars) {
if (value.isFlushableByCalls()) {
doFlush(value, shouldMarkUnknown(value));
}
}
}
示例14: getVariantsWithSameQualifierImpl
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private Set<String> getVariantsWithSameQualifierImpl() {
if (myQualifier != null && myQualifier.getType() != null) return Collections.emptySet();
final PsiElement scope = PsiTreeUtil.getParentOfType(myRefExpr, GrMember.class, PsiFile.class);
Set<String> result = ContainerUtil.newLinkedHashSet();
if (scope != null) {
addVariantsWithSameQualifier(scope, result);
}
return result;
}
示例15: getAllRoots
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
Set<VirtualFile> getAllRoots() {
LinkedHashSet<VirtualFile> result = ContainerUtil.newLinkedHashSet();
result.addAll(classAndSourceRoots);
result.addAll(contentRootOf.keySet());
result.addAll(excludedFromLibraries.keySet());
result.addAll(excludedFromModule.keySet());
result.addAll(excludedFromProject);
return result;
}