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


Java LibraryOrderEntry.getLibrary方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: select

import com.intellij.openapi.roots.LibraryOrderEntry; //导入方法依赖的package包/类
public ActionCallback select(@NotNull LibraryOrderEntry libraryOrderEntry, final boolean requestFocus) {
  final Library lib = libraryOrderEntry.getLibrary();
  if (lib == null || lib.getTable() == null) {
    return selectOrderEntry(libraryOrderEntry.getOwnerModule(), libraryOrderEntry);
  }
  Place place = createPlaceFor(getConfigurableFor(lib));
  place.putPath(BaseStructureConfigurable.TREE_NAME, libraryOrderEntry.getLibraryName());
  return navigateTo(place, requestFocus);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ProjectStructureConfigurable.java

示例6: isEnabled

import com.intellij.openapi.roots.LibraryOrderEntry; //导入方法依赖的package包/类
@Override
protected boolean isEnabled() {
  final OrderEntry entry = myPanel.getSelectedEntry();
  boolean enabled = false;
  if (entry instanceof LibraryOrderEntry) {
    final LibraryOrderEntry libraryOrderEntry = (LibraryOrderEntry)entry;
    if (libraryOrderEntry.getLibrary() != null) {
      boolean isFromModuleLibrary = libraryOrderEntry.isModuleLevel();
      boolean isToModuleLibrary = isConvertingToModuleLibrary();
      enabled = isFromModuleLibrary != isToModuleLibrary;
    }
  }
  return enabled;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:ChangeLibraryLevelInClasspathAction.java

示例7: isOrphanProjectLibrary

import com.intellij.openapi.roots.LibraryOrderEntry; //导入方法依赖的package包/类
private static boolean isOrphanProjectLibrary(@NotNull final Library library,
                                              @NotNull final IdeModifiableModelsProvider modelsProvider) {
  RootPolicy<Boolean> visitor = new RootPolicy<Boolean>() {
    @Override
    public Boolean visitLibraryOrderEntry(LibraryOrderEntry ideDependency, Boolean value) {
      return !ideDependency.isModuleLevel() && library == ideDependency.getLibrary();
    }
  };
  for (Module module : modelsProvider.getModules()) {
    for (OrderEntry entry : modelsProvider.getOrderEntries(module)) {
      if (entry.accept(visitor, false)) return false;
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:LibraryDataService.java

示例8: getLibrarySettingsConfigurable

import com.intellij.openapi.roots.LibraryOrderEntry; //导入方法依赖的package包/类
@Nullable
private static Configurable getLibrarySettingsConfigurable(OrderEntry orderEntry) {
  if (!(orderEntry instanceof LibraryOrderEntry)) return null;
  LibraryOrderEntry libOrderEntry = (LibraryOrderEntry)orderEntry;
  Library lib = libOrderEntry.getLibrary();
  if (lib instanceof LibraryEx) {
    Project project = libOrderEntry.getOwnerModule().getProject();
    PersistentLibraryKind<?> libKind = ((LibraryEx)lib).getKind();
    if (libKind != null) {
      return LibrarySettingsProvider.getAdditionalSettingsConfigurable(project, libKind);
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:ProjectSettingsService.java

示例9: getScope

import com.intellij.openapi.roots.LibraryOrderEntry; //导入方法依赖的package包/类
private DependencyScope getScope(String name) {
  LibraryOrderEntry entry = OrderEntryUtil.findLibraryOrderEntry(ModuleRootManager.getInstance(myModule), name);
  assertNotNull(entry);
  Library library = entry.getLibrary();
  assertNotNull(library);
  return new JUnitDependencyScopeSuggester().getDefaultDependencyScope(library);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:JUnitDependencyScopeSuggesterTest.java

示例10: select

import com.intellij.openapi.roots.LibraryOrderEntry; //导入方法依赖的package包/类
public ActionCallback select(@Nonnull LibraryOrderEntry libraryOrderEntry, final boolean requestFocus) {
  final Library lib = libraryOrderEntry.getLibrary();
  if (lib == null || lib.getTable() == null) {
    return selectOrderEntry(libraryOrderEntry.getOwnerModule(), libraryOrderEntry);
  }
  Place place = createPlaceFor(getConfigurableFor(lib));
  place.putPath(BaseStructureConfigurable.TREE_NAME, libraryOrderEntry.getLibraryName());
  return navigateTo(place, requestFocus);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:ProjectStructureConfigurable.java

示例11: scanForCamelProject

import com.intellij.openapi.roots.LibraryOrderEntry; //导入方法依赖的package包/类
/**
 * Scan for Camel project present and setup {@link CamelCatalog} to use same version of Camel as the project does.
 * These two version needs to be aligned to offer the best tooling support on the given project.
 */
public void scanForCamelProject(@NotNull Project project, @NotNull Module module) {
    for (OrderEntry entry : ModuleRootManager.getInstance(module).getOrderEntries()) {
        if (!(entry instanceof LibraryOrderEntry)) {
            continue;
        }
        LibraryOrderEntry libraryOrderEntry = (LibraryOrderEntry) entry;

        String name = libraryOrderEntry.getPresentableName().toLowerCase();
        if (!libraryOrderEntry.getScope().isForProductionCompile() && !libraryOrderEntry.getScope().isForProductionRuntime()) {
            continue;
        }
        final Library library = libraryOrderEntry.getLibrary();
        if (library == null) {
            continue;
        }
        String[] split = name.split(":");
        if (split.length < 3) {
            continue;
        }
        int startIdx = 0;
        if (split[0].equalsIgnoreCase("maven")
                || split[0].equalsIgnoreCase("gradle")
                || split[0].equalsIgnoreCase("sbt")) {
            startIdx = 1;
        }
        boolean hasVersion = split.length > (startIdx + 2);

        String groupId = split[startIdx++].trim();
        String artifactId = split[startIdx++].trim();
        String version = null;
        if (hasVersion) {
            version = split[startIdx].trim();
            // adjust snapshot which must be in uppercase
            version = version.replace("snapshot", "SNAPSHOT");
        }

        if (isSlf4jMavenDependency(groupId, artifactId)) {
            slf4japiLibrary = library;
        } else if (isCamelMavenDependency(groupId, artifactId)) {
            camelCoreLibrary = library;

            // okay its a camel project
            setCamelPresent(true);

            String currentVersion = getCamelCatalogService(project).get().getLoadedVersion();
            if (currentVersion == null) {
                // okay no special version was loaded so its the catalog version we are using
                currentVersion = getCamelCatalogService(project).get().getCatalogVersion();
            }
            if (isThereDifferentVersionToBeLoaded(version, currentVersion)) {
                boolean notifyNewCamelCatalogVersionLoaded = false;

                boolean downloadAllowed = getCamelPreferenceService().isDownloadCatalog();
                if (downloadAllowed) {
                    notifyNewCamelCatalogVersionLoaded = downloadNewCamelCatalogVersion(project, module, version, notifyNewCamelCatalogVersionLoaded);
                }

                if (notifyNewCamelCatalogVersionLoaded(notifyNewCamelCatalogVersionLoaded)) {
                    expireOldCamelCatalogVersion();
                }
            }

            // only notify this once on startup (or if a new version was successfully loaded)
            if (camelVersionNotification == null) {
                currentVersion = getCamelCatalogService(project).get().getLoadedVersion();
                if (currentVersion == null) {
                    // okay no special version was loaded so its the catalog version we are using
                    currentVersion = getCamelCatalogService(project).get().getCatalogVersion();
                }
                showCamelCatalogVersionAtPluginStart(project, currentVersion);
            }
        }
    }
}
 
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:79,代码来源:CamelService.java

示例12: scanForCamelDependencies

import com.intellij.openapi.roots.LibraryOrderEntry; //导入方法依赖的package包/类
/**
 * Scan for Camel component (both from Apache Camel and 3rd party components)
 */
public void scanForCamelDependencies(@NotNull Project project, @NotNull Module module) {
    boolean thirdParty = getCamelPreferenceService().isScanThirdPartyComponents();

    CamelCatalog camelCatalog = getCamelCatalogService(project).get();

    List<String> missingJSonSchemas = new ArrayList<>();

    for (OrderEntry entry : ModuleRootManager.getInstance(module).getOrderEntries()) {
        if (entry instanceof LibraryOrderEntry) {
            LibraryOrderEntry libraryOrderEntry = (LibraryOrderEntry) entry;

            String name = libraryOrderEntry.getPresentableName().toLowerCase();
            if (libraryOrderEntry.getScope().isForProductionCompile() || libraryOrderEntry.getScope().isForProductionRuntime()) {
                final Library library = libraryOrderEntry.getLibrary();
                if (library == null) {
                    continue;
                }
                String[] split = name.split(":");
                if (split.length < 3) {
                    continue;
                }
                int startIdx = 0;
                if (split[0].equalsIgnoreCase("maven")
                        || split[0].equalsIgnoreCase("gradle")
                        || split[0].equalsIgnoreCase("sbt")) {
                    startIdx = 1;
                }
                String groupId = split[startIdx++].trim();
                String artifactId = split[startIdx].trim();

                // is it a known library then continue
                if (containsLibrary(artifactId)) {
                    continue;
                }

                if ("org.apache.camel".equals(groupId)) {
                    addLibrary(artifactId);
                } else if (thirdParty) {
                    addCustomCamelComponentsFromDependency(camelCatalog, library, artifactId, missingJSonSchemas);
                }
            }
        }
    }

    if (!missingJSonSchemas.isEmpty()) {
        String components = missingJSonSchemas.stream().collect(Collectors.joining(","));
        String message = "The following Camel components with artifactId [" + components
                + "] does not include component JSon schema metadata which is required for the Camel IDEA plugin to support these components."
                + "\nSee more details at: " + MISSING_JSON_SCHEMA_LINK;

        Icon icon = getCamelPreferenceService().getCamelIcon();
        camelMissingJSonSchemaNotification = CAMEL_NOTIFICATION_GROUP.createNotification(message, NotificationType.WARNING).setImportant(true).setIcon(icon);
        camelMissingJSonSchemaNotification.notify(project);
    }
}
 
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:59,代码来源:CamelService.java

示例13: createLibrary

import com.intellij.openapi.roots.LibraryOrderEntry; //导入方法依赖的package包/类
@Override
public Library createLibrary(String name, @Nullable PersistentLibraryKind kind) {
  LibraryOrderEntry orderEntry = new ModuleLibraryOrderEntryImpl(name, kind, myRootModel, myProjectRootManager);
  myRootModel.addOrderEntry(orderEntry);
  return orderEntry.getLibrary();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:ModuleLibraryTable.java

示例14: convert

import com.intellij.openapi.roots.LibraryOrderEntry; //导入方法依赖的package包/类
@Override
public Library convert(LibraryOrderEntry o) {
  return o.getLibrary();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:ModuleLibraryTable.java

示例15: getActions

import com.intellij.openapi.roots.LibraryOrderEntry; //导入方法依赖的package包/类
@NotNull
@Override
public Collection<AttachSourcesAction> getActions(
    List<LibraryOrderEntry> orderEntries, final PsiFile psiFile) {
  Project project = psiFile.getProject();
  BlazeProjectData blazeProjectData =
      BlazeProjectDataManager.getInstance(project).getBlazeProjectData();
  if (blazeProjectData == null) {
    return ImmutableList.of();
  }

  List<Library> librariesToAttachSourceTo = Lists.newArrayList();
  for (LibraryOrderEntry orderEntry : orderEntries) {
    Library library = orderEntry.getLibrary();
    WorkspacePath workspacePath =
        AddLibraryTargetDirectoryToProjectViewAction.getDirectoryToAddForLibrary(
            project, library);
    if (workspacePath == null) {
      continue;
    }
    librariesToAttachSourceTo.add(library);
  }

  if (librariesToAttachSourceTo.isEmpty()) {
    return ImmutableList.of();
  }

  return ImmutableList.of(
      new AttachSourcesAction() {
        @Override
        public String getName() {
          return "Add Source Directories To Project View";
        }

        @Override
        public String getBusyText() {
          return "Adding directories...";
        }

        @Override
        public ActionCallback perform(List<LibraryOrderEntry> orderEntriesContainingFile) {
          AddLibraryTargetDirectoryToProjectViewAction.addDirectoriesToProjectView(
              project, librariesToAttachSourceTo);
          return ActionCallback.DONE;
        }
      });
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:48,代码来源:AddLibraryTargetDirectoryToProjectViewAttachSourcesProvider.java


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