本文整理汇总了Java中com.intellij.util.containers.ContainerUtil.newArrayList方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerUtil.newArrayList方法的具体用法?Java ContainerUtil.newArrayList怎么用?Java ContainerUtil.newArrayList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.containers.ContainerUtil
的用法示例。
在下文中一共展示了ContainerUtil.newArrayList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public StatsResponse call() throws Exception {
final RequestConfig.Builder builder = RequestConfig
.custom()
.setConnectTimeout(TIMEOUT)
.setConnectionRequestTimeout(TIMEOUT)
.setSocketTimeout(TIMEOUT);
IdeHttpClientHelpers.ApacheHttpClient4.setProxyForUrlIfEnabled(builder, HybrisConstants.STATS_COLLECTOR_URL);
final RequestConfig config = builder.build();
final HttpClient client = HttpClientBuilder.create().setDefaultRequestConfig(config).build();
final List<NameValuePair> patchedUrlParameters = ContainerUtil.newArrayList(urlParameters);
patchUrlParameters(patchedUrlParameters);
final HttpPost post = new HttpPost(HybrisConstants.STATS_COLLECTOR_URL);
post.setEntity(new UrlEncodedFormEntity(patchedUrlParameters, UTF_8));
return new StatsResponse(client.execute(post));
}
示例2: multiResolve
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(final boolean incompleteCode) {
final PsiFile originalFile = getElement().getContainingFile();
final Collection<ImpexMacroDeclaration> macroDeclarations =
PsiTreeUtil.findChildrenOfType(
originalFile,
ImpexMacroDeclaration.class
);
if (!macroDeclarations.isEmpty()) {
final ArrayList<PsiElement> references = ContainerUtil.newArrayList();
for (final ImpexMacroDeclaration declaration : macroDeclarations) {
if (getElement().textMatches(declaration.getFirstChild())) {
references.add(declaration.getFirstChild());
}
}
return PsiElementResolveResult.createResults(references);
}
return ResolveResult.EMPTY_ARRAY;
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:23,代码来源:ImpexMacrosReferenceBase.java
示例3: expandExpandableGroups
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static Collection<RefGroup> expandExpandableGroups(List<RefGroup> refGroups) {
Collection<RefGroup> groups = ContainerUtil.newArrayList();
for (RefGroup group : refGroups) {
if (group.isExpanded()) {
groups.addAll(ContainerUtil.map(group.getRefs(), new Function<VcsRef, RefGroup>() {
@Override
public RefGroup fun(VcsRef ref) {
return new SingletonRefGroup(ref);
}
}));
}
else {
groups.add(group);
}
}
return groups;
}
示例4: findRunningConsole
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public static Collection<RunContentDescriptor> findRunningConsole(@NotNull Project project,
@NotNull NotNullFunction<RunContentDescriptor, Boolean> descriptorMatcher) {
RunContentManager contentManager = ExecutionManager.getInstance(project).getContentManager();
final RunContentDescriptor selectedContent = contentManager.getSelectedContent();
if (selectedContent != null) {
final ToolWindow toolWindow = contentManager.getToolWindowByDescriptor(selectedContent);
if (toolWindow != null && toolWindow.isVisible()) {
if (descriptorMatcher.fun(selectedContent)) {
return Collections.singletonList(selectedContent);
}
}
}
final ArrayList<RunContentDescriptor> result = ContainerUtil.newArrayList();
for (RunContentDescriptor runContentDescriptor : contentManager.getAllDescriptors()) {
if (descriptorMatcher.fun(runContentDescriptor)) {
result.add(runContentDescriptor);
}
}
return result;
}
示例5: withInstanceofValue
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
public DfaVariableState withInstanceofValue(DfaTypeValue dfaType) {
if (dfaType.getDfaType().getPsiType() instanceof PsiPrimitiveType) return this;
if (checkInstanceofValue(dfaType.getDfaType())) {
DfaVariableState result = dfaType.isNullable() ? withNullability(Nullness.NULLABLE) : this;
List<DfaPsiType> moreGeneric = ContainerUtil.newArrayList();
for (DfaPsiType alreadyInstanceof : myInstanceofValues) {
if (dfaType.getDfaType().isAssignableFrom(alreadyInstanceof)) {
return result;
}
if (alreadyInstanceof.isAssignableFrom(dfaType.getDfaType())) {
moreGeneric.add(alreadyInstanceof);
}
}
HashSet<DfaPsiType> newInstanceof = ContainerUtil.newHashSet(myInstanceofValues);
newInstanceof.removeAll(moreGeneric);
newInstanceof.add(dfaType.getDfaType());
result = createCopy(newInstanceof, myNotInstanceofValues, result.myNullability);
return result;
}
return null;
}
示例6: doTest
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private void doTest(final String relativePath) {
loadProject(relativePath);
List<JpsTypedRunConfiguration<JpsApplicationRunConfigurationProperties>>
configurations = ContainerUtil.newArrayList(myProject.getRunConfigurations(JpsApplicationRunConfigurationType.INSTANCE));
assertEquals(2, configurations.size());
JpsTypedRunConfiguration<JpsApplicationRunConfigurationProperties> shared = configurations.get(0);
assertEquals("shared", shared.getName());
assertEquals("xxx.Main2", shared.getProperties().getMainClass());
JpsTypedRunConfiguration<JpsApplicationRunConfigurationProperties> main = configurations.get(1);
assertEquals("Main", main.getName());
assertEquals("xxx.Main", main.getProperties().getMainClass());
List<JpsRunConfiguration> all = myProject.getRunConfigurations();
JpsRunConfiguration junit = findByName(all, "test");
JpsRunConfigurationType type = ((JpsTypedRunConfiguration)junit).getType();
assertEquals("JUnit", assertInstanceOf(type, JpsUnknownRunConfigurationType.class).getTypeId());
}
示例7: groupCommitsByRoots
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public static <R extends Repository> Map<R, List<VcsFullCommitDetails>> groupCommitsByRoots(@NotNull RepositoryManager<R> repoManager,
@NotNull List<? extends VcsFullCommitDetails> commits) {
Map<R, List<VcsFullCommitDetails>> groupedCommits = ContainerUtil.newHashMap();
for (VcsFullCommitDetails commit : commits) {
R repository = repoManager.getRepositoryForRoot(commit.getRoot());
if (repository == null) {
LOGGER.info("No repository found for commit " + commit);
continue;
}
List<VcsFullCommitDetails> commitsInRoot = groupedCommits.get(repository);
if (commitsInRoot == null) {
commitsInRoot = ContainerUtil.newArrayList();
groupedCommits.put(repository, commitsInRoot);
}
commitsInRoot.add(commit);
}
return groupedCommits;
}
示例8: collectDetails
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private List<Change> collectDetails(@NotNull List<Change> changes, @NotNull Set<Pair<Boolean, String>> duplicates)
throws VcsException {
List<Change> result = ContainerUtil.newArrayList();
for (Change change : changes) {
// directory statuses are already uploaded
if ((change.getAfterRevision() == null) && (change.getBeforeRevision().getFile().isDirectory())) {
result.addAll(getChildrenAsChanges(change.getBeforeRevision(), true, duplicates));
} else if ((change.getBeforeRevision() == null) && (change.getAfterRevision().getFile().isDirectory())) {
// look for renamed folders contents
if (myCopiedAddedPaths.containsKey(getRelativePath(change.getAfterRevision()))) {
result.addAll(getChildrenAsChanges(change.getAfterRevision(), false, duplicates));
}
} else if ((change.isIsReplaced() || change.isMoved() || change.isRenamed()) && change.getAfterRevision().getFile().isDirectory()) {
result.addAll(getChildrenAsChanges(change.getBeforeRevision(), true, duplicates));
result.addAll(getChildrenAsChanges(change.getAfterRevision(), false, duplicates));
}
}
return result;
}
示例9: getUnhandledExceptions
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static List<PsiClassType> getUnhandledExceptions(PsiElement element,
PsiElement topElement,
PsiSubstitutor substitutor,
PsiClassType[] referencedTypes) {
if (referencedTypes.length > 0) {
List<PsiClassType> result = ContainerUtil.newArrayList();
for (PsiClassType referencedType : referencedTypes) {
final PsiType type = PsiClassImplUtil.correctType(GenericsUtil.eliminateWildcards(substitutor.substitute(referencedType), false), element.getResolveScope());
if (!(type instanceof PsiClassType)) continue;
PsiClassType classType = (PsiClassType)type;
PsiClass exceptionClass = ((PsiClassType)type).resolve();
if (exceptionClass == null) continue;
if (isUncheckedException(classType)) continue;
if (isHandled(element, classType, topElement)) continue;
result.add((PsiClassType)type);
}
return result;
}
return Collections.emptyList();
}
示例10: deserialize
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
@Override
public ArrangementSettings deserialize(@NotNull Element element) {
final Set<StdArrangementRuleAliasToken> tokensDefinition = deserializeTokensDefinition(element, myDefaultSettings);
final List<ArrangementGroupingRule> groupingRules = deserializeGropings(element, myDefaultSettings);
final Element rulesElement = element.getChild(RULES_ELEMENT_NAME);
final List<ArrangementSectionRule> sectionRules = ContainerUtil.newArrayList();
if(rulesElement == null) {
sectionRules.addAll(myDefaultSettings.getSections());
}
else {
sectionRules.addAll(deserializeSectionRules(rulesElement, tokensDefinition));
if (sectionRules.isEmpty()) {
// for backward compatibility
final List<StdArrangementMatchRule> rules = deserializeRules(rulesElement, tokensDefinition);
return StdArrangementSettings.createByMatchRules(groupingRules, rules);
}
}
if (tokensDefinition == null) {
return new StdArrangementSettings(groupingRules, sectionRules);
}
return new StdArrangementExtendableSettings(groupingRules, sectionRules, tokensDefinition);
}
示例11: convertToHtml
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public static String convertToHtml(@NotNull String content) {
ArrayList<String> lines = ContainerUtil.newArrayList(content.split("\n|\r|\r\n"));
MarkdownUtil.replaceHeaders(lines);
MarkdownUtil.replaceCodeBlock(lines);
return new MarkdownProcessor().markdown(StringUtil.join(lines, "\n"));
}
示例12: getCurrentChangelistChanges
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
private static List<Change> getCurrentChangelistChanges(final Project project) {
final ChangeListManager clManager = ChangeListManager.getInstance(project);
ChangeList list = clManager.getDefaultChangeList();
if (list != null) {
return ContainerUtil.newArrayList(list.getChanges());
}
return Collections.emptyList();
}
示例13: testDefaultCustomTokenSerialize
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Test
public void testDefaultCustomTokenSerialize() {
final Set<StdArrangementRuleAliasToken> tokens = ContainerUtil.newHashSet(visibilityToken());
final ArrayList<ArrangementGroupingRule> groupings =
ContainerUtil.newArrayList(new ArrangementGroupingRule(OVERRIDDEN_METHODS, BY_NAME));
final ArrayList<ArrangementSectionRule> rules = ContainerUtil.newArrayList(section(true, FIELD));
final StdArrangementExtendableSettings settings = extendableSettings(groupings, rules, tokens);
final Element holder = doSerializationTest(settings, settings.clone());
assertTrue(holder.getChildren().isEmpty());
}
示例14: getRefsToDisplayOnPanel
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
private LinkedHashMap<VirtualFile, List<RefGroup>> getRefsToDisplayOnPanel(@NotNull VcsLogRefs refsModel) {
Collection<VcsRef> allRefs = refsModel.getBranches();
LinkedHashMap<VirtualFile, List<RefGroup>> groups = ContainerUtil.newLinkedHashMap();
for (Map.Entry<VirtualFile, Collection<VcsRef>> entry : VcsLogUtil.groupRefsByRoot(allRefs).entrySet()) {
VirtualFile root = entry.getKey();
List<RefGroup> list = ContainerUtil.newArrayList();
list.addAll(expandExpandableGroups(myDataHolder.getLogProvider(root).getReferenceManager().group(entry.getValue())));
groups.put(root, list);
}
return groups;
}
示例15: parse
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public static List<GitPushNativeResult> parse(@NotNull List<String> output) {
List<GitPushNativeResult> results = ContainerUtil.newArrayList();
for (String line : output) {
Matcher matcher = PATTERN.matcher(line);
if (matcher.matches()) {
results.add(parseRefResult(matcher, line));
}
}
return results;
}