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


Java OrderedSet类代码示例

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


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

示例1: combineTemplatesWithSameName

import com.intellij.util.containers.OrderedSet; //导入依赖的package包/类
/**
 * Combines templates with the same name into a {@link CombinedPostfixTemplate} and returns the result.
 *
 * @param templates templates that may have name duplicates
 * @return (combined) templates
 */
private Set<PostfixTemplate> combineTemplatesWithSameName(Set<PostfixTemplate> templates) {
	// group templates by name
	Map<String, List<PostfixTemplate>> key2templates = templates.stream().collect(
		Collectors.groupingBy(
			PostfixTemplate::getKey, toList()
		)
	);

	// combine templates with the same name
	Set<PostfixTemplate> combinedTemplates = new OrderedSet<>();
	for (List<PostfixTemplate> theseTemplates : key2templates.values()) {
		if (theseTemplates.size() == 1) {
			combinedTemplates.add(theseTemplates.get(0));
		} else {
			String example = templates.stream().distinct().count() > 1 ? theseTemplates.get(0).getExample() : "";
			combinedTemplates.add(new CombinedPostfixTemplate(theseTemplates.get(0).getKey(), example, theseTemplates));
		}
	}

	return combinedTemplates;
}
 
开发者ID:xylo,项目名称:intellij-postfix-templates,代码行数:28,代码来源:CustomPostfixTemplateProvider.java

示例2: getOutputPaths

