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


Java SmartList类代码示例

本文整理汇总了Java中com.intellij.util.SmartList的典型用法代码示例。如果您正苦于以下问题:Java SmartList类的具体用法?Java SmartList怎么用?Java SmartList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getResolvedProperty

import com.intellij.util.SmartList; //导入依赖的package包/类
@Nullable
private static IProperty getResolvedProperty(@NotNull final XmlAttributeValue codeValue) {
    return CachedValuesManager.getCachedValue(codeValue, KEY, () -> {
        List<IProperty> allProperties = new SmartList<>();
        for (PsiReference nextRef : codeValue.getReferences()) {
            if (nextRef instanceof PsiPolyVariantReference) {
                Arrays.stream(((PsiPolyVariantReference) nextRef).multiResolve(false))
                      .filter(ResolveResult::isValidResult)
                      .map(ResolveResult::getElement)
                      .map(o -> ObjectUtils.tryCast(o, IProperty.class))
                      .filter(Objects::nonNull)
                      .forEach(allProperties::add);
            } else {
                Optional.ofNullable(nextRef.resolve())
                        .map(o -> ObjectUtils.tryCast(o, IProperty.class))
                        .ifPresent(allProperties::add);
            }
        }

        IProperty theChosenOne = chooseForLocale(allProperties);
        return new CachedValueProvider.Result<>(theChosenOne, PsiModificationTracker.MODIFICATION_COUNT);
    });
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:24,代码来源:JspPropertyFoldingBuilder.java

示例2: getPsiElementsToProcess

import com.intellij.util.SmartList; //导入依赖的package包/类
@NotNull
@Override
protected List<PsiElement> getPsiElementsToProcess() {
  return ApplicationManager.getApplication().runReadAction(new Computable<List<PsiElement>>() {
    @Override
    public List<PsiElement> compute() {
      final PsiFile file = PsiManager.getInstance(project).findFile(myFile);
      if (file == null) {
        return Collections.emptyList();
      }

      final FileViewProvider viewProvider = file.getViewProvider();
      final List<PsiElement> elementsToProcess = new SmartList<PsiElement>();

      for (Language lang : viewProvider.getLanguages()) {
        elementsToProcess.add(viewProvider.getPsi(lang));
      }

      return elementsToProcess;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:MatcherImpl.java

示例3: getChildrenOf

import com.intellij.util.SmartList; //导入依赖的package包/类
@SuppressWarnings("ForLoopReplaceableByForEach")
public static <T extends DomElement> List<T> getChildrenOf(DomElement parent, final Class<T> type) {
  final List<T> list = new SmartList<T>();
  List<? extends AbstractDomChildrenDescription> descriptions = parent.getGenericInfo().getChildrenDescriptions();
  for (int i = 0, descriptionsSize = descriptions.size(); i < descriptionsSize; i++) {
    AbstractDomChildrenDescription description = descriptions.get(i);
    if (description.getType() instanceof Class && type.isAssignableFrom((Class<?>)description.getType())) {
      List<T> values = (List<T>)description.getValues(parent);
      for (int j = 0, valuesSize = values.size(); j < valuesSize; j++) {
        T value = values.get(j);
        if (value.exists()) {
          list.add(value);
        }
      }
    }
  }
  return list;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:DomUtil.java

示例4: merge

import com.intellij.util.SmartList; //导入依赖的package包/类
@NotNull
public static List<LineMarkerInfo> merge(@NotNull List<MergeableLineMarkerInfo> markers) {
  List<LineMarkerInfo> result = new SmartList<LineMarkerInfo>();
  for (int i = 0; i < markers.size(); i++) {
    MergeableLineMarkerInfo marker = markers.get(i);
    List<MergeableLineMarkerInfo> toMerge = new SmartList<MergeableLineMarkerInfo>();
    for (int k = markers.size() - 1; k > i; k--) {
      MergeableLineMarkerInfo current = markers.get(k);
      if (marker.canMergeWith(current)) {
        toMerge.add(0, current);
        markers.remove(k);
      }
    }
    if (toMerge.isEmpty()) {
      result.add(marker);
    }
    else {
      toMerge.add(0, marker);
      result.add(new MyLineMarkerInfo(toMerge));
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:MergeableLineMarkerInfo.java

示例5: getBeforeRunTasks

import com.intellij.util.SmartList; //导入依赖的package包/类
@NotNull
@Override
public <T extends BeforeRunTask> List<T> getBeforeRunTasks(RunConfiguration settings, Key<T> taskProviderID) {
  if (settings instanceof WrappingRunConfiguration) {
    return getBeforeRunTasks(((WrappingRunConfiguration)settings).getPeer(), taskProviderID);
  }
  List<BeforeRunTask> tasks = myConfigurationToBeforeTasksMap.get(settings);
  if (tasks == null) {
    tasks = getBeforeRunTasks(settings);
    myConfigurationToBeforeTasksMap.put(settings, tasks);
  }
  List<T> result = new SmartList<T>();
  for (BeforeRunTask task : tasks) {
    if (task.getProviderId() == taskProviderID) {
      //noinspection unchecked
      result.add((T)task);
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:RunManagerImpl.java

示例6: checkFile

import com.intellij.util.SmartList; //导入依赖的package包/类
public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull final InspectionManager manager, final boolean isOnTheFly) {
  if (!(file instanceof PropertiesFile)) return null;
  final List<IProperty> properties = ((PropertiesFile)file).getProperties();
  final List<ProblemDescriptor> descriptors = new SmartList<ProblemDescriptor>();
  for (IProperty property : properties) {
    ProgressManager.checkCanceled();
    final PropertyImpl propertyImpl = (PropertyImpl)property;
    for (ASTNode node : ContainerUtil.ar(propertyImpl.getKeyNode(), propertyImpl.getValueNode())) {
      if (node != null) {
        PsiElement key = node.getPsi();
        TextRange textRange = getTrailingSpaces(key, myIgnoreVisibleSpaces);
        if (textRange != null) {
          descriptors.add(manager.createProblemDescriptor(key, textRange, "Trailing spaces", ProblemHighlightType.GENERIC_ERROR_OR_WARNING, true, new RemoveTrailingSpacesFix(myIgnoreVisibleSpaces)));
        }
      }
    }
  }
  return descriptors.toArray(new ProblemDescriptor[descriptors.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:TrailingSpacesInPropertyInspection.java

示例7: doCollect

import com.intellij.util.SmartList; //导入依赖的package包/类
@NotNull
private List<AnnotationData> doCollect(@NotNull PsiModifierListOwner listOwner, boolean onlyWritable) {
  String externalName = getExternalName(listOwner, false);
  if (externalName == null) return NO_DATA;

  List<PsiFile> files = findExternalAnnotationsFiles(listOwner);
  if (files == null) return NO_DATA;

  SmartList<AnnotationData> result = new SmartList<AnnotationData>();
  for (PsiFile file : files) {
    if (!file.isValid()) continue;
    if (onlyWritable && !file.isWritable()) continue;

    MostlySingularMultiMap<String, AnnotationData> fileData = getDataFromFile(file);
    ContainerUtil.addAll(result, fileData.get(externalName));
  }
  if (result.isEmpty()) return NO_DATA;

  result.trimToSize();
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:BaseExternalAnnotationsManager.java

示例8: getConfigurationsList

import com.intellij.util.SmartList; //导入依赖的package包/类
/**
 * Template configuration is not included
 */
@Override
@NotNull
public List<RunConfiguration> getConfigurationsList(@NotNull ConfigurationType type) {
  List<RunConfiguration> result = null;
  for (RunnerAndConfigurationSettings settings : getSortedConfigurations()) {
    RunConfiguration configuration = settings.getConfiguration();
    if (type.getId().equals(configuration.getType().getId())) {
      if (result == null) {
        result = new SmartList<RunConfiguration>();
      }
      result.add(configuration);
    }
  }
  return ContainerUtil.notNullize(result);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:RunManagerImpl.java

示例9: VariableResolverProcessor

import com.intellij.util.SmartList; //导入依赖的package包/类
public VariableResolverProcessor(@NotNull PsiJavaCodeReferenceElement place, @NotNull PsiFile placeFile) {
  super(place.getReferenceName(), ourFilter, new PsiConflictResolver[]{new JavaVariableConflictResolver()}, new SmartList<CandidateInfo>(), place, placeFile);

  PsiClass access = null;
  PsiElement qualifier = place.getQualifier();
  if (qualifier instanceof PsiExpression) {
    final JavaResolveResult accessClass = PsiUtil.getAccessObjectClass((PsiExpression)qualifier);
    final PsiElement element = accessClass.getElement();
    if (element instanceof PsiTypeParameter) {
      PsiElementFactory factory = JavaPsiFacade.getInstance(placeFile.getProject()).getElementFactory();
      final PsiClassType type = factory.createType((PsiTypeParameter)element);
      final PsiType accessType = accessClass.getSubstitutor().substitute(type);
      if (accessType instanceof PsiArrayType) {
        LanguageLevel languageLevel = PsiUtil.getLanguageLevel(placeFile);
        access = factory.getArrayClass(languageLevel);
      }
      else if (accessType instanceof PsiClassType) {
        access = ((PsiClassType)accessType).resolve();
      }
    }
    else if (element instanceof PsiClass) {
      access = (PsiClass)element;
    }
  }
  myAccessClass = access;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:VariableResolverProcessor.java

示例10: add

import com.intellij.util.SmartList; //导入依赖的package包/类
private void add(@NotNull Element state, @Nullable ProgramRunner runner, @Nullable T data) throws InvalidDataException {
  if (runner == null) {
    if (unloadedSettings == null) {
      unloadedSettings = new SmartList<Element>();
    }
    unloadedSettings.add(state);
    return;
  }

  if (data != null) {
    ((JDOMExternalizable)data).readExternal(state);
  }

  settings.put(runner, data);
  loadedIds.add(runner.getRunnerId());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:RunnerAndConfigurationSettingsImpl.java

示例11: getEventDescriptors

import com.intellij.util.SmartList; //导入依赖的package包/类
@NotNull
public static List<Pair<Breakpoint, Event>> getEventDescriptors(SuspendContextImpl suspendContext) {
  DebuggerManagerThreadImpl.assertIsManagerThread();
  if(suspendContext == null) {
    return Collections.emptyList();
  }
  final EventSet events = suspendContext.getEventSet();
  if(events == null) {
    return Collections.emptyList();
  }
  final List<Pair<Breakpoint, Event>> eventDescriptors = new SmartList<Pair<Breakpoint, Event>>();

  final RequestManagerImpl requestManager = suspendContext.getDebugProcess().getRequestsManager();
  for (final Event event : events) {
    final Requestor requestor = requestManager.findRequestor(event.request());
    if (requestor instanceof Breakpoint) {
      eventDescriptors.add(Pair.create((Breakpoint)requestor, event));
    }
  }
  return eventDescriptors;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:DebuggerUtilsEx.java

示例12: createClassLookupItems

import com.intellij.util.SmartList; //导入依赖的package包/类
public static List<JavaPsiClassReferenceElement> createClassLookupItems(final PsiClass psiClass,
                                                                        boolean withInners,
                                                                        InsertHandler<JavaPsiClassReferenceElement> insertHandler,
                                                                        Condition<PsiClass> condition) {
  List<JavaPsiClassReferenceElement> result = new SmartList<JavaPsiClassReferenceElement>();
  if (condition.value(psiClass)) {
    result.add(AllClassesGetter.createLookupItem(psiClass, insertHandler));
  }
  String name = psiClass.getName();
  if (withInners && name != null) {
    for (PsiClass inner : psiClass.getInnerClasses()) {
      if (inner.hasModifierProperty(PsiModifier.STATIC)) {
        for (JavaPsiClassReferenceElement lookupInner : createClassLookupItems(inner, true, insertHandler, condition)) {
          String forced = lookupInner.getForcedPresentableName();
          String qualifiedName = name + "." + (forced != null ? forced : inner.getName());
          lookupInner.setForcedPresentableName(qualifiedName);
          lookupInner.setLookupString(qualifiedName);
          result.add(lookupInner);
        }
      }
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:JavaClassNameCompletionContributor.java

示例13: selectMethod

import com.intellij.util.SmartList; //导入依赖的package包/类
@Nullable
private static List<PsiMethod> selectMethod(final PsiMethod[] methods, final Trinity<PsiClass, PsiFile, String> previousLineResult) {
  if (previousLineResult == null || previousLineResult.getThird() == null) return null;

  final List<PsiMethod> result = new SmartList<PsiMethod>();
  for (final PsiMethod method : methods) {
    method.accept(new JavaRecursiveElementVisitor() {
      @Override
      public void visitCallExpression(PsiCallExpression callExpression) {
        final PsiMethod resolved = callExpression.resolveMethod();
        if (resolved != null) {
          if (resolved.getName().equals(previousLineResult.getThird())) {
            result.add(method);
          }
        }
      }
    });
  }

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

示例14: createTemplates

import com.intellij.util.SmartList; //导入依赖的package包/类
@NotNull
@Override
public ProjectTemplate[] createTemplates(@Nullable String group, WizardContext context) {
  // myGroups contains only not-null keys
  if (group == null) {
    return ProjectTemplate.EMPTY_ARRAY;
  }

  List<ProjectTemplate> templates = null;
  for (Pair<URL, ClassLoader> url : myGroups.getValue().get(group)) {
    try {
      for (String child : UrlUtil.getChildrenRelativePaths(url.first)) {
        if (child.endsWith(ZIP)) {
          if (templates == null) {
            templates = new SmartList<ProjectTemplate>();
          }
          templates.add(new LocalArchivedTemplate(new URL(url.first.toExternalForm() + '/' + child), url.second));
        }
      }
    }
    catch (IOException e) {
      LOG.error(e);
    }
  }
  return ContainerUtil.isEmpty(templates) ? ProjectTemplate.EMPTY_ARRAY : templates.toArray(new ProjectTemplate[templates.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ArchivedTemplatesFactory.java

示例15: updateBreakpoints

import com.intellij.util.SmartList; //导入依赖的package包/类
private void updateBreakpoints(@NotNull Document document) {
  Collection<XLineBreakpointImpl> breakpoints = myBreakpoints.getKeysByValue(document);
  if (breakpoints == null) {
    return;
  }

  TIntHashSet lines = new TIntHashSet();
  List<XBreakpoint<?>> toRemove = new SmartList<XBreakpoint<?>>();
  for (XLineBreakpointImpl breakpoint : breakpoints) {
    breakpoint.updatePosition();
    if (!breakpoint.isValid() || !lines.add(breakpoint.getLine())) {
      toRemove.add(breakpoint);
    }
  }

  removeBreakpoints(toRemove);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:XLineBreakpointManager.java


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