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


Java ContainerUtil类代码示例

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


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

示例1: isNullabilityAnnotationForTypeQualifierDefault

import com.intellij.util.containers.ContainerUtil; //导入依赖的package包/类
private static boolean isNullabilityAnnotationForTypeQualifierDefault(PsiAnnotation annotation,
                                                                      boolean nullable,
                                                                      PsiAnnotation.TargetType[] targetTypes) {
    PsiJavaCodeReferenceElement element = annotation.getNameReferenceElement();
    PsiElement declaration = element == null ? null : element.resolve();
    if (!(declaration instanceof PsiClass)) {
        return false;
    }

    String fqn = nullable ? JAVAX_ANNOTATION_NULLABLE : JAVAX_ANNOTATION_NONNULL;
    PsiClass classDeclaration = (PsiClass) declaration;
    if (!AnnotationUtil.isAnnotated(classDeclaration, fqn, false, true)) {
        return false;
    }

    PsiAnnotation tqDefault = AnnotationUtil.findAnnotation(classDeclaration, true, TYPE_QUALIFIER_DEFAULT);
    if (tqDefault == null) {
        return false;
    }

    Set<PsiAnnotation.TargetType> required = extractRequiredAnnotationTargets(tqDefault.findAttributeValue(null));
    return required != null
            && (required.isEmpty() || ContainerUtil.intersects(required, Arrays.asList(targetTypes)));
}
 
开发者ID:stylismo,项目名称:nullability-annotations-inspection,代码行数:25,代码来源:NullabilityAnnotationsWithTypeQualifierDefault.java

示例2: configureDependencies

import com.intellij.util.containers.ContainerUtil; //导入依赖的package包/类
@Override
public void configureDependencies(
    final @NotNull HybrisProjectDescriptor hybrisProjectDescriptor,
    final @NotNull IdeModifiableModelsProvider modifiableModelsProvider
) {
    final Map<String, ModifiableFacetModel> modifiableFacetModelMap = ContainerUtil.newHashMap();

    for (Module module : modifiableModelsProvider.getModules()) {
        final ModifiableFacetModel modifiableFacetModel = modifiableModelsProvider.getModifiableFacetModel(module);
        modifiableFacetModelMap.put(module.getName(), modifiableFacetModel);
    }

    for (HybrisModuleDescriptor moduleDescriptor : hybrisProjectDescriptor.getModulesChosenForImport()) {
        configureFacetDependencies(moduleDescriptor, modifiableFacetModelMap);
    }
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:17,代码来源:DefaultSpringConfigurator.java

示例3: topLevelKeywords

import com.intellij.util.containers.ContainerUtil; //导入依赖的package包/类
/**
 * @return set of keywords.
 */
public static Set<String> topLevelKeywords() {
    return ContainerUtil.newHashSet(
        "SELECT",
        "FROM",
        "WHERE",
        "ORDER",

        // Temporarily place this
        "LEFT",
        "JOIN",
        "ON",

        "BY",
        "ASC",
        "DESC"
    );
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:21,代码来源:FSKeywords.java

示例4: 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));
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:18,代码来源:StatsRequest.java

示例5: 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

示例6: executeTestConfiguration

import com.intellij.util.containers.ContainerUtil; //导入依赖的package包/类
private void executeTestConfiguration(int binarySettings, String relativeTargetPath, boolean checkResults) {
    if (relativeTargetPath == null || relativeTargetPath.isEmpty()) {
        relativeTargetPath = ".";
    }

    myFixture.configureByFiles(relativeTargetPath + "/TestData.csv");

    initCsvCodeStyleSettings(binarySettings);

    new WriteCommandAction.Simple(getProject()) {
        @Override
        protected void run() throws Throwable {
            CodeStyleManager.getInstance(getProject()).reformatText(myFixture.getFile(),
                    ContainerUtil.newArrayList(myFixture.getFile().getTextRange()));
        }
    }.execute();
    if (checkResults) {
        myFixture.checkResultByFile(relativeTargetPath + String.format("/TestResult%08d.csv", binarySettings));
    }
}
 
开发者ID:SeeSharpSoft,项目名称:intellij-csv-validator,代码行数:21,代码来源:CsvFormatterTest.java

示例7: _testResultGenerator

import com.intellij.util.containers.ContainerUtil; //导入依赖的package包/类
/**
 * This function should be executed (remove the underscore) if the current results are correct (manual testing).
 *
 * @throws Exception
 */
