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


Java ContainerUtil.map方法代码示例

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


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

示例1: toAbsolute

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public static Collection<String> toAbsolute(@NotNull Collection<String> relPaths, @NotNull final Project project) {
  return ContainerUtil.map(relPaths, new Function<String, String>() {
    @Override
    public String fun(String s) {
      try {
        return FileUtil.toSystemIndependentName(new File(project.getBaseDir().getPath(), s).getCanonicalPath());
      }
      catch (IOException e) {
        fail();
        e.printStackTrace();
        return null;
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:VcsRootDetectorTest.java

示例2: processRSS

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private List<Task> processRSS(@NotNull GetMethod method) throws Exception {
  // Basic authorization should be enough
  int code = myRepository.getHttpClient().executeMethod(method);
  if (code != HttpStatus.SC_OK) {
    throw new Exception(TaskBundle.message("failure.http.error", code, method.getStatusText()));
  }
  Element root = new SAXBuilder(false).build(method.getResponseBodyAsStream()).getRootElement();
  Element channel = root.getChild("channel");
  if (channel != null) {
    List<Element> children = channel.getChildren("item");
    LOG.debug("Total issues in JIRA RSS feed: " + children.size());
    return ContainerUtil.map(children, new Function<Element, Task>() {
      public Task fun(Element element) {
        return new JiraSoapTask(element, myRepository);
      }
    });
  }
  else {
    LOG.warn("JIRA channel not found");
  }
  return ContainerUtil.emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:JiraLegacyApi.java

示例3: testCustomTaskStates

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public void testCustomTaskStates() throws Exception {
  final Task task = myRepository.findTask(REQUEST_WITH_CUSTOM_STATES_ID);
  assertNotNull(task);

  final Set<CustomTaskState> states = myRepository.getAvailableTaskStates(task);
  final List<String> stateNames = ContainerUtil.map(states, new Function<CustomTaskState, String>() {
    @Override
    public String fun(CustomTaskState state) {
      return state.getPresentableName();
    }
  });
  assertContainsElements(stateNames, "North", "South");

  // ? -> North
  myRepository.setTaskState(task, NORTH_STATE);
  Element element = myRepository.fetchRequestAsElement(REQUEST_WITH_CUSTOM_STATES_ID);
  assertEquals("North", element.getAttributeValue("state"));

  // North -> Submitted
  myRepository.setTaskState(task, SUBMITTED_STATE);
  element = myRepository.fetchRequestAsElement(REQUEST_WITH_CUSTOM_STATES_ID);
  assertEquals("Submitted", element.getAttributeValue("state"));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:YouTrackIntegrationTest.java

示例4: toFilePaths

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
private static List<FilePath> toFilePaths(@NotNull Collection<String> absolutePaths) {
  return ContainerUtil.map(absolutePaths, new Function<String, FilePath>() {
    @Override
    public FilePath fun(String path) {
      return VcsUtil.getFilePath(path, false);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:GitSimplePathsBrowser.java

示例5: fromState

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public static CustomResourceBundle fromState(final CustomResourceBundleState state, final Project project) {
  final PsiManager psiManager = PsiManager.getInstance(project);
  final List<PropertiesFile> files =
    ContainerUtil.map(state.getFiles(VirtualFileManager.getInstance()), new Function<VirtualFile, PropertiesFile>() {
      @Override
      public PropertiesFile fun(VirtualFile virtualFile) {
        return PropertiesImplUtil.getPropertiesFile(psiManager.findFile(virtualFile));
      }
    });
  return files.size() < 2 ? null : new CustomResourceBundle(files, state.getBaseName());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:CustomResourceBundle.java

示例6: getNames

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public List<String> getNames() {
  return ContainerUtil.map(myNames, new Function<Substring, String>() {
    @Override
    public String fun(Substring substring) {
      return substring.toString();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:SectionBasedDocString.java

示例7: inferExpectedSignatures

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
@Override
public List<PsiType[]> inferExpectedSignatures(@NotNull final PsiMethod method,
                                               @NotNull final PsiSubstitutor substitutor,
                                               @NotNull String[] options) {
  return ContainerUtil.map(options, new Function<String, PsiType[]>() {
    @Override
    public PsiType[] fun(String value) {
        String[] params = value.split(",");
        return ContainerUtil.map(params, new Function<String, PsiType>() {
          @Override
          public PsiType fun(String param) {
            try {
              PsiTypeParameterList typeParameterList = method.getTypeParameterList();
              PsiElement context = typeParameterList != null ? typeParameterList : method;
              PsiType original = JavaPsiFacade.getElementFactory(method.getProject()).createTypeFromText(param, context);
              return substitutor.substitute(original);
            }
            catch (IncorrectOperationException e) {
              //do nothing. Just don't throw an exception
            }
            return PsiType.NULL;
          }
        }, new PsiType[params.length]);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:FromStringHintProcessor.java

示例8: getParameters

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
@Override
public List<String> getParameters() {
  return ContainerUtil.map(getParameterSubstrings(), new Function<Substring, String>() {
    @Override
    public String fun(Substring substring) {
      return substring.toString();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:SectionBasedDocString.java

示例9: testAssigneeIssues2

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public void testAssigneeIssues2() throws Exception {
  List<GithubIssue> result = GithubApiUtil.getIssuesAssigned(new GithubConnection(myAuth), myLogin2, REPO_NAME, myLogin2, 100, false);
  List<Long> issues = ContainerUtil.map(result, new Function<GithubIssue, Long>() {
    @Override
    public Long fun(GithubIssue githubIssue) {
      return githubIssue.getNumber();
    }
  });

  List<Long> expected = Arrays.asList(1L, 2L);

  assertTrue(Comparing.haveEqualElements(issues, expected));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:GithubIssuesTest.java

示例10: testCollectMovableModuleMembers

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public void testCollectMovableModuleMembers() {
  myFixture.configureByFile("/refactoring/move/" + getTestName(true) + ".py");
  final List<PyElement> members = PyMoveModuleMembersHelper.getTopLevelModuleMembers((PyFile)myFixture.getFile());
  final List<String> names = ContainerUtil.map(members, new Function<PyElement, String>() {
    @Override
    public String fun(PyElement element) {
      return element.getName();
    }
  });
  assertSameElements(names, "CONST", "C", "outer_func");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PyMoveTest.java

示例11: findTasks

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
@NotNull
public final List<Task> findTasks(@NotNull String jql, int max) throws Exception {
  GetMethod method = getMultipleIssuesSearchMethod(jql, max);
  String response = myRepository.executeMethod(method);
  List<JiraIssue> issues = parseIssues(response);
  return ContainerUtil.map(issues, new Function<JiraIssue, Task>() {
    @Override
    public JiraRestTask fun(JiraIssue issue) {
      return new JiraRestTask(issue, myRepository);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:JiraRestApi.java

示例12: RecursiveLighterASTNodeWalkingVisitor

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
protected RecursiveLighterASTNodeWalkingVisitor(@NotNull final LighterAST ast) {
  this.ast = ast;

  myWalkingState = new WalkingState<IndexedLighterASTNode>(new LighterASTGuide()) {
    @Override
    public void elementFinished(@NotNull IndexedLighterASTNode element) {
      RecursiveLighterASTNodeWalkingVisitor.this.elementFinished(element.node);

      if (parentStack.peek() == element) { // getFirstChild returned nothing. otherwise getFirstChild() was not called, i.e. super.visitNode() was not called i.e. just ignore
        IndexedLighterASTNode[] children = childrenStack.pop();
        List<LighterASTNode> list = children.length == 0 ? Collections.<LighterASTNode>emptyList() : ContainerUtil.map(children, new Function<IndexedLighterASTNode, LighterASTNode>() {
          @Override
          public LighterASTNode fun(IndexedLighterASTNode node) {
            return node.node;
          }
        });
        ast.disposeChildren(list);
        parentStack.pop();
      }
    }

    @Override
    public void visit(@NotNull IndexedLighterASTNode iNode) {
      LighterASTNode element = iNode.node;
      RecursiveLighterASTNodeWalkingVisitor visitor = RecursiveLighterASTNodeWalkingVisitor.this;
      if (element instanceof LighterLazyParseableNode) {
        visitor.visitLazyParseableNode((LighterLazyParseableNode)element);
      }
      else if (element instanceof LighterASTTokenNode) {
        visitor.visitTokenNode((LighterASTTokenNode)element);
      }
      else {
        visitor.visitNode(element);
      }
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:RecursiveLighterASTNodeWalkingVisitor.java

示例13: createSignature

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public static GrClosureSignature createSignature(MethodSignature signature) {
  final PsiType[] types = signature.getParameterTypes();
  GrClosureParameter[] parameters = new GrClosureParameter[types.length];
  ContainerUtil.map(types, new Function<PsiType, GrClosureParameter>() {
    @Override
    public GrClosureParameter fun(PsiType type) {
      return new GrImmediateClosureParameterImpl(type, null, false, null);
    }
  }, parameters);
  return new GrImmediateClosureSignatureImpl(parameters, null, false, false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:GrClosureSignatureUtil.java

示例14: getSpacing

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
@Nullable public Spacing getSpacing(final Block child1, @NotNull final Block child2) {
  int shift = 0;
  Block child1ToUse = child1;
  Block child2ToUse = child2;
  if (child1 instanceof InjectedLanguageBlockWrapper) {
    child1ToUse = ((InjectedLanguageBlockWrapper)child1).myOriginal;
    shift = child1.getTextRange().getStartOffset() - child1ToUse.getTextRange().getStartOffset();
  }
  if (child2 instanceof InjectedLanguageBlockWrapper) child2ToUse = ((InjectedLanguageBlockWrapper)child2).myOriginal;
  Spacing spacing = myOriginal.getSpacing(child1ToUse, child2ToUse);
  if (spacing instanceof DependantSpacingImpl && shift != 0) {
    DependantSpacingImpl hostSpacing = (DependantSpacingImpl)spacing;
    final int finalShift = shift;
    List<TextRange> shiftedRanges = ContainerUtil.map(hostSpacing.getDependentRegionRanges(), new Function<TextRange, TextRange>() {
      @Override
      public TextRange fun(TextRange range) {
        return range.shiftRight(finalShift);
      }
    });
    return new DependantSpacingImpl(
      hostSpacing.getMinSpaces(), hostSpacing.getMaxSpaces(), shiftedRanges,
      hostSpacing.shouldKeepLineFeeds(), hostSpacing.getKeepBlankLines(), DependentSpacingRule.DEFAULT
    );
  }
  return spacing;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:InjectedLanguageBlockWrapper.java

示例15: data

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Parameterized.Parameters(name = "{0}")
public static Collection<Object[]> data() {
  File pluginRoot = new File(PluginPathManager.getPluginHomePath("git4idea"));
  File dataDir = new File(new File(pluginRoot, "testData"), "repo");
  File[] testCases = dataDir.listFiles(FileUtilRt.ALL_DIRECTORIES);
  return ContainerUtil.map(testCases, new Function<File, Object[]>() {
    @Override
    public Object[] fun(File file) {
      return new Object[] { file.getName(), file };
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:GitRepositoryReaderTest.java


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