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


Java LibraryUtil.findLibraryEntry方法代码示例

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


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

示例1: navigate

import com.intellij.openapi.roots.libraries.LibraryUtil; //导入方法依赖的package包/类
@Override
public void navigate(final boolean requestFocus) {
  Module module = ModuleUtil.findModuleForPsiElement(getValue());
  if (module != null) {
    final VirtualFile file = getVirtualFile();
    final Project project = getProject();
    ProjectSettingsService service = ProjectSettingsService.getInstance(myProject);
    if (ProjectRootsUtil.isModuleContentRoot(file, project)) {
      service.openModuleSettings(module);
    }
    else if (ProjectRootsUtil.isLibraryRoot(file, project)) {
      final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(file, module.getProject());
      if (orderEntry != null) {
        service.openLibraryOrSdkSettings(orderEntry);
      }
    }
    else {
      service.openContentEntriesSettings(module);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:PsiDirectoryNode.java

示例2: displayUrlRelativeToProject

import com.intellij.openapi.roots.libraries.LibraryUtil; //导入方法依赖的package包/类
public static String displayUrlRelativeToProject(@NotNull VirtualFile file,
                                                 @NotNull String url,
                                                 @NotNull Project project,
                                                 boolean includeFilePath,
                                                 boolean keepModuleAlwaysOnTheLeft) {
  final VirtualFile baseDir = project.getBaseDir();
  if (baseDir != null && includeFilePath) {
    //noinspection ConstantConditions
    final String projectHomeUrl = baseDir.getPresentableUrl();
    if (url.startsWith(projectHomeUrl)) {
      url = "..." + url.substring(projectHomeUrl.length());
    }
  }

  if (SystemInfo.isMac && file.getFileSystem() instanceof LocalFileProvider) {
    final VirtualFile fileForJar = ((LocalFileProvider)file.getFileSystem()).getLocalVirtualFileFor(file);
    if (fileForJar != null) {
      final OrderEntry libraryEntry = LibraryUtil.findLibraryEntry(file, project);
      if (libraryEntry != null) {
        if (libraryEntry instanceof JdkOrderEntry) {
          url = url + " - [" + ((JdkOrderEntry)libraryEntry).getJdkName() + "]";
        }
        else {
          url = url + " - [" + libraryEntry.getPresentableName() + "]";
        }
      }
      else {
        url = url + " - [" + fileForJar.getName() + "]";
      }
    }
  }

  final Module module = ModuleUtilCore.findModuleForFile(file, project);
  if (module == null) return url;
  return !keepModuleAlwaysOnTheLeft && SystemInfo.isMac ?
         url + " - [" + module.getName() + "]" :
         "[" + module.getName() + "] - " + url;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:ProjectUtilCore.java

示例3: isNavigatableLibraryRoot

import com.intellij.openapi.roots.libraries.LibraryUtil; //导入方法依赖的package包/类
private boolean isNavigatableLibraryRoot() {
  VirtualFile jarRoot = getJarRoot();
  final Project project = getProject();
  if (jarRoot != null && ProjectRootsUtil.isLibraryRoot(jarRoot, project)) {
    final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(jarRoot, project);
    return orderEntry != null && ProjectSettingsService.getInstance(project).canOpenLibraryOrSdkSettings(orderEntry);
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PsiFileNode.java

示例4: navigate

import com.intellij.openapi.roots.libraries.LibraryUtil; //导入方法依赖的package包/类
@Override
public void navigate(boolean requestFocus) {
  final VirtualFile jarRoot = getJarRoot();
  final Project project = getProject();
  if (requestFocus && jarRoot != null && ProjectRootsUtil.isLibraryRoot(jarRoot, project)) {
    final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(jarRoot, project);
    if (orderEntry != null) {
      ProjectSettingsService.getInstance(project).openLibraryOrSdkSettings(orderEntry);
      return;
    }
  }

  super.navigate(requestFocus);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:PsiFileNode.java

示例5: findLibrary

import com.intellij.openapi.roots.libraries.LibraryUtil; //导入方法依赖的package包/类
@Nullable
private Library findLibrary(Project project, PsiJavaFile clsFile) {
  OrderEntry libraryEntry = LibraryUtil.findLibraryEntry(clsFile.getVirtualFile(), project);
  if (!(libraryEntry instanceof LibraryOrderEntry)) {
    return null;
  }
  return ((LibraryOrderEntry) libraryEntry).getLibrary();
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:9,代码来源:BlazeSourceJarNavigationPolicy.java

示例6: displayUrlRelativeToProject

import com.intellij.openapi.roots.libraries.LibraryUtil; //导入方法依赖的package包/类
public static String displayUrlRelativeToProject(@Nonnull VirtualFile file,
                                                 @Nonnull String url,
                                                 @Nonnull Project project,
                                                 boolean includeFilePath,
                                                 boolean keepModuleAlwaysOnTheLeft) {
  final VirtualFile baseDir = project.getBaseDir();
  if (baseDir != null && includeFilePath) {
    //noinspection ConstantConditions
    final String projectHomeUrl = baseDir.getPresentableUrl();
    if (url.startsWith(projectHomeUrl)) {
      url = "..." + url.substring(projectHomeUrl.length());
    }
  }

  if (SystemInfo.isMac && file.getFileSystem() instanceof LocalFileProvider) {
    final VirtualFile fileForJar = ((LocalFileProvider)file.getFileSystem()).getLocalVirtualFileFor(file);
    if (fileForJar != null) {
      final OrderEntry libraryEntry = LibraryUtil.findLibraryEntry(file, project);
      if (libraryEntry != null) {
        if (libraryEntry instanceof ModuleExtensionWithSdkOrderEntry) {
          url = url + " - [" + ((ModuleExtensionWithSdkOrderEntry)libraryEntry).getSdkName() + "]";
        }
        else {
          url = url + " - [" + libraryEntry.getPresentableName() + "]";
        }
      }
      else {
        url = url + " - [" + fileForJar.getName() + "]";
      }
    }
  }

  final Module module = ModuleUtilCore.findModuleForFile(file, project);
  if (module == null) return url;
  return !keepModuleAlwaysOnTheLeft && SystemInfo.isMac ?
         url + " - [" + module.getName() + "]" :
         "[" + module.getName() + "] - " + url;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:39,代码来源:ProjectUtilCore.java

示例7: isNavigatableLibraryRoot

import com.intellij.openapi.roots.libraries.LibraryUtil; //导入方法依赖的package包/类
private boolean isNavigatableLibraryRoot() {
  VirtualFile jarRoot = getArchiveRoot();
  final Project project = getProject();
  if (jarRoot != null && ProjectRootsUtil.isLibraryRoot(jarRoot, project)) {
    final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(jarRoot, project);
    return orderEntry != null ;
  }
  return false;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:PsiFileNode.java

示例8: navigate

import com.intellij.openapi.roots.libraries.LibraryUtil; //导入方法依赖的package包/类
@Override
public void navigate(boolean requestFocus) {
  final VirtualFile jarRoot = getArchiveRoot();
  final Project project = getProject();
  if (requestFocus && jarRoot != null && ProjectRootsUtil.isLibraryRoot(jarRoot, project)) {
    final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(jarRoot, project);
    if (orderEntry != null) {
      ProjectSettingsService.getInstance(project).openLibraryOrSdkSettings(orderEntry);
      return;
    }
  }

  super.navigate(requestFocus);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:15,代码来源:PsiFileNode.java

示例9: selectIn

import com.intellij.openapi.roots.libraries.LibraryUtil; //导入方法依赖的package包/类
@Override
public void selectIn(final SelectInContext context, final boolean requestFocus) {
  final Project project = context.getProject();
  final VirtualFile file = context.getVirtualFile();

  final Module module;
  final Facet facet;
  if (file instanceof WrappingVirtualFile) {
    final Object o = ((WrappingVirtualFile)file).getWrappedObject(project);
    facet = o instanceof Facet? (Facet)o : null;
    module = facet == null? null : facet.getModule();
  }
  else {
    Module moduleByIml = file.getFileType().equals(StdFileTypes.IDEA_MODULE) ? findModuleByModuleFile(project, file) : null;
    final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
    module = moduleByIml != null ? moduleByIml : fileIndex.getModuleForFile(file);
    facet = fileIndex.isInSourceContent(file) ? null : findFacet(project, file);
  }
  if (module != null || facet != null) {
    ApplicationManager.getApplication().invokeLater(new Runnable() {
      @Override
      public void run() {
        if (facet != null) {
          ModulesConfigurator.showFacetSettingsDialog(facet, null);
        }
        else {
          ProjectSettingsService.getInstance(project).openModuleSettings(module);
        }
      }
    });
    return;
  }

  final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(file, project);
  if (orderEntry != null) {
    ApplicationManager.getApplication().invokeLater(new Runnable() {
      @Override
      public void run() {
        ProjectSettingsService.getInstance(project).openLibraryOrSdkSettings(orderEntry);
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:44,代码来源:ProjectStructureSelectInTarget.java

示例10: selectIn

import com.intellij.openapi.roots.libraries.LibraryUtil; //导入方法依赖的package包/类
@Override
public void selectIn(final SelectInContext context, final boolean requestFocus) {
  final Project project = context.getProject();
  final VirtualFile file = context.getVirtualFile();

  final Module module;
  final Facet facet;
  if (file instanceof WrappingVirtualFile) {
    final Object o = ((WrappingVirtualFile)file).getWrappedObject(project);
    facet = o instanceof Facet? (Facet)o : null;
    module = facet == null? null : facet.getModule();
  }
  else {
    final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
    module = fileIndex.getModuleForFile(file);
    facet = fileIndex.isInSourceContent(file) ? null : findFacet(project, file);
  }
  if (module != null || facet != null) {
    ApplicationManager.getApplication().invokeLater(new Runnable() {
      @Override
      public void run() {
        if (facet != null) {
          ModulesConfigurator.showFacetSettingsDialog(facet, null);
        }
        else {
          ProjectSettingsService.getInstance(project).openModuleSettings(module);
        }
      }
    });
    return;
  }

  final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(file, project);
  if (orderEntry != null) {
    ApplicationManager.getApplication().invokeLater(new Runnable() {
      @Override
      public void run() {
        ProjectSettingsService.getInstance(project).openLibraryOrSdkSettings(orderEntry);
      }
    });
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:43,代码来源:ProjectStructureSelectInTarget.java

示例11: calcRelativeToProjectPath

import com.intellij.openapi.roots.libraries.LibraryUtil; //导入方法依赖的package包/类
@Nonnull
public static String calcRelativeToProjectPath(@Nonnull final VirtualFile file,
                                               @Nullable final Project project,
                                               final boolean includeFilePath,
                                               final boolean includeUniqueFilePath,
                                               final boolean keepModuleAlwaysOnTheLeft) {
  if (file instanceof VirtualFilePathWrapper) {
    return includeFilePath ? ((VirtualFilePathWrapper)file).getPresentablePath() : file.getName();
  }
  String url;
  if (includeFilePath) {
    url = file.getPresentableUrl();
  }
  else if (includeUniqueFilePath) {
    url = UniqueVFilePathBuilder.getInstance().getUniqueVirtualFilePath(project, file);
  }
  else {
    url = file.getName();
  }
  if (project == null) {
    return url;
  }
  else {
    final VirtualFile baseDir = project.getBaseDir();
    if (baseDir != null && includeFilePath) {
      //noinspection ConstantConditions
      final String projectHomeUrl = baseDir.getPresentableUrl();
      if (url.startsWith(projectHomeUrl)) {
        url = "..." + url.substring(projectHomeUrl.length());
      }
    }

    if (SystemInfo.isMac && file.getFileSystem() instanceof ArchiveFileSystem) {
      final VirtualFile fileForJar = ((ArchiveFileSystem)file.getFileSystem()).getLocalVirtualFileFor(file);
      if (fileForJar != null) {
        final OrderEntry libraryEntry = LibraryUtil.findLibraryEntry(file, project);
        if (libraryEntry != null) {
          if (libraryEntry instanceof ModuleExtensionWithSdkOrderEntry) {
            url = url + " - [" + ((ModuleExtensionWithSdkOrderEntry)libraryEntry).getSdkName() + "]";
          }
          else {
            url = url + " - [" + libraryEntry.getPresentableName() + "]";
          }
        }
        else {
          url = url + " - [" + fileForJar.getName() + "]";
        }
      }
    }

    final Module module = ModuleUtil.findModuleForFile(file, project);
    if (module == null) return url;
    return !keepModuleAlwaysOnTheLeft && SystemInfo.isMac ? url + " - [" + module.getName() + "]" : "[" + module.getName() + "] - " + url;
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:56,代码来源:ProjectUtil.java


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