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


Java OrderEnumerator类代码示例

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


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

示例1: scanForModifiedClasses

import com.intellij.openapi.roots.OrderEnumerator; //导入依赖的package包/类
public Map<String, HotSwapFile> scanForModifiedClasses( DebuggerSession session, HotSwapProgress progress )
{
  DebuggerManagerThreadImpl.assertIsManagerThread();

  Map<String, HotSwapFile> modifiedClasses = new HashMap<>();

  List<File> outputRoots = new ArrayList<>();
  ApplicationManager.getApplication().runReadAction(
    () -> {
       VirtualFile[] allDirs = OrderEnumerator.orderEntries( getIjProject() ).getAllSourceRoots();
       for( VirtualFile dir : allDirs )
       {
         outputRoots.add( new File( dir.getPath() ) );
       }
     } );
  long timeStamp = getTimeStamp( session );
  for( File root : outputRoots )
  {
    String rootPath = FileUtil.toCanonicalPath( root.getPath() );
    collectModifiedClasses( root, rootPath, modifiedClasses, progress, timeStamp );
  }
  setTimeStamp( session, System.currentTimeMillis() );
  return modifiedClasses;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:25,代码来源:HotSwapComponent.java

示例2: makeClassLoaderClassPath

import com.intellij.openapi.roots.OrderEnumerator; //导入依赖的package包/类
private URL[] makeClassLoaderClassPath()
{
  List<URL> outputRoots = new ArrayList<>();
      ApplicationManager.getApplication().runReadAction(
        () -> {
           final List<VirtualFile> allDirs = OrderEnumerator.orderEntries( getIjProject() ).withoutSdk().getPathsList().getRootDirs();
           for( VirtualFile dir : allDirs )
           {
             try
             {
               outputRoots.add( new File( getPath( dir ) ).toURI().toURL() );
             }
             catch( MalformedURLException e )
             {
               throw new RuntimeException( e );
             }
           }
         } );
      return outputRoots.toArray( new URL[outputRoots.size()] );
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:21,代码来源:HotSwapComponent.java

示例3: getMuleHome

import com.intellij.openapi.roots.OrderEnumerator; //导入依赖的package包/类
@Nullable
private static String getMuleHome(@NotNull Module module) {
    if (!DumbService.isDumb(module.getProject())) {
        final OrderEnumerator enumerator = ModuleRootManager.getInstance(module)
                .orderEntries().recursively().librariesOnly().exportedOnly();
        final String[] home = new String[1];
        enumerator.forEachLibrary(library -> {
            if (MuleLibraryKind.MULE_LIBRARY_KIND.equals(((LibraryEx) library).getKind()) &&
                    library.getFiles(OrderRootType.CLASSES) != null &&
                    library.getFiles(OrderRootType.CLASSES).length > 0) {
                home[0] = getMuleHome(library.getFiles(OrderRootType.CLASSES)[0]);
                return false;
            } else {
                return true;
            }
        });

        return home[0];
    }
    return null;
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:22,代码来源:MuleSdk.java

示例4: processClassPathItems

import com.intellij.openapi.roots.OrderEnumerator; //导入依赖的package包/类
public static void processClassPathItems(final VirtualFile virtualFile, final Module module, final Consumer<VirtualFile> consumer,
                                         boolean includeModuleOutput) {
  if (isJarFile(virtualFile)){
    consumer.consume(virtualFile);
  }

  if (module != null) {
    OrderEnumerator enumerator = ModuleRootManager.getInstance(module).orderEntries().recursively();
    if (!includeModuleOutput) {
      enumerator = enumerator.withoutModuleSourceEntries();
    }
    for (VirtualFile root : enumerator.getClassesRoots()) {
      final VirtualFile file;
      if (root.getFileSystem().getProtocol().equals(JarFileSystem.PROTOCOL)) {
        file = JarFileSystem.getInstance().getVirtualFileForJar(root);
      }
      else {
        file = root;
      }
      consumer.consume(file);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:JspSpiUtil.java

示例5: getGradleHome

import com.intellij.openapi.roots.OrderEnumerator; //导入依赖的package包/类
/**
 * Tries to return gradle home that is defined as a dependency to the given module.
 *
 * @param module target module
 * @return file handle that points to the gradle installation home defined as a dependency of the given module (if any)
 */
@Nullable
public VirtualFile getGradleHome(@Nullable Module module) {
  if (module == null) {
    return null;
  }
  final VirtualFile[] roots = OrderEnumerator.orderEntries(module).getAllLibrariesAndSdkClassesRoots();
  if (roots == null) {
    return null;
  }
  for (VirtualFile root : roots) {
    if (root != null && isGradleSdkHome(root)) {
      return root;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GradleInstallationManager.java

示例6: isRoboVmModule

import com.intellij.openapi.roots.OrderEnumerator; //导入依赖的package包/类
public static boolean isRoboVmModule(Module module) {
    // HACK! to identify if the module uses a robovm sdk
    if (ModuleRootManager.getInstance(module).getSdk() != null) {
        if (ModuleRootManager.getInstance(module).getSdk().getSdkType().getName().toLowerCase().contains("robovm")) {
            return true;
        }
    }

    // check if there's any RoboVM RT libs in the classpath
    OrderEnumerator classes = ModuleRootManager.getInstance(module).orderEntries().recursively().withoutSdk().compileOnly();
    for (String path : classes.getPathsList().getPathList()) {
        if (isSdkLibrary(path)) {
            return true;
        }
    }

    // check if there's a robovm.xml file in the root of the module
    for(VirtualFile file: ModuleRootManager.getInstance(module).getContentRoots()) {
        if(file.findChild("robovm.xml") != null) {
            return true;
        }
    }

    return false;
}
 
开发者ID:robovm,项目名称:robovm-idea,代码行数:26,代码来源:RoboVmPlugin.java

示例7: getGradleHome

import com.intellij.openapi.roots.OrderEnumerator; //导入依赖的package包/类
/**
 * Tries to return gradle home that is defined as a dependency to the given module.
 *
 * @param module  target module
 * @return file handle that points to the gradle installation home defined as a dependency of the given module (if any)
 */
@Nullable
public VirtualFile getGradleHome(@Nullable Module module) {
  if (module == null) {
    return null;
  }
  final VirtualFile[] roots = OrderEnumerator.orderEntries(module).getAllLibrariesAndSdkClassesRoots();
  if (roots == null) {
    return null;
  }
  for (VirtualFile root : roots) {
    if (root != null && isGradleSdkHome(root)) {
      return root;
    }
  }
  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:GradleInstallationManager.java

示例8: assertClasspath

import com.intellij.openapi.roots.OrderEnumerator; //导入依赖的package包/类
private void assertClasspath(String moduleName, Scope scope, Type type, String... expectedPaths) throws Exception {
  createOutputDirectories();

  PathsList actualPathsList;
  Module module = getModule(moduleName);

  if (scope == Scope.RUNTIME) {
    JavaParameters params = new JavaParameters();
    params.configureByModule(module, type == Type.TESTS ? JavaParameters.CLASSES_AND_TESTS : JavaParameters.CLASSES_ONLY);
    actualPathsList = params.getClassPath();
  }
  else {
    OrderEnumerator en = OrderEnumerator.orderEntries(module).recursively().withoutSdk().compileOnly();
    if (type == Type.PRODUCTION) en.productionOnly();
    actualPathsList = en.classes().getPathsList();
  }

  assertPaths(expectedPaths, actualPathsList.getPathList());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:MavenClasspathsAndSearchScopesTest.java

示例9: findGroovyJar

import com.intellij.openapi.roots.OrderEnumerator; //导入依赖的package包/类
@Nullable
protected static VirtualFile findGroovyJar(@NotNull Module module) {
  final VirtualFile[] files = OrderEnumerator.orderEntries(module).getAllLibrariesAndSdkClassesRoots();
  for (VirtualFile root : files) {
    if (root.getName().matches(GroovyConfigUtils.GROOVY_JAR_PATTERN)
        || GroovyConfigUtils.matchesGroovyAll(root.getName()))
    {
      return root;
    }
  }
  for (VirtualFile file : files) {
    if (file.getName().contains("groovy") && "jar".equals(file.getExtension())) {
      return file;
    }
  }
  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:GroovyScriptRunner.java

示例10: resolveSdkRoot

import com.intellij.openapi.roots.OrderEnumerator; //导入依赖的package包/类
private HaxeSourceRootModel resolveSdkRoot() {
  final VirtualFile[] roots;

  if (ApplicationManager.getApplication().isUnitTestMode()) {
    roots = OrderEnumerator.orderEntries(project).getAllSourceRoots();
    if (roots.length > 0) {
      VirtualFile stdRootForTests = roots[0].findChild("std");
      if (stdRootForTests != null) {
        return new HaxeSourceRootModel(this, stdRootForTests);
      }
    }
  } else {
    roots = OrderEnumerator.orderEntries(project).sdkOnly().getAllSourceRoots();
    if (roots.length > 0) {
      return new HaxeSourceRootModel(this, roots[0]);
    }
  }
  return HaxeSourceRootModel.DUMMY;
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:20,代码来源:HaxeProjectModel.java

示例11: getJdkToRunModule

import com.intellij.openapi.roots.OrderEnumerator; //导入依赖的package包/类
private Sdk getJdkToRunModule(Module module) {
    final Sdk moduleSdk = ModuleRootManager.getInstance(module).getSdk();
    if (moduleSdk == null) {
        return null;
    }

    final Set<Sdk> sdksFromDependencies = new LinkedHashSet<>();
    OrderEnumerator enumerator = OrderEnumerator.orderEntries(module).runtimeOnly().recursively();
    enumerator = enumerator.productionOnly();
    enumerator.forEachModule(module1 -> {
        Sdk sdk = ModuleRootManager.getInstance(module1).getSdk();
        if (sdk != null && sdk.getSdkType().equals(moduleSdk.getSdkType())) {
            sdksFromDependencies.add(sdk);
        }
        return true;
    });
    return findLatestVersion(moduleSdk, sdksFromDependencies);
}
 
开发者ID:ligasgr,项目名称:intellij-xquery,代码行数:19,代码来源:XQueryRunProfileState.java

示例12: createUsersClassLoader

import com.intellij.openapi.roots.OrderEnumerator; //导入依赖的package包/类
public static ClassLoader createUsersClassLoader(JavaTestConfigurationBase configuration)
{
	Module module = configuration.getConfigurationModule().getModule();
	List<URL> urls = new ArrayList<>();

	PathsList pathsList = ReadAction.compute(() -> (module == null || configuration.getTestSearchScope() == TestSearchScope.WHOLE_PROJECT ? OrderEnumerator.orderEntries(configuration.getProject
			()) : OrderEnumerator.orderEntries(module)).runtimeOnly().recursively().getPathsList()); //include jdk to avoid NoClassDefFoundError for classes inside tools.jar
	for(VirtualFile file : pathsList.getVirtualFiles())
	{
		try
		{
			urls.add(VfsUtilCore.virtualToIoFile(file).toURI().toURL());
		}
		catch(MalformedURLException ignored)
		{
			LOG.info(ignored);
		}
	}

	return UrlClassLoader.build().allowLock().useCache().urls(urls).get();
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:22,代码来源:TestClassCollector.java

示例13: scanForModifiedClasses

import com.intellij.openapi.roots.OrderEnumerator; //导入依赖的package包/类
private Map<String, HotSwapFile> scanForModifiedClasses(final DebuggerSession session, final HotSwapProgress progress)
{
	DebuggerManagerThreadImpl.assertIsManagerThread();

	final long timeStamp = getTimeStamp(session);
	final Map<String, HotSwapFile> modifiedClasses = new HashMap<>();

	List<File> outputRoots = ApplicationManager.getApplication().runReadAction((Computable<List<File>>) () -> {
		final List<VirtualFile> allDirs = OrderEnumerator.orderEntries(session.getProject()).withoutSdk().withoutLibraries().getPathsList().getRootDirs();
		return allDirs.stream().map(VfsUtil::virtualToIoFile).collect(Collectors.toList());
	});

	for(File root : outputRoots)
	{
		final String rootPath = FileUtil.toCanonicalPath(root.getPath());
		collectModifiedClasses(root, rootPath, rootPath + "/", modifiedClasses, progress, timeStamp);
	}

	return modifiedClasses;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:21,代码来源:HotSwapManager.java

示例14: configureByModule

import com.intellij.openapi.roots.OrderEnumerator; //导入依赖的package包/类
public void configureByModule(final Module module, @MagicConstant(valuesFromClass = OwnJavaParameters.class) int classPathType, @Nullable Sdk jdk) throws CantRunException
{
	if((classPathType & JDK_ONLY) != 0)
	{
		if(jdk == null)
		{
			throw CantRunException.noJdkConfigured();
		}
		setJdk(jdk);
	}

	if((classPathType & CLASSES_ONLY) == 0)
	{
		return;
	}

	setDefaultCharset(module.getProject());
	configureEnumerator(OrderEnumerator.orderEntries(module).recursively(), classPathType, jdk).collectPaths(getClassPath());
	configureJavaLibraryPath(OrderEnumerator.orderEntries(module).recursively());
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:21,代码来源:OwnJavaParameters.java

示例15: configureJavaLibraryPath

import com.intellij.openapi.roots.OrderEnumerator; //导入依赖的package包/类
private void configureJavaLibraryPath(OrderEnumerator enumerator)
{
	PathsList pathsList = new PathsList();
	enumerator.runtimeOnly().withoutSdk().roots(NativeLibraryOrderRootType.getInstance()).collectPaths(pathsList);
	if(!pathsList.getPathList().isEmpty())
	{
		ParametersList vmParameters = getVMParametersList();
		if(vmParameters.hasProperty(JAVA_LIBRARY_PATH_PROPERTY))
		{
			LOG.info(JAVA_LIBRARY_PATH_PROPERTY + " property is already specified, " + "native library paths from dependencies (" + pathsList.getPathsString() + ") won't be added");
		}
		else
		{
			vmParameters.addProperty(JAVA_LIBRARY_PATH_PROPERTY, pathsList.getPathsString());
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:18,代码来源:OwnJavaParameters.java


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