public void _testResultGenerator() throws Exception {
    for (int binarySettings = 0; binarySettings < 128; ++binarySettings) {
        tearDown();
        setUp();

        myFixture.configureByFiles("/generated/TestData.csv");

        initCsvCodeStyleSettings(binarySettings);

        new WriteCommandAction.Simple(getProject()) {
            @Override
            protected void run() throws Throwable {
                CodeStyleManager.getInstance(getProject()).reformatText(myFixture.getFile(),
                        ContainerUtil.newArrayList(myFixture.getFile().getTextRange()));
            }
        }.execute();

        try (PrintWriter writer = new PrintWriter(getTestDataPath() + String.format("/generated/TestResult%08d.csv", binarySettings))
        ) {
            writer.print(myFixture.getFile().getText());
        }
    }
}
 
开发者ID:SeeSharpSoft,项目名称:intellij-csv-validator,代码行数:29,代码来源:CsvFormatterTest.java

示例8: reset

import com.intellij.util.containers.ContainerUtil; //导入依赖的package包/类
@Override
public void reset(@NotNull TextAttributes ta) {
    myCbBold.setEnabled(true);
    myCbItalic.setEnabled(true);

    int fontType = ta.getFontType();
    myCbBold.setSelected(BitUtil.isSet(fontType, Font.BOLD));
    myCbItalic.setSelected(BitUtil.isSet(fontType, Font.ITALIC));

    resetColorChooser(myCbForeground, myForegroundChooser, ta.getForegroundColor());
    resetColorChooser(myCbBackground, myBackgroundChooser, ta.getBackgroundColor());
    resetColorChooser(myCbErrorStripe, myErrorStripeColorChooser, ta.getErrorStripeColor());

    Color effectColor = ta.getEffectColor();
    resetColorChooser(myCbEffects, myEffectsColorChooser, effectColor);

    if (effectColor == null) {
        myEffectsCombo.setEnabled(false);
    } else {
        myEffectsCombo.setEnabled(true);
        myEffectsModel.setSelectedItem(
                ContainerUtil.reverseMap(myEffectsMap).get(ta.getEffectType()));
    }
}
 
开发者ID:huoguangjin,项目名称:MultiHighlight,代码行数:25,代码来源:ColorChooserPanel.java

示例9: executeChunked

