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


Java ContainerUtil.map2Array方法代码示例

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


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

示例1: fetchComments

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private Comment[] fetchComments(final long id) throws Exception {
  GithubConnection connection = getConnection();
  try {
    List<GithubIssueComment> result = GithubApiUtil.getIssueComments(connection, getRepoAuthor(), getRepoName(), id);

    return ContainerUtil.map2Array(result, Comment.class, new Function<GithubIssueComment, Comment>() {
      @Override
      public Comment fun(GithubIssueComment comment) {
        return new GithubComment(comment.getCreatedAt(), comment.getUser().getLogin(), comment.getBodyHtml(),
                                 comment.getUser().getAvatarUrl(),
                                 comment.getUser().getHtmlUrl());
      }
    });
  }
  finally {
    connection.close();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GithubRepository.java

示例2: getIssues

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public PhabricatorTask[] getIssues(@Nullable String query, int offset, int limit, boolean withClosed) throws Exception {
  // Phabricator will return an error when asked for more than 100 tasks
  int lim = Math.min(limit, 100);
  Params params = new Params()
    .add("queryKey", withClosed ? "all" : "open")
    .add("attachments[projects]", "1")
    .add("limit", String.valueOf(lim));
  // TODO:
  //  .add("offset", String.valueOf(offset));
  if (offset > 0) {
    return new PhabricatorTask[]{};
  }
  if (query != null) {
    Matcher m = TASK_ID.matcher(query);
    if (m.matches()) {
      params.add("constraints[ids][0]", m.group(1));
    } else if (query.length() >= MIN_PHAB_QUERY_LEN) {
      params.add("constraints[query]", query);
    } else {
      return new PhabricatorTask[]{};
    }
  }

  SearchResponse res = apiCall("maniphest.search", SearchResponse.class, params);
  return ContainerUtil
    .map2Array(res.getData(), PhabricatorTask.class, t -> new PhabricatorTask(t, this));
}
 
开发者ID:mmm444,项目名称:ijphab,代码行数:29,代码来源:PhabricatorRepository.java

示例3: findExternalAnnotations

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
@Nullable
public PsiAnnotation[] findExternalAnnotations(@NotNull final PsiModifierListOwner listOwner) {
  final List<AnnotationData> result = collectExternalAnnotations(listOwner);
  return result.isEmpty() ? null : ContainerUtil.map2Array(result, PsiAnnotation.EMPTY_ARRAY, new Function<AnnotationData, PsiAnnotation>() {
    @Override
    public PsiAnnotation fun(AnnotationData data) {
      return data.getAnnotation(BaseExternalAnnotationsManager.this);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:BaseExternalAnnotationsManager.java

示例4: getButtonTitles

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
private static String[] getButtonTitles() {
  return ContainerUtil.map2Array(values(), String.class, new Function<Decision, String>() {
    @Override
    public String fun(Decision decision) {
      return decision.myButtonText;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:GitRebaseOverMergeProblem.java

示例5: getVariants

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public Object[] getVariants() {
  List<Injectable> list = InjectLanguageAction.getAllInjectables();
  return ContainerUtil.map2Array(list, LookupElement.class, new Function<Injectable, LookupElement>() {
    @Override
    public LookupElement fun(Injectable injectable) {
      return LookupElementBuilder.create(injectable.getId()).withIcon(injectable.getIcon()).withTailText(
        "(" + injectable.getDisplayName() + ")", true);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:LanguageReference.java

示例6: getSubIds

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
@NotNull
public String[] getSubIds() {
  return ContainerUtil.map2Array(getShownScopes(), String.class, new Function<NamedScope, String>() {
    @Override
    public String fun(NamedScope scope) {
      return scope.getName();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ScopeViewPane.java

示例7: getClassReferenceFilter

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
private static ElementFilter getClassReferenceFilter(PsiElement element) {
  //throw new foo
  if (AFTER_THROW_NEW.accepts(element)) {
    return THROWABLES_FILTER;
  }
  
  //throws list
  PsiMethod method = PsiTreeUtil.getParentOfType(element, PsiMethod.class);
  if (method != null && PsiTreeUtil.isAncestor(method.getThrowsList(), element, true)) {
    return THROWABLES_FILTER;
  }

  //new xxx.yyy
  if (psiElement().afterLeaf(psiElement().withText(".")).withSuperParent(2, psiElement(PsiNewExpression.class)).accepts(element)) {
    if (((PsiNewExpression)element.getParent().getParent()).getClassReference() == element.getParent()) {
      PsiType[] types = ExpectedTypesGetter.getExpectedTypes(element, false);
      return new OrFilter(ContainerUtil.map2Array(types, ElementFilter.class, new Function<PsiType, ElementFilter>() {
        @Override
        public ElementFilter fun(PsiType type) {
          return new AssignableFromFilter(type);
        }
      }));
    }
  }

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

示例8: convertToMethodMembers

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static PsiMethodMember[] convertToMethodMembers(Collection<CandidateInfo> candidates) {
  return ContainerUtil.map2Array(candidates, PsiMethodMember.class, new Function<CandidateInfo, PsiMethodMember>() {
    @Override
    public PsiMethodMember fun(final CandidateInfo s) {
      return new PsiMethodMember(s);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:JavaOverrideImplementMemberChooser.java

示例9: multiResolve

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
@NotNull
public ResolveResult[] multiResolve(boolean incompleteCode) {
  final RngGrammar scope = getScope();
  if (scope == null) {
    return ResolveResult.EMPTY_ARRAY;
  }

  final Set<Define> set = DefinitionResolver.resolve(scope, myValue.getValue());
  if (set == null || set.size() == 0) return ResolveResult.EMPTY_ARRAY;

  return ContainerUtil.map2Array(set, ResolveResult.class, this);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:DefinitionReference.java

示例10: doMoveSymbolsTest

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private void doMoveSymbolsTest(@NotNull String toFileName, String... symbolNames) {
  String root = "/refactoring/move/" + getTestName(true);
  String rootBefore = root + "/before/src";
  String rootAfter = root + "/after/src";
  VirtualFile dir1 = myFixture.copyDirectoryToProject(rootBefore, "");
  PsiDocumentManager.getInstance(myFixture.getProject()).commitAllDocuments();

  final PsiNamedElement[] symbols = ContainerUtil.map2Array(symbolNames, PsiNamedElement.class, new Function<String, PsiNamedElement>() {
    @Override
    public PsiNamedElement fun(String name) {
      final PsiNamedElement found = findFirstNamedElement(name);
      assertNotNull("Symbol '" + name + "' does not exist", found);
      return found;
    }
  });

  VirtualFile toVirtualFile = dir1.findFileByRelativePath(toFileName);
  String path = toVirtualFile != null ? toVirtualFile.getPath() : (dir1.getPath() + "/" + toFileName);
  new PyMoveModuleMembersProcessor(myFixture.getProject(),
                                   symbols,
                                   path,
                                   false).run();

  VirtualFile dir2 = getVirtualFileByName(PythonTestUtil.getTestDataPath() + rootAfter);
  try {
    PlatformTestUtil.assertDirectoriesEqual(dir2, dir1);
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:PyMoveTest.java

示例11: getAllFields

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public static PsiField[] getAllFields(GrTypeDefinition grType) {
  Map<String, CandidateInfo> fieldsMap = CollectClassMembersUtil.getAllFields(grType);
  return ContainerUtil.map2Array(fieldsMap.values(), PsiField.class, new Function<CandidateInfo, PsiField>() {
    @Override
    public PsiField fun(CandidateInfo entry) {
      return (PsiField)entry.getElement();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:GrClassImplUtil.java

示例12: convertBatchToSuppressIntentionActions

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public static SuppressIntentionAction[] convertBatchToSuppressIntentionActions(@NotNull SuppressQuickFix[] actions) {
  return ContainerUtil.map2Array(actions, SuppressIntentionAction.class, new Function<SuppressQuickFix, SuppressIntentionAction>() {
    @Override
    public SuppressIntentionAction fun(SuppressQuickFix fix) {
      return convertBatchToSuppressIntentionAction(fix);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:SuppressIntentionActionFromFix.java

示例13: buildChildren

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public MyNode[] buildChildren() {
  return ContainerUtil.map2Array(myTaskActivationState.getTasks(myPhase), MyNode.class, new Function<String, MyNode>() {
    @Override
    public MyNode fun(final String taskName) {
      return new TaskNode(taskName, PhaseNode.this);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ConfigureTasksActivationDialog.java

示例14: getAllValues

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public StatisticsInfo[] getAllValues(final String context) {
  final String[] strings;
  synchronized (LOCK) {
    strings = getUnit(getUnitNumber(context)).getKeys2(context);
  }
  return ContainerUtil.map2Array(strings, StatisticsInfo.class, new NotNullFunction<String, StatisticsInfo>() {
    @NotNull
    public StatisticsInfo fun(final String s) {
      return new StatisticsInfo(context, s);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:StatisticsManagerImpl.java

示例15: findChildrenByType

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
protected <T extends PsiElement> T[] findChildrenByType(IElementType elementType, Class<T> arrayClass) {
  return ContainerUtil.map2Array(SharedImplUtil.getChildrenOfType(getNode(), elementType), arrayClass, new Function<ASTNode, T>() {
    @Override
    public T fun(final ASTNode s) {
      return (T)s.getPsi();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ASTDelegatePsiElement.java


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