当前位置: 首页>>代码示例>>Java>>正文


Java ContainerUtil.newSmartList方法代码示例

本文整理汇总了Java中com.intellij.util.containers.ContainerUtil.newSmartList方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerUtil.newSmartList方法的具体用法?Java ContainerUtil.newSmartList怎么用?Java ContainerUtil.newSmartList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.util.containers.ContainerUtil的用法示例。


在下文中一共展示了ContainerUtil.newSmartList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addBuildscriptLines

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private void addBuildscriptLines(@NotNull List<String> lines, @NotNull Function<String, String> padding) {
  if (!buildScriptRepositories.isEmpty() || !buildScriptDependencies.isEmpty()) {
    lines.add("buildscript {");
    final List<String> buildScriptLines = ContainerUtil.newSmartList();
    if (!buildScriptRepositories.isEmpty()) {
      buildScriptLines.add("repositories {");
      buildScriptLines.addAll(ContainerUtil.map(buildScriptRepositories, padding));
      buildScriptLines.add("}");
    }
    if (!buildScriptDependencies.isEmpty()) {
      buildScriptLines.add("dependencies {");
      buildScriptLines.addAll(ContainerUtil.map(buildScriptDependencies, padding));
      buildScriptLines.add("}");
    }
    lines.addAll(ContainerUtil.map(buildScriptLines, padding));
    lines.add("}");
    lines.add("");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:BuildScriptDataBuilder.java

示例2: getAdjacentEdges

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
@Override
public List<GraphEdge> getAdjacentEdges(int nodeIndex, @NotNull EdgeFilter filter) {
  assertNotUnderModification();
  List<GraphEdge> result = ContainerUtil.newSmartList();
  int delegateIndex = myNodesMap.getLongIndex(nodeIndex);

  // add delegate edges
  for (GraphEdge delegateEdge : myDelegatedGraph.getAdjacentEdges(delegateIndex, filter)) {
    Integer compiledUpIndex = compiledNodeIndex(delegateEdge.getUpNodeIndex());
    Integer compiledDownIndex = compiledNodeIndex(delegateEdge.getDownNodeIndex());
    if (isVisibleEdge(compiledUpIndex, compiledDownIndex)) result.add(createEdge(delegateEdge, compiledUpIndex, compiledDownIndex));
  }

  result.addAll(myEdgeStorageWrapper.getAdjacentEdges(nodeIndex, filter));

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:CollapsedGraph.java

示例3: deserializeList

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public static <T> List<T> deserializeList(@NotNull Deserializer<T> itemDeserializer,
                                          @NotNull StubInputStream stream,
                                          boolean skipNulls) throws IOException {
  short numItems = stream.readShort();

  // can't do this, we may want to add more elements to it later on
  // if (numItems == 0) return Collections.emptyList();

  List<T> result = ContainerUtil.newSmartList(); // our lists often contain only one element
  for (int i = 0; i < numItems; i++) {
    T item = itemDeserializer.deserialize(stream);
    if (item != null || skipNulls)
      result.add(item);
  }

  return result;
}
 
开发者ID:SumoLogic,项目名称:epigraph,代码行数:19,代码来源:StubSerializerUtil.java

示例4: computeOrphanData

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
@Override
public Computable<Collection<Library>> computeOrphanData(@NotNull Collection<DataNode<LibraryData>> toImport,
                                                         @NotNull final ProjectData projectData,
                                                         @NotNull Project project,
                                                         @NotNull final IdeModifiableModelsProvider modelsProvider) {
  return new Computable<Collection<Library>>() {
    @Override
    public Collection<Library> compute() {
      final List<Library> orphanIdeLibraries = ContainerUtil.newSmartList();
      final LibraryTable.ModifiableModel librariesModel = modelsProvider.getModifiableProjectLibrariesModel();
      for (Library library : librariesModel.getLibraries()) {
        if (!ExternalSystemApiUtil.isExternalSystemLibrary(library, projectData.getOwner())) continue;
        if (isOrphanProjectLibrary(library, modelsProvider)) {
          orphanIdeLibraries.add(library);
        }
      }
      return orphanIdeLibraries;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:LibraryDataService.java

示例5: findTasksUnder

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
private List<TaskActivationEntry> findTasksUnder(@NotNull SimpleNode[] nodes) {
  List<TaskActivationEntry> tasks = ContainerUtil.newSmartList();
  for (SimpleNode node : nodes) {
    if (node instanceof TaskNode) {
      final TaskNode taskNode = (TaskNode)node;
      final String taskName = taskNode.getName();
      final PhaseNode phaseNode = (PhaseNode)taskNode.getParent();
      tasks.add(new TaskActivationEntry(myProjectSystemId, phaseNode.myPhase, phaseNode.myProjectPath, taskName));
    }
    else {
      ContainerUtil.addAll(tasks, findTasksUnder(node.getChildren()));
    }
  }
  return tasks;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ConfigureTasksActivationDialog.java

示例6: visitIntersectionType

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
@Override
public PsiType visitIntersectionType(PsiIntersectionType intersectionType) {
  final List<PsiType> substituted = ContainerUtil.newSmartList();
  for (PsiType component : intersectionType.getConjuncts()) {
    PsiType mapped = mapType(component);
    if (mapped == null) return null;

    substituted.add(mapped);
  }
  return PsiIntersectionType.createIntersection(false, substituted.toArray(new PsiType[substituted.size()]));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:PsiTypeMapper.java

示例7: configure

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public void configure(CommandLineParser parser) {
  systemPropertiesCommandLineConverter.configure(parser);
  parser.allowMixedSubcommandsAndOptions();

  //noinspection unchecked
  final Collection<Option> supportedOptions = GradleCommandLineOptionsProvider.getSupportedOptions().getOptions();
  for (Option supportedOption : supportedOptions) {


    final List<String> objects = ContainerUtil.newSmartList();
    ContainerUtil.addAllNotNull(objects, supportedOption.getOpt(), supportedOption.getLongOpt());

    if (!objects.isEmpty()) {
      try {
        final CommandLineOption option = parser.option(ArrayUtil.toStringArray(objects));
        if (supportedOption.hasArg()) {
          option.hasArgument();
        }

        if (supportedOption.hasArgs()) {
          option.hasArguments();
        }
        option.hasDescription(supportedOption.getDescription());
      }
      catch (IllegalArgumentException ignore) {
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:GradleCommandLineOptionsConverter.java

示例8: parseTypeParameter

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static PsiTypeParameterStub parseTypeParameter(CharacterIterator iterator, PsiTypeParameterListStub parent) throws ClsFormatException {
  StringBuilder name = new StringBuilder();
  while (iterator.current() != ':' && iterator.current() != CharacterIterator.DONE) {
    name.append(iterator.current());
    iterator.next();
  }
  if (iterator.current() == CharacterIterator.DONE) {
    throw new ClsFormatException();
  }

  //todo parse annotations on type param
  PsiTypeParameterStub parameterStub = new PsiTypeParameterStubImpl(parent, StringRef.fromString(name.toString()));

  // postpone list allocation till a second bound is seen; ignore sole Object bound
  List<String> bounds = null;
  boolean jlo = false;
  while (iterator.current() == ':') {
    iterator.next();
    String bound = parseTopLevelClassRefSignature(iterator);
    if (bound == null) continue;
    if (bounds == null) {
      if (CommonClassNames.JAVA_LANG_OBJECT.equals(bound)) {
        jlo = true;
        continue;
      }
      bounds = ContainerUtil.newSmartList();
      if (jlo) {
        bounds.add(CommonClassNames.JAVA_LANG_OBJECT);
      }
    }
    bounds.add(bound);
  }

  StubBuildingVisitor.newReferenceList(JavaStubElementTypes.EXTENDS_BOUND_LIST, parameterStub, ArrayUtil.toStringArray(bounds));

  return parameterStub;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:SignatureParsing.java

示例9: getPackageInfo

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
private PackageInfo getPackageInfo(@NotNull final String packageName) {
  PackageInfo info = myDirectoriesByPackageNameCache.get(packageName);
  if (info == null) {
    if (myNonExistentPackages.contains(packageName)) return null;

    if (packageName.length() > Registry.intValue("java.max.package.name.length") || StringUtil.containsAnyChar(packageName, ";[/")) {
      return null;
    }

    List<VirtualFile> result = ContainerUtil.newSmartList();

    if (StringUtil.isNotEmpty(packageName) && !StringUtil.startsWithChar(packageName, '.')) {
      int i = packageName.lastIndexOf('.');
      while (true) {
        PackageInfo parentInfo = getPackageInfo(i > 0 ? packageName.substring(0, i) : "");
        if (parentInfo != null) {
          result.addAll(parentInfo.getSubPackageDirectories(packageName.substring(i + 1)));
        }
        if (i < 0) break;
        i = packageName.lastIndexOf('.', i - 1);
      }
    }

    for (VirtualFile file : myRootsByPackagePrefix.get(packageName)) {
      if (file.isDirectory()) {
        result.add(file);
      }
    }

    if (!result.isEmpty()) {
      myDirectoriesByPackageNameCache.put(packageName, info = new PackageInfo(packageName, result));
    } else {
      myNonExistentPackages.add(packageName);
    }
  }

  return info;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:PackageDirectoryCache.java

示例10: getLineExtensions

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public Collection<LineExtensionInfo> getLineExtensions(@NotNull Project project, @NotNull VirtualFile file, int lineNumber) {
  List<LineExtensionInfo> res = ContainerUtil.newSmartList();

  PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(project);
  final Document doc = FileDocumentManager.getInstance().getDocument(file);
  if (doc != null && lineNumber < doc.getLineCount()) {
    PsiFile psiFile = psiDocumentManager.getPsiFile(doc);
    if (psiFile != null) {
      int offset = doc.getLineStartOffset(lineNumber);
      FileViewProvider viewProvider = psiFile.getViewProvider();

      PsiElement element = viewProvider.findElementAt(offset);
      while (element != null) {
        int startOffset = element.getTextRange().getStartOffset();
        if (startOffset >= doc.getTextLength()) break;

        int startOffsetLine = doc.getLineNumber(startOffset);

        if (startOffsetLine < lineNumber) {
          element = PsiTreeUtil.nextVisibleLeaf(element);
          continue;
        }

        if (startOffsetLine > lineNumber) break;

        try {
          element = addExtensions(res, element);
        } catch (IndexNotReadyException ignored) { element = null; }
      }
    }
  }

  return res;
}
 
开发者ID:SumoLogic,项目名称:epigraph,代码行数:36,代码来源:SchemaRetroTagLinePainter.java

示例11: DependantSpacingImpl

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public DependantSpacingImpl(final int minSpaces,
                            final int maxSpaces,
                            @NotNull TextRange dependency,
                            final boolean keepLineBreaks,
                            final int keepBlankLines,
                            @NotNull DependentSpacingRule rule)
{
  super(minSpaces, maxSpaces, 0, false, false, keepLineBreaks, keepBlankLines, false, 0);
  myDependentRegionRanges = ContainerUtil.newSmartList(dependency);
  myRule = rule;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:DependantSpacingImpl.java

示例12: findLibraryEntriesForFile

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
private List<LibraryOrderEntry> findLibraryEntriesForFile(VirtualFile file) {
  List<LibraryOrderEntry> entries = null;

  ProjectFileIndex index = ProjectFileIndex.SERVICE.getInstance(myProject);
  for (OrderEntry entry : index.getOrderEntriesForFile(file)) {
    if (entry instanceof LibraryOrderEntry) {
      if (entries == null) entries = ContainerUtil.newSmartList();
      entries.add((LibraryOrderEntry)entry);
    }
  }

  return entries;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:AttachSourcesNotificationProvider.java

示例13: getChildren

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public static List<VirtualFile> getChildren(@NotNull VirtualFile dir, @NotNull VirtualFileFilter filter) {
  List<VirtualFile> result = null;
  for (VirtualFile child : dir.getChildren()) {
    if (filter.accept(child)) {
      if (result == null) result = ContainerUtil.newSmartList();
      result.add(child);
    }
  }
  return result != null ? result : ContainerUtil.<VirtualFile>emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:VfsUtil.java

示例14: deserializeGropings

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
private List<ArrangementGroupingRule> deserializeGropings(@NotNull Element element, @Nullable ArrangementSettings defaultSettings) {
  Element groups = element.getChild(GROUPS_ELEMENT_NAME);
  if (groups == null) {
    return defaultSettings == null ? ContainerUtil.<ArrangementGroupingRule>newSmartList() : defaultSettings.getGroupings();
  }

  final List<ArrangementGroupingRule> groupings = new ArrayList<ArrangementGroupingRule>();
  for (Object group : groups.getChildren(GROUP_ELEMENT_NAME)) {
    Element groupElement = (Element)group;

    // Grouping type.
    String groupingTypeId = groupElement.getChildText(TYPE_ELEMENT_NAME);
    ArrangementSettingsToken groupingType = StdArrangementTokens.byId(groupingTypeId);
    if (groupingType == null) {
      groupingType = myMixin.deserializeToken(groupingTypeId);
    }
    if (groupingType == null) {
      LOG.warn(String.format("Can't deserialize grouping type token by id '%s'", groupingTypeId));
      continue;
    }

    // Order type.
    String orderTypeId = groupElement.getChildText(ORDER_TYPE_ELEMENT_NAME);
    ArrangementSettingsToken orderType = StdArrangementTokens.byId(orderTypeId);
    if (orderType == null) {
      orderType = myMixin.deserializeToken(orderTypeId);
    }
    if (orderType == null) {
      LOG.warn(String.format("Can't deserialize grouping order type token by id '%s'", orderTypeId));
      continue;
    }
    groupings.add(new ArrangementGroupingRule(groupingType, orderType));
  }
  return groupings;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:DefaultArrangementSettingsSerializer.java

示例15: getPairsByElement

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
List<ProviderBinding.ProviderInfo<ProcessingContext>> getPairsByElement(@NotNull PsiElement element,
                                                                                             @NotNull PsiReferenceService.Hints hints) {

  final ProviderBinding[] bindings = myBindingCache.get(element.getClass());
  if (bindings.length == 0) return Collections.emptyList();

  List<ProviderBinding.ProviderInfo<ProcessingContext>> ret = ContainerUtil.newSmartList();
  for (ProviderBinding binding : bindings) {
    binding.addAcceptableReferenceProviders(element, ret, hints);
  }
  return ret;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:PsiReferenceRegistrarImpl.java


注:本文中的com.intellij.util.containers.ContainerUtil.newSmartList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。