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


Java PathsList类代码示例

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


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

示例1: inferProjectFiles

import com.intellij.util.PathsList; //导入依赖的package包/类
private void inferProjectFiles(Project project) {
    if (!isTypeInferenceEnabled()) return;
    final ProjectRootManager m = ProjectRootManager.getInstance(project);
    final PsiManager p = PsiManager.getInstance(project);

    ApplicationManager.getApplication().runReadAction(new Runnable() {
        @Override
        public void run() {
            final PathsList pathsList = m.orderEntries().withoutSdk().withoutLibraries().sources().getPathsList();
            final List<VirtualFile> virtualFiles = pathsList.getVirtualFiles();

            for (VirtualFile file : virtualFiles) {
                log.debug(file.getName());
            }
        }
    });
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:18,代码来源:LuaPsiManager.java

示例2: testTestOnlyModuleDependency

import com.intellij.util.PathsList; //导入依赖的package包/类
public void testTestOnlyModuleDependency() throws Exception {
  Module moduleA = createModule("a.iml", StdModuleTypes.JAVA);
  Module moduleB = addDependentModule(moduleA, DependencyScope.TEST);

  VirtualFile classB = myFixture.createFile("b/Test.java", "public class Test { }");
  assertTrue(moduleA.getModuleWithDependenciesAndLibrariesScope(true).contains(classB));
  assertFalse(moduleA.getModuleWithDependenciesAndLibrariesScope(false).contains(classB));
  assertFalse(moduleA.getModuleWithDependenciesAndLibrariesScope(false).isSearchInModuleContent(moduleB));

  final VirtualFile[] compilationClasspath = getCompilationClasspath(moduleA);
  assertEquals(1, compilationClasspath.length);
  final VirtualFile[] productionCompilationClasspath = getProductionCompileClasspath(moduleA);
  assertEmpty(productionCompilationClasspath);

  final PathsList pathsList = OrderEnumerator.orderEntries(moduleA).recursively().getPathsList();
  assertEquals(1, pathsList.getPathList().size());
  final PathsList pathsListWithoutTests = OrderEnumerator.orderEntries(moduleA).productionOnly().recursively().getPathsList();
  assertEquals(0, pathsListWithoutTests.getPathList().size());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ModuleScopesTest.java

示例3: enhanceRemoteProcessing

import com.intellij.util.PathsList; //导入依赖的package包/类
@Override
public void enhanceRemoteProcessing(@NotNull SimpleJavaParameters parameters) throws ExecutionException {
  final Set<String> additionalEntries = ContainerUtilRt.newHashSet();
  for (GradleProjectResolverExtension extension : RESOLVER_EXTENSIONS.getValue()) {
    ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(extension.getClass()));
    for (Class aClass : extension.getExtraProjectModelClasses()) {
      ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(aClass));
    }
    extension.enhanceRemoteProcessing(parameters);
  }

  final PathsList classPath = parameters.getClassPath();
  for (String entry : additionalEntries) {
    classPath.add(entry);
  }

  parameters.getVMParametersList().addProperty(
    ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY, GradleConstants.SYSTEM_ID.getId());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GradleManager.java

示例4: assertClasspath

import com.intellij.util.PathsList; //导入依赖的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:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:MavenClasspathsAndSearchScopesTest.java

示例5: removeFrameworkStuff

import com.intellij.util.PathsList; //导入依赖的package包/类
private PathsList removeFrameworkStuff(Module module, List<VirtualFile> rootFiles) {
  final List<File> toExclude = getImplicitClasspathRoots(module);
  if (LOG.isDebugEnabled()) {
    LOG.debug("Before removing framework stuff: " + rootFiles);
    LOG.debug("Implicit roots:" + toExclude);
  }

  PathsList scriptClassPath = new PathsList();
  eachRoot:
  for (VirtualFile file : rootFiles) {
    for (final File excluded : toExclude) {
      if (VfsUtil.isAncestor(excluded, VfsUtil.virtualToIoFile(file), false)) {
        continue eachRoot;
      }
    }
    scriptClassPath.add(file);
  }
  return scriptClassPath;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:MvcFramework.java

示例6: updateJavaParameters

import com.intellij.util.PathsList; //导入依赖的package包/类
/**
 * The goal of this function is to find classpath for JUnit runner.
 * <p/>
 * There are two ways to do so:
 * 1. If Pants supports `--export-classpath-manifest-jar-only`, then only the manifest jar will be
 * picked up which contains all the classpath links for a particular test.
 * 2. If not, this method will collect classpath based on all known target ids from project modules.
 */
@Override
public <T extends RunConfigurationBase> void updateJavaParameters(
  T configuration,
  JavaParameters params,
  RunnerSettings runnerSettings
) throws ExecutionException {
  final Module module = findPantsModule(configuration);
  if (module == null) {
    return;
  }
  /**
   * This enables dynamic classpath for this particular run and prevents argument too long errors caused by long classpaths.
   */
  params.setUseDynamicClasspath(true);

  final PathsList classpath = params.getClassPath();

  VirtualFile manifestJar = PantsUtil.findProjectManifestJar(configuration.getProject())
    .orElseThrow(() -> new ExecutionException("Pants supports manifest jar, but it is not found."));
  classpath.add(manifestJar.getPath());


  PantsExternalMetricsListenerManager.getInstance().logTestRunner(configuration);
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:33,代码来源:PantsClasspathRunConfigurationExtension.java

示例7: collectByOrderEnumerator

import com.intellij.util.PathsList; //导入依赖的package包/类
private PathsList collectByOrderEnumerator(ProjectRootsTraversing.RootTraversePolicy policy) {
  if (policy == ProjectClasspathTraversing.FULL_CLASSPATH) {
    return OrderEnumerator.orderEntries(myModule).withoutDepModules().getPathsList();
  }
  if (policy == ProjectClasspathTraversing.FULL_CLASS_RECURSIVE_WO_JDK) {
    return OrderEnumerator.orderEntries(myModule).withoutSdk().recursively().getPathsList();
  }
  if (policy == ProjectClasspathTraversing.FULL_CLASSPATH_RECURSIVE) {
    return OrderEnumerator.orderEntries(myModule).recursively().getPathsList();
  }
  if (policy == ProjectClasspathTraversing.FULL_CLASSPATH_WITHOUT_JDK_AND_TESTS) {
    return OrderEnumerator.orderEntries(myModule).withoutSdk().productionOnly().recursively().getPathsList();
  }
  if (policy == ProjectClasspathTraversing.FULL_CLASSPATH_WITHOUT_TESTS) {
    return OrderEnumerator.orderEntries(myModule).productionOnly().recursively().getPathsList();
  }
  throw new AssertionError(policy);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:ProjectClasspathTraversingTest.java

示例8: getClassPathFromRootModel

import com.intellij.util.PathsList; //导入依赖的package包/类
@Nullable
public static PathsList getClassPathFromRootModel(Module module, boolean isTests, JavaParameters params, boolean allowDuplication)
  throws CantRunException {
  if (module == null) {
    return null;
  }

  final JavaParameters tmp = new JavaParameters();
  tmp.configureByModule(module, isTests ? JavaParameters.CLASSES_AND_TESTS : JavaParameters.CLASSES_ONLY);
  if (tmp.getClassPath().getVirtualFiles().isEmpty()) {
    return null;
  }

  Set<VirtualFile> core = new HashSet<VirtualFile>(params.getClassPath().getVirtualFiles());

  PathsList nonCore = new PathsList();
  for (VirtualFile virtualFile : tmp.getClassPath().getVirtualFiles()) {
    if (allowDuplication || !core.contains(virtualFile)) {
      nonCore.add(virtualFile);
    }
  }
  return nonCore;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:GroovyScriptRunner.java

示例9: createUsersClassLoader

import com.intellij.util.PathsList; //导入依赖的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

示例10: appendParamsEncodingClasspath

import com.intellij.util.PathsList; //导入依赖的package包/类
private static void appendParamsEncodingClasspath(OwnSimpleJavaParameters javaParameters, GeneralCommandLine commandLine, ParametersList vmParameters)
{
	commandLine.addParameters(vmParameters.getList());

	appendEncoding(javaParameters, commandLine, vmParameters);

	PathsList classPath = javaParameters.getClassPath();
	if(!classPath.isEmpty() && !explicitClassPath(vmParameters))
	{
		commandLine.addParameter("-classpath");
		commandLine.addParameter(classPath.getPathsString());
	}

	PathsList modulePath = javaParameters.getModulePath();
	if(!modulePath.isEmpty() && !explicitModulePath(vmParameters))
	{
		commandLine.addParameter("-p");
		commandLine.addParameter(modulePath.getPathsString());
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:21,代码来源:OwnJdkUtil.java

示例11: configureJavaLibraryPath

import com.intellij.util.PathsList; //导入依赖的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

示例12: maybeGetProcessorPath

import com.intellij.util.PathsList; //导入依赖的package包/类
private String maybeGetProcessorPath()
{
  int jdkVersion = findJdkVersion();
  if( jdkVersion >= 9 )
  {
    PathsList pathsList = ProjectRootManager.getInstance( _ijProject ).orderEntries().withoutSdk().librariesOnly().getPathsList();
    for( VirtualFile path: pathsList.getVirtualFiles() )
    {
      String extension = path.getExtension();
      if( extension != null && extension.equals( "jar" ) && path.getNameWithoutExtension().contains( "manifold-" ) )
      {
        try
        {
          return " -processorpath " + new File( new URL( path.getUrl() ).getFile() ).getAbsolutePath() ;
        }
        catch( MalformedURLException e )
        {
          return "";
        }
      }
    }
  }
  return "";
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:25,代码来源:ManProject.java

示例13: updateJavaParameters

import com.intellij.util.PathsList; //导入依赖的package包/类
@Override
public void updateJavaParameters(RunConfigurationBase configuration, JavaParameters params,
                                 RunnerSettings runnerSettings) {
    PathsList classpath = params.getClassPath();
    final Optional<String> allureAdaptor = classpath.getPathList().stream()
            .filter(e -> e.matches(ALLURE_JAVA_ADAPTORS_REGEX)).findFirst();
    final Optional<String> aspectjDependency = classpath.getPathList().stream()
            .filter(e -> e.contains(ASPECTJ_DEPENCENCY)).findFirst();
    if (allureAdaptor.isPresent() && aspectjDependency.isPresent()) {
        //TODO:extract path to adspectj jar
        params.getVMParametersList().addParametersString(ASPECTJWEAVER_OPTION_STRING);
    }
}
 
开发者ID:allure-framework,项目名称:allure-idea,代码行数:14,代码来源:AllureRunConfigurationExtension.java

示例14: _appendSwingExplorerJarsToClassPath

import com.intellij.util.PathsList; //导入依赖的package包/类
/**
 * F�gt die JAR-Dateien zum Classpath des auszuf�hrenden Programms hinzu
 *
 * @param profileState Profil, bei dem es hinzugef�gt werden soll
 * @throws ExecutionException Wenn die JavaParameter nicht geladen werden konnten
 */
private void _appendSwingExplorerJarsToClassPath(ApplicationConfiguration.JavaApplicationCommandLineState profileState) throws ExecutionException
{
  PathsList classPath = profileState.getJavaParameters().getClassPath();

  classPath.add(swagJarFile);
  classPath.add(swexplJarFile);
}
 
开发者ID:wglanzer,项目名称:swingexplorer-idea,代码行数:14,代码来源:Runner.java

示例15: configureJavaLibraryPath

import com.intellij.util.PathsList; //导入依赖的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:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:JavaParameters.java


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