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


Java LibraryOrderEntry类代码示例

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


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

示例1: getDirectClassPaths

import com.intellij.openapi.roots.LibraryOrderEntry; //导入依赖的package包/类
private static List<String> getDirectClassPaths( Module ijModule )
{
  final ModuleRootManager rootManager = ModuleRootManager.getInstance( ijModule );
  final List<OrderEntry> orderEntries = Arrays.asList( rootManager.getOrderEntries() );

  List<String> paths = new ArrayList<>();
  for( OrderEntry entry : orderEntries.stream().filter( (LibraryOrderEntry.class)::isInstance ).collect( Collectors.toList() ) )
  {
    final Library lib = ((LibraryOrderEntry)entry).getLibrary();
    if( lib != null )
    {
      for( VirtualFile virtualFile : lib.getFiles( OrderRootType.CLASSES ) )
      {
        final File file = new File( stripExtraCharacters( virtualFile.getPath() ) );
        if( file.exists() )
        {
          paths.add( file.getAbsolutePath() );
        }
      }
    }
  }
  return paths;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:24,代码来源:ManProject.java

示例2: actionPerformed

import com.intellij.openapi.roots.LibraryOrderEntry; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent event) {
  final OrderEntry entry = myPanel.getSelectedEntry();
  if (!(entry instanceof LibraryOrderEntry)) return;
  LibraryOrderEntry libraryEntry = (LibraryOrderEntry)entry;
  final LibraryEx library = (LibraryEx)libraryEntry.getLibrary();
  if (library == null) return;

  final Library copied = doCopy(library);
  if (copied == null) return;

  if (!isConvertingToModuleLibrary()) {
    OrderEntryUtil.replaceLibrary(myPanel.getRootModel(), library, copied);
  }
  else {
    OrderEntryUtil.replaceLibraryEntryByAdded(myPanel.getRootModel(), libraryEntry);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ChangeLibraryLevelInClasspathAction.java

示例3: collectChildren

import com.intellij.openapi.roots.LibraryOrderEntry; //导入依赖的package包/类
protected void collectChildren(Object element, final List<Object> result) {
  if (element instanceof Application) {
    Collections.addAll(result, ProjectManager.getInstance().getOpenProjects());
    final LibraryTablesRegistrar instance = LibraryTablesRegistrar.getInstance();
    result.add(instance.getLibraryTable()); //1
    result.addAll(instance.getCustomLibraryTables()); //2
  }
  else if (element instanceof Project) {
    Collections.addAll(result, ModuleManager.getInstance((Project)element).getModules());
    result.add(LibraryTablesRegistrar.getInstance().getLibraryTable((Project)element));
  }
  else if (element instanceof LibraryTable) {
    Collections.addAll(result, ((LibraryTable)element).getLibraries());
  }
  else if (element instanceof Module) {
    for (OrderEntry entry : ModuleRootManager.getInstance((Module)element).getOrderEntries()) {
      if (entry instanceof LibraryOrderEntry) {
        final LibraryOrderEntry libraryOrderEntry = (LibraryOrderEntry)entry;
        if (LibraryTableImplUtil.MODULE_LEVEL.equals(libraryOrderEntry.getLibraryLevel())) {
          final Library library = libraryOrderEntry.getLibrary();
          result.add(library);
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ChooseLibrariesDialogBase.java

示例4: findLibrary

import com.intellij.openapi.roots.LibraryOrderEntry; //导入依赖的package包/类
@Nullable
public Library findLibrary(@NotNull PackagingElementResolvingContext context) {
  if (myModuleName == null) {
    return context.findLibrary(myLevel, myLibraryName);
  }
  final ModulesProvider modulesProvider = context.getModulesProvider();
  final Module module = modulesProvider.getModule(myModuleName);
  if (module != null) {
    for (OrderEntry entry : modulesProvider.getRootModel(module).getOrderEntries()) {
      if (entry instanceof LibraryOrderEntry) {
        final LibraryOrderEntry libraryEntry = (LibraryOrderEntry)entry;
        if (libraryEntry.isModuleLevel()) {
          final String libraryName = libraryEntry.getLibraryName();
          if (libraryName != null && libraryName.equals(myLibraryName)) {
            return libraryEntry.getLibrary();
          }
        }
      }
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:LibraryPackagingElement.java

示例5: removeLibrary

import com.intellij.openapi.roots.LibraryOrderEntry; //导入依赖的package包/类
@Override
public void removeLibrary(@NotNull Library library) {
  final Iterator<OrderEntry> orderIterator = myRootModel.getOrderIterator();
  while (orderIterator.hasNext()) {
    OrderEntry orderEntry = orderIterator.next();
    if (orderEntry instanceof LibraryOrderEntry) {
      final LibraryOrderEntry libraryOrderEntry = (LibraryOrderEntry) orderEntry;
      if (libraryOrderEntry.isModuleLevel()) {
        if (library.equals(libraryOrderEntry.getLibrary())) {
          myRootModel.removeOrderEntry(orderEntry);
          //Disposer.dispose(library);
          return;
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ModuleLibraryTable.java

示例6: importMissing

import com.intellij.openapi.roots.LibraryOrderEntry; //导入依赖的package包/类
private void importMissing(@NotNull IdeModifiableModelsProvider modelsProvider,
                           @NotNull Set<LibraryDependencyData> toImport,
                           @NotNull ModifiableRootModel moduleRootModel,
                           @NotNull LibraryTable moduleLibraryTable,
                           @NotNull Module module) {
  for (final LibraryDependencyData dependencyData : toImport) {
    final LibraryData libraryData = dependencyData.getTarget();
    final String libraryName = libraryData.getInternalName();
    switch (dependencyData.getLevel()) {
      case MODULE:
        final Library moduleLib = moduleLibraryTable.createLibrary(libraryName);
        syncExistingLibraryDependency(modelsProvider, dependencyData, moduleLib, moduleRootModel, module);
        break;
      case PROJECT:
        final Library projectLib = modelsProvider.getLibraryByName(libraryName);
        if (projectLib == null) {
          syncExistingLibraryDependency(modelsProvider, dependencyData, moduleLibraryTable.createLibrary(libraryName), moduleRootModel,
                                        module);
          break;
        }
        LibraryOrderEntry orderEntry = moduleRootModel.addLibraryEntry(projectLib);
        setLibraryScope(orderEntry, projectLib, module, dependencyData);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:LibraryDependencyDataService.java

示例7: isMavenAarDependency

import com.intellij.openapi.roots.LibraryOrderEntry; //导入依赖的package包/类
public static boolean isMavenAarDependency(@NotNull Module module, @NotNull OrderEntry entry) {
  if (ApplicationManager.getApplication().isUnitTestMode() && entry.getPresentableName().equals("maven_aar_dependency")) {
    return true;
  }
  if (!(entry instanceof LibraryOrderEntry) || !isMavenizedModule(module)) {
    return false;
  }
  final Library library = ((LibraryOrderEntry)entry).getLibrary();

  if (library == null) {
    return false;
  }
  final MavenProject mavenProject = MavenProjectsManager.getInstance(module.getProject()).findProject(module);

  if (mavenProject == null) {
    return false;
  }
  final MavenArtifact artifact = MavenRootModelAdapter.findArtifact(mavenProject, library);
  return artifact != null && AAR_DEPENDENCY_AND_PACKAGING_TYPE.equals(artifact.getType());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AndroidMavenUtil.java

示例8: removeUnusedProjectLibraries

import com.intellij.openapi.roots.LibraryOrderEntry; //导入依赖的package包/类
private boolean removeUnusedProjectLibraries() {
  Set<Library> unusedLibraries = new HashSet<Library>();
  Collections.addAll(unusedLibraries, myModelsProvider.getAllLibraries());

  for (ModuleRootModel eachModel : collectModuleModels()) {
    for (OrderEntry eachEntry : eachModel.getOrderEntries()) {
      if (eachEntry instanceof LibraryOrderEntry) {
        unusedLibraries.remove(((LibraryOrderEntry)eachEntry).getLibrary());
      }
    }
  }

  boolean removed = false;
  for (Library each : unusedLibraries) {
    if (!isDisposed(each) && MavenRootModelAdapter.isMavenLibrary(each) && !MavenRootModelAdapter.isChangedByUser(each)) {
      myModelsProvider.removeLibrary(each);
      removed = true;
    }
  }
  return removed;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:MavenProjectImporter.java

示例9: perform

import com.intellij.openapi.roots.LibraryOrderEntry; //导入依赖的package包/类
@Override
public ActionCallback perform(List<LibraryOrderEntry> orderEntriesContainingFile) {
  ApplicationManager.getApplication().assertIsDispatchThread();

  ActionCallback callback = new ActionCallback();
  callback.setDone();

  if (!mySrcFile.isValid()) return callback;

  if (myLibrary != getLibraryFromOrderEntriesList(orderEntriesContainingFile)) return callback;

  AccessToken accessToken = WriteAction.start();
  try {
    addSourceFile(mySrcFile, myLibrary);
  }
  finally {
    accessToken.finish();
  }

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

示例10: assertScalaLibrary

import com.intellij.openapi.roots.LibraryOrderEntry; //导入依赖的package包/类
protected void assertScalaLibrary(String moduleName) throws Exception {
  // This is to match scala-platform used in pants repo across different releases,
  // so we expect at least one of the versions should be found here.
  ArrayList<String> expectedLibs =
    Lists.newArrayList(
      "Pants: org.scala-lang:scala-library:2.10.4",
      "Pants: org.scala-lang:scala-library:2.10.6",
      "Pants: org.scala-lang:scala-library:2.11.8",
      "Pants: org.scala-lang:scala-library:2.11.11"
    );
  for (String libName : expectedLibs) {
    LibraryOrderEntry libX = ContainerUtil.getFirstItem(this.getModuleLibDeps(moduleName, libName));
    if (libX != null) {
      assertModuleLibDep(moduleName, libName);
      return;
    }
  }
  fail(String.format("None of %s is found for module %s.", expectedLibs, moduleName));
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:20,代码来源:PantsIntegrationTestCase.java

示例11: removeUnusedProjectLibraries

import com.intellij.openapi.roots.LibraryOrderEntry; //导入依赖的package包/类
private boolean removeUnusedProjectLibraries() {
  Set<Library> allLibraries = new THashSet<Library>();
  Collections.addAll(allLibraries, myModelsProvider.getAllLibraries());

  Set<Library> usedLibraries = new THashSet<Library>();
  for (ModuleRootModel eachModel : collectModuleModels()) {
    for (OrderEntry eachEntry : eachModel.getOrderEntries()) {
      if (eachEntry instanceof LibraryOrderEntry) {
        Library lib = ((LibraryOrderEntry)eachEntry).getLibrary();
        if (MavenRootModelAdapter.isMavenLibrary(lib)) usedLibraries.add(lib);
      }
    }
  }

  Set<Library> unusedLibraries = new THashSet<Library>(allLibraries);
  unusedLibraries.removeAll(usedLibraries);

  boolean removed = false;
  for (Library each : unusedLibraries) {
    if (!isDisposed(each) && MavenRootModelAdapter.isMavenLibrary(each) && !MavenRootModelAdapter.isChangedByUser(each)) {
      myModelsProvider.removeLibrary(each);
      removed = true;
    }
  }
  return removed;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:MavenProjectImporter.java

示例12: removeLibrary

import com.intellij.openapi.roots.LibraryOrderEntry; //导入依赖的package包/类
@Override
public void removeLibrary(@Nonnull Library library) {
  final Iterator<OrderEntry> orderIterator = myRootLayer.getOrderIterator();
  while (orderIterator.hasNext()) {
    OrderEntry orderEntry = orderIterator.next();
    if (orderEntry instanceof LibraryOrderEntry) {
      final LibraryOrderEntry libraryOrderEntry = (LibraryOrderEntry) orderEntry;
      if (libraryOrderEntry.isModuleLevel()) {
        if (library.equals(libraryOrderEntry.getLibrary())) {
          myRootLayer.removeOrderEntry(orderEntry);
          //Disposer.dispose(library);
          return;
        }
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:ModuleLibraryTable.java

示例13: findLibrary

import com.intellij.openapi.roots.LibraryOrderEntry; //导入依赖的package包/类
@Nullable
public Library findLibrary(@Nonnull PackagingElementResolvingContext context) {
  if (myModuleName == null) {
    return context.findLibrary(myLevel, myLibraryName);
  }
  final ModulesProvider modulesProvider = context.getModulesProvider();
  final Module module = modulesProvider.getModule(myModuleName);
  if (module != null) {
    for (OrderEntry entry : modulesProvider.getRootModel(module).getOrderEntries()) {
      if (entry instanceof LibraryOrderEntry) {
        final LibraryOrderEntry libraryEntry = (LibraryOrderEntry)entry;
        if (libraryEntry.isModuleLevel()) {
          final String libraryName = libraryEntry.getLibraryName();
          if (libraryName != null && libraryName.equals(myLibraryName)) {
            return libraryEntry.getLibrary();
          }
        }
      }
    }
  }
  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:LibraryPackagingElement.java

示例14: addLibraryOrderEntry

import com.intellij.openapi.roots.LibraryOrderEntry; //导入依赖的package包/类
public void addLibraryOrderEntry(final Module module, final Library library) {
  Component parent = WindowManager.getInstance().suggestParentWindow(module.getProject());

  final ModuleEditor moduleEditor = myContext.myModulesConfigurator.getModuleEditor(module);
  LOG.assertTrue(moduleEditor != null, "Current module editor was not initialized");
  final ModifiableRootModel modelProxy = moduleEditor.getModifiableRootModelProxy();
  final OrderEntry[] entries = modelProxy.getOrderEntries();
  for (OrderEntry entry : entries) {
    if (entry instanceof LibraryOrderEntry && Comparing.strEqual(entry.getPresentableName(), library.getName())) {
      if (Messages.showYesNoDialog(parent,
                                   ProjectBundle.message("project.roots.replace.library.entry.message", entry.getPresentableName()),
                                   ProjectBundle.message("project.roots.replace.library.entry.title"),
                                   Messages.getInformationIcon()) == Messages.YES) {
        modelProxy.removeOrderEntry(entry);
        break;
      }
    }
  }
  modelProxy.addLibraryEntry(library);
  myContext.getDaemonAnalyzer().queueUpdate(new ModuleProjectStructureElement(myContext, module));
  myTree.repaint();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:ModuleStructureConfigurable.java

示例15: findLibraryEntriesForFile

import com.intellij.openapi.roots.LibraryOrderEntry; //导入依赖的package包/类
@Nullable
private List<LibraryOrderEntry> findLibraryEntriesForFile(VirtualFile file)
{
	List<LibraryOrderEntry> entries = null;

	ProjectFileIndex index = ProjectFileIndex.SERVICE.getInstance(myProject);
	for(OrderEntry entry : index.getOrderEntriesForFile(file))
	{
		if(entry instanceof LibraryOrderEntry)
		{
			if(entries == null)
			{
				entries = ContainerUtil.newSmartList();
			}
			entries.add((LibraryOrderEntry) entry);
		}
	}

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


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