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


Java ExternalLibraryDescriptor类代码示例

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


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

示例1: selectVersion

import com.intellij.openapi.roots.ExternalLibraryDescriptor; //导入依赖的package包/类
@Nullable
private String selectVersion(@NotNull ExternalLibraryDescriptor descriptor) {
  Set<String> versions = myIndicesManager.getVersions(descriptor.getLibraryGroupId(), descriptor.getLibraryArtifactId());
  List<String> suitableVersions = new ArrayList<String>();
  String minVersion = descriptor.getMinVersion();
  String maxVersion = descriptor.getMaxVersion();
  for (String version : versions) {
    if ((minVersion == null || VersionComparatorUtil.compare(minVersion, version) <= 0)
        && (maxVersion == null || VersionComparatorUtil.compare(version, maxVersion) < 0)) {
      suitableVersions.add(version);
    }
  }
  if (suitableVersions.isEmpty()) {
    return null;
  }
  return Collections.max(suitableVersions, VersionComparatorUtil.COMPARATOR);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:MavenProjectModelModifier.java

示例2: configureModule

import com.intellij.openapi.roots.ExternalLibraryDescriptor; //导入依赖的package包/类
@Override
public void configureModule(@NotNull Module module) {
  ExternalLibraryDescriptor descriptor = JUnitExternalLibraryDescriptor.JUNIT4;
  List<String> defaultRoots = descriptor.getLibraryClassesRoots();
  final List<String> urls = OrderEntryFix.refreshAndConvertToUrls(defaultRoots);
  ModuleRootModificationUtil.addModuleLibrary(module, descriptor.getPresentableName(), urls, Collections.emptyList());
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:8,代码来源:EduPluginConfiguratorBase.java

示例3: resolvePackage

import com.intellij.openapi.roots.ExternalLibraryDescriptor; //导入依赖的package包/类
@Nullable
@Override
public ExternalLibraryDescriptor resolvePackage(@NotNull String packageName) {
  if (packageName.equals("net.jcip.annotations")) {
    return JDCIP_LIBRARY_DESCRIPTOR;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:JCiPExternalLibraryResolver.java

示例4: AddExternalLibraryToDependenciesQuickFix

import com.intellij.openapi.roots.ExternalLibraryDescriptor; //导入依赖的package包/类
public AddExternalLibraryToDependenciesQuickFix(@NotNull Module currentModule,
                                                @NotNull ExternalLibraryDescriptor libraryDescriptor, @NotNull PsiReference reference,
                                                @Nullable String qualifiedClassName) {
  myCurrentModule = currentModule;
  myReference = reference;
  myLibraryDescriptor = libraryDescriptor;
  myQualifiedClassName = qualifiedClassName;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:AddExternalLibraryToDependenciesQuickFix.java

示例5: resolveClass

import com.intellij.openapi.roots.ExternalLibraryDescriptor; //导入依赖的package包/类
@Nullable
@Override
public ExternalClassResolveResult resolveClass(@NotNull String shortClassName, @NotNull ThreeState isAnnotation, @NotNull Module contextModule) {
  if (AnnotationUtil.isJetbrainsAnnotation(shortClassName)) {
    ExternalLibraryDescriptor libraryDescriptor = getAnnotationsLibraryDescriptor(contextModule);
    return new ExternalClassResolveResult("org.jetbrains.annotations." + shortClassName, libraryDescriptor);
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JetBrainsAnnotationsExternalLibraryResolver.java

示例6: addDependency

import com.intellij.openapi.roots.ExternalLibraryDescriptor; //导入依赖的package包/类
@Override
public Promise<Void> addDependency(@NotNull Collection<Module> from, @NotNull ExternalLibraryDescriptor libraryDescriptor, @NotNull DependencyScope scope) {
  for (JavaProjectModelModifier modifier : getModelModifiers()) {
    Promise<Void> promise = modifier.addExternalLibraryDependency(from, libraryDescriptor, scope);
    if (promise != null) {
      return promise;
    }
  }
  return Promise.REJECTED;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:JavaProjectModelModificationServiceImpl.java

示例7: getLibraryPath

import com.intellij.openapi.roots.ExternalLibraryDescriptor; //导入依赖的package包/类
@Nullable
@Override
public String getLibraryPath() {
  ExternalLibraryDescriptor descriptor = getFrameworkLibraryDescriptor();
  if (descriptor != null) {
    return descriptor.getLibraryClassesRoots().get(0);
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JavaTestFramework.java

示例8: setupLibrary

import com.intellij.openapi.roots.ExternalLibraryDescriptor; //导入依赖的package包/类
public void setupLibrary(Module module) {
  ExternalLibraryDescriptor descriptor = getFrameworkLibraryDescriptor();
  if (descriptor != null) {
    JavaProjectModelModificationService.getInstance(module.getProject()).addDependency(module, descriptor, DependencyScope.TEST);
  }
  else {
    String path = getLibraryPath();
    if (path != null) {
      OrderEntryFix.addJarsToRoots(Collections.singletonList(path), null, module, null);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:JavaTestFramework.java

示例9: resolvePackage

import com.intellij.openapi.roots.ExternalLibraryDescriptor; //导入依赖的package包/类
@Nullable
@Override
public ExternalLibraryDescriptor resolvePackage(@NotNull String packageName) {
  if (packageName.equals("org.junit")) {
    return JUnitExternalLibraryDescriptor.JUNIT4;
  }
  if (packageName.equals("junit.framework")) {
    return JUnitExternalLibraryDescriptor.JUNIT3;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:JUnitExternalLibraryResolver.java

示例10: addExternalLibraryDependency

import com.intellij.openapi.roots.ExternalLibraryDescriptor; //导入依赖的package包/类
@Nullable
@Override
public Promise<Void> addExternalLibraryDependency(@NotNull Collection<Module> modules,
                                                  @NotNull ExternalLibraryDescriptor descriptor,
                                                  @NotNull DependencyScope scope) {
  for (Module module : modules) {
    if (!myProjectsManager.isMavenizedModule(module)) {
      return null;
    }
  }

  String version = selectVersion(descriptor);
  MavenId mavenId = new MavenId(descriptor.getLibraryGroupId(), descriptor.getLibraryArtifactId(), version);
  return addDependency(modules, mavenId, scope);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:MavenProjectModelModifier.java

示例11: getLibraryPath

import com.intellij.openapi.roots.ExternalLibraryDescriptor; //导入依赖的package包/类
@Nullable
@Override
public String getLibraryPath()
{
	ExternalLibraryDescriptor descriptor = getFrameworkLibraryDescriptor();
	if(descriptor != null)
	{
		return descriptor.getLibraryClassesRoots().get(0);
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:12,代码来源:JavaTestFramework.java

示例12: AddExternalLibraryToDependenciesQuickFix

import com.intellij.openapi.roots.ExternalLibraryDescriptor; //导入依赖的package包/类
public AddExternalLibraryToDependenciesQuickFix(@NotNull Module currentModule,
		@NotNull ExternalLibraryDescriptor libraryDescriptor,
		@NotNull PsiReference reference,
		@Nullable String qualifiedClassName)
{
	super(reference);
	myCurrentModule = currentModule;
	myLibraryDescriptor = libraryDescriptor;
	myQualifiedClassName = qualifiedClassName;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:11,代码来源:AddExternalLibraryToDependenciesQuickFix.java

示例13: addDependency

import com.intellij.openapi.roots.ExternalLibraryDescriptor; //导入依赖的package包/类
@Override
public AsyncResult<Void> addDependency(@NotNull Collection<Module> from, @NotNull ExternalLibraryDescriptor libraryDescriptor, @NotNull DependencyScope scope)
{
	for(JavaProjectModelModifier modifier : getModelModifiers())
	{
		AsyncResult<Void> asyncResult = modifier.addExternalLibraryDependency(from, libraryDescriptor, scope);
		if(asyncResult != null)
		{
			return asyncResult;
		}
	}
	return AsyncResult.rejected();
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:14,代码来源:JavaProjectModelModificationServiceImpl.java

示例14: addExternalLibraryDependency

import com.intellij.openapi.roots.ExternalLibraryDescriptor; //导入依赖的package包/类
@Override
public AsyncResult<Void> addExternalLibraryDependency(@NotNull final Collection<Module> modules, @NotNull final ExternalLibraryDescriptor descriptor, @NotNull final DependencyScope scope)
{
	List<String> defaultRoots = descriptor.getLibraryClassesRoots();
	Module firstModule = ContainerUtil.getFirstItem(modules);
	LOG.assertTrue(firstModule != null);
	LocateLibraryDialog dialog = new LocateLibraryDialog(firstModule, defaultRoots, descriptor.getPresentableName());
	List<String> classesRoots = dialog.showAndGetResult();
	if(!classesRoots.isEmpty())
	{
		String libraryName = classesRoots.size() > 1 ? descriptor.getPresentableName() : null;
		final List<String> urls = OrderEntryFix.refreshAndConvertToUrls(classesRoots);
		if(modules.size() == 1)
		{
			ModuleRootModificationUtil.addModuleLibrary(firstModule, libraryName, urls, Collections.emptyList(), scope);
		}
		else
		{
			new WriteAction()
			{
				protected void run(@NotNull Result result)
				{
					Library library = LibraryUtil.createLibrary(LibraryTablesRegistrar.getInstance().getLibraryTable(myProject), descriptor.getPresentableName());
					Library.ModifiableModel model = library.getModifiableModel();
					for(String url : urls)
					{
						model.addRoot(url, OrderRootType.CLASSES);
					}
					model.commit();
					for(Module module : modules)
					{
						ModuleRootModificationUtil.addDependency(module, library, scope, false);
					}
				}
			}.execute();
		}
	}
	return AsyncResult.done(null);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:40,代码来源:IdeaProjectModelModifier.java

示例15: getAnnotationsLibraryDescriptor

import com.intellij.openapi.roots.ExternalLibraryDescriptor; //导入依赖的package包/类
@NotNull
public static ExternalLibraryDescriptor getAnnotationsLibraryDescriptor(@NotNull Module contextModule) {
  boolean java8 = EffectiveLanguageLevelUtil.getEffectiveLanguageLevel(contextModule).isAtLeast(LanguageLevel.JDK_1_8);
  return java8 ? JAVA8 : JAVA5;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:JetBrainsAnnotationsExternalLibraryResolver.java


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