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


Java ContainerUtil.map2Set方法代码示例

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


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

示例1: getBundledScriptFolders

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
private static Set<File> getBundledScriptFolders() {
  final GroovyFrameworkConfigNotification[] extensions = GroovyFrameworkConfigNotification.EP_NAME.getExtensions();
  Set<Class> classes = new HashSet<Class>(ContainerUtil.map2Set(extensions, new Function<GroovyFrameworkConfigNotification, Class>() {
    @Override
    public Class fun(GroovyFrameworkConfigNotification notification) {
      return notification.getClass();
    }
  }));
  classes.add(GroovyFrameworkConfigNotification.class); // for default extension

  // perhaps a separate extension for that?
  Set<File> scriptFolders = new LinkedHashSet<File>();
  for (Class aClass : classes) {
    File jarPath = new File(PathUtil.getJarPathForClass(aClass));
    if (jarPath.isFile()) {
      jarPath = jarPath.getParentFile();
    }
    scriptFolders.add(new File(jarPath, "standardDsls"));
  }
  return scriptFolders;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GroovyDslFileIndex.java

示例2: testLabelsAndColors

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public void testLabelsAndColors() throws Exception {
  final TrelloCard card = myRepository.fetchCardById(COLORED_CARD_ID);
  assertNotNull(card);
  final List<TrelloLabel> labels = card.getLabels();

  assertEquals(6, labels.size());
  final Set<String> labelNames = ContainerUtil.map2Set(labels, new Function<TrelloLabel, String>() {
    @Override
    public String fun(TrelloLabel label) {
      return label.getName();
    }
  });
  assertEquals(ContainerUtil.newHashSet("Sky colored label", "Boring label", "Dull label", ""), labelNames);

  assertEquals(EnumSet.of(SKY, LIME, PINK, BLACK), card.getColors());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:TrelloIntegrationTest.java

示例3: getUsages

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public Set<UsageDescriptor> getUsages() {
  final IdeaPluginDescriptor[] plugins = PluginManagerCore.getPlugins();
  final List<IdeaPluginDescriptor> nonBundledEnabledPlugins = ContainerUtil.filter(plugins, new Condition<IdeaPluginDescriptor>() {
    public boolean value(final IdeaPluginDescriptor d) {
      return d.isEnabled() && !d.isBundled() && d.getPluginId() != null;
    }
  });

  return ContainerUtil.map2Set(nonBundledEnabledPlugins, new Function<IdeaPluginDescriptor, UsageDescriptor>() {
    @Override
    public UsageDescriptor fun(IdeaPluginDescriptor descriptor) {
      return new UsageDescriptor(descriptor.getPluginId().getIdString(), 1);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:NonBundledPluginsUsagesCollector.java

示例4: assertVisitedPaths

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private void assertVisitedPaths(File from, String... expected) {
  VirtualFile vDir = refreshAndFind(from);
  assertNotNull(vDir);

  Set<String> expectedSet = ContainerUtil.map2Set(expected, new Function<String, String>() {
    @Override
    public String fun(String path) {
      return FileUtil.toSystemIndependentName(path);
    }
  });
  expectedSet.add(vDir.getPath());

  final Set<String> actualSet = new HashSet<String>();
  VfsUtilCore.visitChildrenRecursively(vDir, new VirtualFileVisitor() {
    @Override
    public boolean visitFile(@NotNull VirtualFile file) {
      actualSet.add(file.getPath());
      return true;
    }
  });

  assertEquals(expectedSet, actualSet);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:SymlinkHandlingTest.java

示例5: getFirstFreeDriveLetter

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static char getFirstFreeDriveLetter() {
  final Set<Character> roots = ContainerUtil.map2Set(File.listRoots(), new Function<File, Character>() {
    @Override
    public Character fun(File root) {
      return root.getPath().toUpperCase(Locale.US).charAt(0);
    }
  });

  char drive = 0;
  for (char c = 'E'; c <= 'Z'; c++) {
    if (!roots.contains(c)) {
      drive = c;
      break;
    }
  }

  assertFalse("Occupied: " + roots.toString(), drive == 0);
  return drive;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:IoTestUtil.java

示例6: getAffectedSupports

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
private <R extends Repository, S extends PushSource, T extends PushTarget> List<PushSupport<R, S, T>> getAffectedSupports() {
  Collection<Repository> repositories = myGlobalRepositoryManager.getRepositories();
  Collection<AbstractVcs> vcss = ContainerUtil.map2Set(repositories, new Function<Repository, AbstractVcs>() {
    @Override
    public AbstractVcs fun(@NotNull Repository repository) {
      return repository.getVcs();
    }
  });
  return ContainerUtil.map(vcss, new Function<AbstractVcs, PushSupport<R, S, T>>() {
    @Override
    public PushSupport<R, S, T> fun(AbstractVcs vcs) {
      //noinspection unchecked
      return DvcsUtil.getPushSupport(vcs);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PushController.java

示例7: getReferencedFields

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
private List<PsiField> getReferencedFields(@NotNull final PsiField field) {
  final List<PsiField> referencedElements = new ArrayList<PsiField>();

  PsiExpression fieldInitializer = field.getInitializer();
  PsiClass containingClass = field.getContainingClass();

  if (fieldInitializer == null || containingClass == null) {
    return referencedElements;
  }

  Set<PsiField> classFields = myCachedClassFields.get(containingClass);
  if (classFields == null) {
    classFields = ContainerUtil.map2Set(containingClass.getFields(), Functions.<PsiField>id());
    myCachedClassFields.put(containingClass, classFields);
  }

  final Set<PsiField> containingClassFields = classFields;
  fieldInitializer.accept(new JavaRecursiveElementVisitor() {
    public int myCurrentMethodLookupDepth;
    private static final int MAX_METHOD_LOOKUP_DEPTH = 3;

    @Override
    public void visitReferenceExpression(PsiReferenceExpression expression) {
      PsiElement ref = expression.resolve();
      if (ref instanceof PsiField && containingClassFields.contains(ref) && hasSameStaticModifier(field, (PsiField)ref)) {
        referencedElements.add((PsiField)ref);
      }
      else if (ref instanceof PsiMethod && myCurrentMethodLookupDepth < MAX_METHOD_LOOKUP_DEPTH) {
        myCurrentMethodLookupDepth++;
        visitMethod((PsiMethod)ref);
        myCurrentMethodLookupDepth--;
      }

      super.visitReferenceExpression(expression);
    }
  });

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

示例8: getLocalBranches

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static Set<String> getLocalBranches(GitRepository repository) {
  return ContainerUtil.map2Set(repository.getBranches().getLocalBranches(), new Function<GitBranch, String>() {
    @Override
    public String fun(GitBranch branch) {
      return branch.getName();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:GitRefManager.java

示例9: groupByLeaves

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private Set<String> groupByLeaves() throws Exception {
  SliceTreeStructure treeStructure = configureTree(getTestName(false));
  final SliceRootNode root = (SliceRootNode)treeStructure.getRootElement();
  Map<SliceNode, Collection<PsiElement>> map = SliceLeafAnalyzer.createMap();
  Collection<PsiElement> leaves = SliceLeafAnalyzer.calcLeafExpressions(root, treeStructure, map);
  return ContainerUtil.map2Set(leaves, new Function<PsiElement, String>() {
    @Override
    public String fun(PsiElement element) {
      return element.getText();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:SliceTreeTest.java

示例10: getMatchedCommitIndex

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
private Set<Integer> getMatchedCommitIndex(@Nullable Collection<Hash> commits) {
  if (commits == null) {
    return null;
  }

  return ContainerUtil.map2Set(commits, new Function<Hash, Integer>() {
    @Override
    public Integer fun(Hash hash) {
      return myHashMap.getCommitIndex(hash);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:VisiblePackBuilder.java

示例11: convertNodeIndexesToIds

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public static Set<Integer> convertNodeIndexesToIds(@NotNull final LinearGraph graph, @NotNull Collection<Integer> nodeIndexes) {
  return ContainerUtil.map2Set(nodeIndexes, new Function<Integer, Integer>() {
    @Override
    public Integer fun(Integer nodeIndex) {
      return graph.getNodeId(nodeIndex);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:LinearGraphUtils.java

示例12: getTrackedRemoteBranchesFromConfig

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static Set<String> getTrackedRemoteBranchesFromConfig(GitRepository repository) {
  return ContainerUtil.map2Set(repository.getBranchTrackInfos(), new Function<GitBranchTrackInfo, String>() {
    @Override
    public String fun(GitBranchTrackInfo trackInfo) {
      return trackInfo.getRemoteBranch().getName();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:GitRefManager.java

示例13: AllFileTemplatesConfigurable

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public AllFileTemplatesConfigurable(Project project) {
  myProject = project;
  myManager = getInstance(project);
  myScheme = myManager.getCurrentScheme();
  myInternalTemplateNames = ContainerUtil.map2Set(myManager.getInternalTemplates(), new Function<FileTemplate, String>() {
    @Override
    public String fun(FileTemplate template) {
      return template.getName();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:AllFileTemplatesConfigurable.java

示例14: getUsages

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public Set<UsageDescriptor> getUsages() {
  return ContainerUtil.map2Set(PluginManagerCore.getDisabledPlugins(), new Function<String, UsageDescriptor>() {
    @Override
    public UsageDescriptor fun(String descriptor) {
      return new UsageDescriptor(descriptor, 1);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:DisabledPluginsUsagesCollector.java

示例15: getRootsToIndex

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public final Set<String> getRootsToIndex() {
  return ContainerUtil.map2Set(getAdditionalRootsToIndex(), new NotNullFunction<VirtualFile, String>() {
    @NotNull
    @Override
    public String fun(VirtualFile virtualFile) {
      return virtualFile.getUrl();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:IndexableSetContributor.java


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