import com.intellij.util.containers.ContainerUtil; //导入依赖的package包/类
protected void executeChunked(@NotNull List<List<String>> chunkedCommits) throws HgCommandException, VcsException {
  if (chunkedCommits.isEmpty()) {
    commitChunkFiles(ContainerUtil.<String>emptyList(), myAmend, myCloseBranch);
  }
  else {
    int size = chunkedCommits.size();
    if (myShouldCommitWithSubrepos && myRepository.hasSubrepos()) {
      mySubrepos = HgUtil.getNamesWithoutHashes(myRepository.getSubrepos());
    }
    commitChunkFiles(chunkedCommits.get(0), myAmend, !mySubrepos.isEmpty(), myCloseBranch && size == 1);
    HgVcs vcs = HgVcs.getInstance(myProject);
    boolean amendCommit = vcs != null && vcs.getVersion().isAmendSupported();
    for (int i = 1; i < size; i++) {
      List<String> chunk = chunkedCommits.get(i);
      commitChunkFiles(chunk, amendCommit, false, myCloseBranch && i == size - 1);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:HgCommitCommand.java

示例10: runThreads

import com.intellij.util.containers.ContainerUtil; //导入依赖的package包/类
private static long runThreads(final int[] ids, int threadCount, final int queryCount, final TestIteration testIteration) throws InterruptedException, ExecutionException {
  long start = System.currentTimeMillis();
  List<Future<?>> futures = ContainerUtil.newArrayList();
  Random seedRandom = new Random();
  for (int i = 0; i < threadCount; i++) {
    final Random threadRandom = new Random(seedRandom.nextInt());
    final int finalI = i;
    futures.add(ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
      @Override
      public void run() {
        testIteration.doTest(finalI, ids, threadRandom, queryCount);
      }
    }));
  }
  for (Future<?> future : futures) {
    future.get();
  }
  return System.currentTimeMillis() - start;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:FileNameCacheMicroBenchmark.java

示例11: registerFix

import com.intellij.util.containers.ContainerUtil; //导入依赖的package包/类
public void registerFix(@Nullable IntentionAction action,
                        @Nullable List<IntentionAction> options,
                        @Nullable String displayName,
                        @Nullable TextRange fixRange,
                        @Nullable HighlightDisplayKey key) {
  if (action == null) return;
  if (fixRange == null) fixRange = new TextRange(startOffset, endOffset);
  if (quickFixActionRanges == null) {
    quickFixActionRanges = ContainerUtil.createLockFreeCopyOnWriteList();
  }
  IntentionActionDescriptor desc = new IntentionActionDescriptor(action, options, displayName, null, key, getProblemGroup(), getSeverity());
  quickFixActionRanges.add(Pair.create(desc, fixRange));
  fixStartOffset = Math.min (fixStartOffset, fixRange.getStartOffset());
  fixEndOffset = Math.max (fixEndOffset, fixRange.getEndOffset());
  if (action instanceof HintAction) {
    setHint(true);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:HighlightInfo.java

示例12: createNodes

import com.intellij.util.containers.ContainerUtil; //导入依赖的package包/类
@Override
@NotNull
public List<ExternalSystemNode<?>> createNodes(final ExternalProjectsView externalProjectsView,
                                               final MultiMap<Key<?>, DataNode<?>> dataNodes) {
  final List<ExternalSystemNode<?>> result = new SmartList<ExternalSystemNode<?>>();

  addModuleNodes(externalProjectsView, dataNodes, result);
  // add tasks
  TasksNode tasksNode = new TasksNode(externalProjectsView, dataNodes.get(ProjectKeys.TASK));
  if(externalProjectsView.useTasksNode()) {
    result.add(tasksNode);
  } else {
    ContainerUtil.addAll(result, tasksNode.getChildren());
  }

  addDependenciesNode(externalProjectsView, dataNodes, result);

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

示例13: getCertificates

import com.intellij.util.containers.ContainerUtil; //导入依赖的package包/类
/**
 * Select all available certificates from underlying trust store. Returned list is not supposed to be modified.
 *
 * @return certificates
 */
public List<X509Certificate> getCertificates() {
  myReadLock.lock();
  try {
    List<X509Certificate> certificates = new ArrayList<X509Certificate>();
    for (String alias : Collections.list(myKeyStore.aliases())) {
      certificates.add(getCertificate(alias));
    }
    return ContainerUtil.immutableList(certificates);
  }
  catch (Exception e) {
    LOG.error(e);
    return ContainerUtil.emptyList();
  }
  finally {
    myReadLock.unlock();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ConfirmingTrustManager.java

示例14: logClassPathOnce

import com.intellij.util.containers.ContainerUtil; //导入依赖的package包/类
private void logClassPathOnce(@NotNull Project project) {
  List<VirtualFile> files = GradleBuildClasspathManager.getInstance(project).getAllClasspathEntries();
  if (ContainerUtil.equalsIdentity(files, myLastClassPath)) {
    return;
  }
  myLastClassPath = files;

  List<String> paths = ContainerUtil.map(files, new NotNullFunction<VirtualFile, String>() {
    @NotNull
    @Override
    public String fun(VirtualFile vf) {
      return vf.getPath();
    }
  });
  String classPath = Joiner.on(':').join(paths);
  LOG.info(String.format("Android DSL resolver classpath (project %1$s): %2$s", project.getName(), classPath));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:AndroidDslContributor.java

示例15: getQuickFixes

import com.intellij.util.containers.ContainerUtil; //导入依赖的package包/类
private LocalQuickFix[] getQuickFixes(final GenericDomValue element, PsiReference reference) {
  if (!myOnTheFly) return LocalQuickFix.EMPTY_ARRAY;

  final List<LocalQuickFix> result = new SmartList<LocalQuickFix>();
  final Converter converter = WrappingConverter.getDeepestConverter(element.getConverter(), element);
  if (converter instanceof ResolvingConverter) {
    final ResolvingConverter resolvingConverter = (ResolvingConverter)converter;
    ContainerUtil
      .addAll(result, resolvingConverter.getQuickFixes(ConvertContextFactory.createConvertContext(DomManagerImpl.getDomInvocationHandler(element))));
  }
  if (reference instanceof LocalQuickFixProvider) {
    final LocalQuickFix[] localQuickFixes = ((LocalQuickFixProvider)reference).getQuickFixes();
    if (localQuickFixes != null) {
      ContainerUtil.addAll(result, localQuickFixes);
    }
  }
  return result.isEmpty() ? LocalQuickFix.EMPTY_ARRAY : result.toArray(new LocalQuickFix[result.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:DomElementAnnotationHolderImpl.java


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