import com.intellij.util.containers.OrderedSet; //导入依赖的package包/类
public static String[] getOutputPaths(Module[] modules) {
  final Set<String> outputPaths = new OrderedSet<String>();
  for (Module module : modules) {
    final CompilerModuleExtension compilerModuleExtension = !module.isDisposed()? CompilerModuleExtension.getInstance(module) : null;
    if (compilerModuleExtension == null) {
      continue;
    }
    String outputPathUrl = compilerModuleExtension.getCompilerOutputUrl();
    if (outputPathUrl != null) {
      outputPaths.add(VirtualFileManager.extractPath(outputPathUrl).replace('/', File.separatorChar));
    }

    String outputPathForTestsUrl = compilerModuleExtension.getCompilerOutputUrlForTests();
    if (outputPathForTestsUrl != null) {
      outputPaths.add(VirtualFileManager.extractPath(outputPathForTestsUrl).replace('/', File.separatorChar));
    }
  }
  return ArrayUtil.toStringArray(outputPaths);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:CompilerPathsEx.java

示例3: getCompilationClasses

import com.intellij.util.containers.OrderedSet; //导入依赖的package包/类
private static String[] getCompilationClasses(final Module module,
                                              final GenerationOptionsImpl options,
                                              final boolean forRuntime,
                                              final boolean forTest,
                                              final boolean firstLevel) {
  final CompilerModuleExtension extension = CompilerModuleExtension.getInstance(module);
  if (extension == null) return ArrayUtil.EMPTY_STRING_ARRAY;

  if (!forRuntime) {
    if (forTest) {
      return extension.getOutputRootUrls(!firstLevel);
    }
    else {
      return firstLevel ? ArrayUtil.EMPTY_STRING_ARRAY : extension.getOutputRootUrls(false);
    }
  }
  final Set<String> jdkUrls = options.getAllJdkUrls();

  final OrderedSet<String> urls = new OrderedSet<String>();
  ContainerUtil.addAll(urls, extension.getOutputRootUrls(forTest));
  urls.removeAll(jdkUrls);
  return ArrayUtil.toStringArray(urls);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ModuleChunkClasspath.java

示例4: copyTo

import com.intellij.util.containers.OrderedSet; //导入依赖的package包/类
@NotNull
public KeymapImpl copyTo(@NotNull final KeymapImpl otherKeymap) {
  otherKeymap.myParent = myParent;
  otherKeymap.myName = myName;
  otherKeymap.myCanModify = canModify();

  otherKeymap.cleanShortcutsCache();

  otherKeymap.myActionId2ListOfShortcuts.clear();
  otherKeymap.myActionId2ListOfShortcuts.ensureCapacity(myActionId2ListOfShortcuts.size());
  myActionId2ListOfShortcuts.forEachEntry(new TObjectObjectProcedure<String, OrderedSet<Shortcut>>() {
    @Override
    public boolean execute(String actionId, OrderedSet<Shortcut> shortcuts) {
      otherKeymap.myActionId2ListOfShortcuts.put(actionId, new OrderedSet<Shortcut>(shortcuts));
      return true;
    }
  });
  return otherKeymap;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:KeymapImpl.java

示例5: addShortcutSilently

import com.intellij.util.containers.OrderedSet; //导入依赖的package包/类
private void addShortcutSilently(String actionId, Shortcut shortcut, final boolean checkParentShortcut) {
  OrderedSet<Shortcut> list = myActionId2ListOfShortcuts.get(actionId);
  if (list == null) {
    list = new OrderedSet<Shortcut>();
    myActionId2ListOfShortcuts.put(actionId, list);
    Shortcut[] boundShortcuts = getBoundShortcuts(actionId);
    if (boundShortcuts != null) {
      ContainerUtil.addAll(list, boundShortcuts);
    }
    else if (myParent != null) {
      ContainerUtil.addAll(list, getParentShortcuts(actionId));
    }
  }
  list.add(shortcut);

  if (checkParentShortcut && myParent != null && areShortcutsEqual(getParentShortcuts(actionId), getShortcuts(actionId))) {
    myActionId2ListOfShortcuts.remove(actionId);
  }
  cleanShortcutsCache();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:KeymapImpl.java

示例6: addAction2ShortcutsMap

import com.intellij.util.containers.OrderedSet; //导入依赖的package包/类
private <T extends Shortcut>void addAction2ShortcutsMap(final String actionId, final Map<T, List<String>> strokesMap, final Class<T> shortcutClass) {
  OrderedSet<Shortcut> listOfShortcuts = _getShortcuts(actionId);
  for (Shortcut shortcut : listOfShortcuts) {
    if (!shortcutClass.isAssignableFrom(shortcut.getClass())) {
      continue;
    }
    @SuppressWarnings({"unchecked"})
    T t = (T)shortcut;

    List<String> listOfIds = strokesMap.get(t);
    if (listOfIds == null) {
      listOfIds = new ArrayList<String>();
      strokesMap.put(t, listOfIds);
    }

    // action may have more that 1 shortcut with same first keystroke
    if (!listOfIds.contains(actionId)) {
      listOfIds.add(actionId);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:KeymapImpl.java

示例7: addKeystrokesMap

import com.intellij.util.containers.OrderedSet; //导入依赖的package包/类
private void addKeystrokesMap(final String actionId, final Map<KeyStroke, List<String>> strokesMap) {
  OrderedSet<Shortcut> listOfShortcuts = _getShortcuts(actionId);
  for (Shortcut shortcut : listOfShortcuts) {
    if (!(shortcut instanceof KeyboardShortcut)) {
      continue;
    }
    KeyStroke firstKeyStroke = ((KeyboardShortcut)shortcut).getFirstKeyStroke();
    List<String> listOfIds = strokesMap.get(firstKeyStroke);
    if (listOfIds == null) {
      listOfIds = new ArrayList<String>();
      strokesMap.put(firstKeyStroke, listOfIds);
    }

    // action may have more that 1 shortcut with same first keystroke
    if (!listOfIds.contains(actionId)) {
      listOfIds.add(actionId);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:KeymapImpl.java

示例8: _getShortcuts

import com.intellij.util.containers.OrderedSet; //导入依赖的package包/类
private OrderedSet<Shortcut> _getShortcuts(final String actionId) {
  KeymapManagerEx keymapManager = getKeymapManager();
  OrderedSet<Shortcut> listOfShortcuts = myActionId2ListOfShortcuts.get(actionId);
  if (listOfShortcuts != null) {
    return listOfShortcuts;
  }
  else {
    listOfShortcuts = new OrderedSet<Shortcut>();
  }

  final String actionBinding = keymapManager.getActionBinding(actionId);
  if (actionBinding != null) {
    listOfShortcuts.addAll(_getShortcuts(actionBinding));
  }

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

示例9: getShortcuts

import com.intellij.util.containers.OrderedSet; //导入依赖的package包/类
@NotNull
@Override
public Shortcut[] getShortcuts(String actionId) {
  OrderedSet<Shortcut> shortcuts = myActionId2ListOfShortcuts.get(actionId);

  if (shortcuts == null) {
    Shortcut[] boundShortcuts = getBoundShortcuts(actionId);
    if (boundShortcuts!= null) return boundShortcuts;
  }

  if (shortcuts == null) {
    if (myParent != null) {
      return getParentShortcuts(actionId);
    }
    else {
      return ourEmptyShortcutsArray;
    }
  }
  return shortcuts.isEmpty() ? ourEmptyShortcutsArray : shortcuts.toArray(new Shortcut[shortcuts.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:KeymapImpl.java

示例10: addAnnotationsJar

import com.intellij.util.containers.OrderedSet; //导入依赖的package包/类
private static void addAnnotationsJar(@NotNull Module module, @NotNull OrderedSet<VirtualFile> libs) {
  Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
  if (sdk == null || !isAndroidSdk(sdk)) {
    return;
  }
  String sdkHomePath = sdk.getHomePath();
  if (sdkHomePath == null) {
    return;
  }
  AndroidPlatform platform = AndroidPlatform.getInstance(module);

  if (platform != null && platform.needToAddAnnotationsJarToClasspath()) {
    String annotationsJarPath = toSystemIndependentName(sdkHomePath) + ANNOTATIONS_JAR_RELATIVE_PATH;
    VirtualFile annotationsJar = LocalFileSystem.getInstance().findFileByPath(annotationsJarPath);

    if (annotationsJar != null) {
      libs.add(annotationsJar);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AndroidRootUtil.java

示例11: getOutputPaths

import com.intellij.util.containers.OrderedSet; //导入依赖的package包/类
public static String[] getOutputPaths(Module[] modules) {
  final Set<String> outputPaths = new OrderedSet<String>();
  for (Module module : modules) {
    final CompilerModuleExtension compilerModuleExtension = CompilerModuleExtension.getInstance(module);
    if (compilerModuleExtension == null) {
      continue;
    }
    String outputPathUrl = compilerModuleExtension.getCompilerOutputUrl();
    if (outputPathUrl != null) {
      outputPaths.add(VirtualFileManager.extractPath(outputPathUrl).replace('/', File.separatorChar));
    }

    String outputPathForTestsUrl = compilerModuleExtension.getCompilerOutputUrlForTests();
    if (outputPathForTestsUrl != null) {
      outputPaths.add(VirtualFileManager.extractPath(outputPathForTestsUrl).replace('/', File.separatorChar));
    }
  }
  return ArrayUtil.toStringArray(outputPaths);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:CompilerPathsEx.java

示例12: recalculateOutputDirs

import com.intellij.util.containers.OrderedSet; //导入依赖的package包/类
public void recalculateOutputDirs() {
  final Module[] allModules = ModuleManager.getInstance(myProject).getModules();

  final Set<VirtualFile> allDirs = new OrderedSet<VirtualFile>();
  final Set<VirtualFile> testOutputDirs = new java.util.HashSet<VirtualFile>();
  final Set<VirtualFile> productionOutputDirs = new java.util.HashSet<VirtualFile>();

  for (Module module : allModules) {
    final CompilerModuleExtension manager = CompilerModuleExtension.getInstance(module);
    final VirtualFile output = manager.getCompilerOutputPath();
    if (output != null && output.isValid()) {
      allDirs.add(output);
      productionOutputDirs.add(output);
    }
    final VirtualFile testsOutput = manager.getCompilerOutputPathForTests();
    if (testsOutput != null && testsOutput.isValid()) {
      allDirs.add(testsOutput);
      testOutputDirs.add(testsOutput);
    }
  }
  myOutputDirectories = VfsUtil.toVirtualFileArray(allDirs);
  // need this to ensure that the sent contains only _dedicated_ test output dirs
  // Directories that are configured for both test and production classes must not be added in the resulting set
  testOutputDirs.removeAll(productionOutputDirs);
  myTestOutputDirectories = Collections.unmodifiableSet(testOutputDirs);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:CompileContextImpl.java

示例13: collectAllElements

import com.intellij.util.containers.OrderedSet; //导入依赖的package包/类
protected void collectAllElements(@NotNull PsiElement atCaret, @NotNull OrderedSet<PsiElement> res, boolean recurse) {
  res.add(0, atCaret);
  if (doNotStepInto(atCaret)) {
    if (!recurse) return;
    recurse = false;
  }

  PsiElement parent = atCaret.getParent();
  if (atCaret instanceof GrClosableBlock && parent instanceof GrStringInjection && parent.getParent() instanceof GrString) {
    res.add(parent.getParent());
  }

  if (parent instanceof GrArgumentList) {
    res.add(parent.getParent());
  }

  //if (parent instanceof GrWhileStatement) {
  //  res.add(parent);
  //}

  final PsiElement[] children = getChildren(atCaret);

  for (PsiElement child : children) {
    collectAllElements(child, res, recurse);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:GroovySmartEnterProcessor.java

示例14: getCompilationClasspath

import com.intellij.util.containers.OrderedSet; //导入依赖的package包/类
@NotNull
@Override
public Set<VirtualFile> getCompilationClasspath(@NotNull CompileContext compileContext, @NotNull ModuleChunk moduleChunk)
{
	Sdk sdkForCompilation = getSdkForCompilation();
	if(sdkForCompilation == null)
	{
		return Collections.emptySet();
	}

	Set<VirtualFile> files = new OrderedSet<>();

	ContainerUtil.addAll(files, sdkForCompilation.getRootProvider().getFiles(BinariesOrderRootType.getInstance()));

	files.addAll(moduleChunk.getCompilationClasspathFiles(IkvmBundleType.getInstance()));

	VirtualFile fileByPath = LocalFileSystem.getInstance().findFileByPath(PathManager.getSystemPath() + "/ikvm-stubs/" + getModule().getName() + "@" + getModule().getModuleDirUrl().hashCode());
	if(fileByPath != null)
	{
		files.add(fileByPath);
	}
	return files;
}
 
开发者ID:consulo,项目名称:consulo-ikvm,代码行数:24,代码来源:MicrosoftIkvmModuleExtension.java

示例15: getCompilationClasspath

import com.intellij.util.containers.OrderedSet; //导入依赖的package包/类
@NotNull
@Override
public Set<VirtualFile> getCompilationClasspath(@NotNull CompileContext compileContext, @NotNull ModuleChunk moduleChunk)
{
	Sdk sdkForCompilation = getSdkForCompilation();
	Set<VirtualFile> files = new OrderedSet<>();

	ContainerUtil.addAll(files, sdkForCompilation.getRootProvider().getFiles(BinariesOrderRootType.getInstance()));

	VirtualFile fileByPath = LocalFileSystem.getInstance().findFileByPath(PathManager.getSystemPath() + "/ikvm-stubs/" + getModule().getName() + "@" + getModule().getModuleDirUrl().hashCode());
	if(fileByPath != null)
	{
		files.add(fileByPath);
	}

	files.addAll(moduleChunk.getCompilationClasspathFiles(IkvmBundleType.getInstance()));
	return files;
}
 
开发者ID:consulo,项目名称:consulo-ikvm,代码行数:19,代码来源:MonoIkvmModuleExtension.java


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