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


Java VirtualFileManager.extractPath方法代码示例

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


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

示例1: getAnnotationProcessorsGenerationPath

import com.intellij.openapi.vfs.VirtualFileManager; //导入方法依赖的package包/类
@Nullable
public static String getAnnotationProcessorsGenerationPath(Module module) {
  final AnnotationProcessingConfiguration config = CompilerConfiguration.getInstance(module.getProject()).getAnnotationProcessingConfiguration(module);
  final String sourceDirName = config.getGeneratedSourcesDirectoryName(false);
  if (config.isOutputRelativeToContentRoot()) {
    final String[] roots = ModuleRootManager.getInstance(module).getContentRootUrls();
    if (roots.length == 0) {
      return null;
    }
    if (roots.length > 1) {
      Arrays.sort(roots, URLS_COMPARATOR);
    }
    return StringUtil.isEmpty(sourceDirName)? VirtualFileManager.extractPath(roots[0]): VirtualFileManager.extractPath(roots[0]) + "/" + sourceDirName;
  }


  final String path = getModuleOutputPath(module, false);
  if (path == null) {
    return null;
  }
  return StringUtil.isEmpty(sourceDirName)? path : path + "/" + sourceDirName;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:CompilerPaths.java

示例2: getLocation

import com.intellij.openapi.vfs.VirtualFileManager; //导入方法依赖的package包/类
protected Location getLocation(@NotNull Project project, @NotNull GlobalSearchScope searchScope, String locationUrl) {
  if (locationUrl != null && myLocator != null) {
    String protocolId = VirtualFileManager.extractProtocol(locationUrl);
    if (protocolId != null) {
      String path = VirtualFileManager.extractPath(locationUrl);
      if (!DumbService.isDumb(project) || DumbService.isDumbAware(myLocator)) {
        List<Location> locations = myLocator.getLocation(protocolId, path, project, searchScope);
        if (!locations.isEmpty()) {
          return locations.get(0);
        }
      }
    }
  }

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

示例3: saveCredentials

import com.intellij.openapi.vfs.VirtualFileManager; //导入方法依赖的package包/类
public void saveCredentials() {
  if (myGetPassword == null) return;

  // if checkbox is selected, save on disk. Otherwise in memory. Don't read password safe settings.

  final PasswordSafeImpl passwordSafe = (PasswordSafeImpl)PasswordSafe.getInstance();
  final String url = VirtualFileManager.extractPath(myGetPassword.getURL());
  final String key = keyForUrlAndLogin(url, myGetPassword.getUserName());
  try {
    if (myGetPassword.isRememberPassword()) {
      PasswordSafe.getInstance().storePassword(myProject, HgCommandAuthenticator.class, key, myGetPassword.getPassword());
    }
    else if (passwordSafe.getSettings().getProviderType() != PasswordSafeSettings.ProviderType.DO_NOT_STORE) {
      passwordSafe.getMemoryProvider().storePassword(myProject, HgCommandAuthenticator.class, key, myGetPassword.getPassword());
    }
    final HgVcs vcs = HgVcs.getInstance(myProject);
    if (vcs != null) {
      vcs.getGlobalSettings().addRememberedUrl(url, myGetPassword.getUserName());
    }
  }
  catch (PasswordSafeException e) {
    LOG.info("Couldn't store the password for key [" + key + "]", e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:HgCommandAuthenticator.java

示例4: getLocation

import com.intellij.openapi.vfs.VirtualFileManager; //导入方法依赖的package包/类
@Nullable
private Location<?> getLocation(String url) {
  String protocol = VirtualFileManager.extractProtocol(url);
  if (protocol == null) {
    return null;
  }
  String path = VirtualFileManager.extractPath(url);
  assertThat(handler.getTestLocator()).isNotNull();
  @SuppressWarnings("rawtypes")
  List<Location> locations =
      handler
          .getTestLocator()
          .getLocation(protocol, path, getProject(), GlobalSearchScope.allScope(getProject()));
  assertThat(locations).hasSize(1);
  return locations.get(0);
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:17,代码来源:BlazeGoTestEventsHandlerTest.java

示例5: copyLibrary

import com.intellij.openapi.vfs.VirtualFileManager; //导入方法依赖的package包/类
public static void copyLibrary(LibraryEx from, Map<String, String> rootMapping, LibraryEx.ModifiableModelEx target) {
  target.setProperties(from.getProperties());
  for (OrderRootType type : OrderRootType.getAllTypes()) {
    final String[] urls = from.getUrls(type);
    for (String url : urls) {
      final String protocol = VirtualFileManager.extractProtocol(url);
      if (protocol == null) continue;
      final String fullPath = VirtualFileManager.extractPath(url);
      final int sep = fullPath.indexOf(JarFileSystem.JAR_SEPARATOR);
      String localPath;
      String pathInJar;
      if (sep != -1) {
        localPath = fullPath.substring(0, sep);
        pathInJar = fullPath.substring(sep);
      }
      else {
        localPath = fullPath;
        pathInJar = "";
      }
      final String targetPath = rootMapping.get(localPath);
      String targetUrl = targetPath != null ? VirtualFileManager.constructUrl(protocol, targetPath + pathInJar) : url;

      if (from.isJarDirectory(url, type)) {
        target.addJarDirectory(targetUrl, false, type);
      }
      else {
        target.addRoot(targetUrl, type);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:LibraryEditingUtil.java

示例6: getPresentablePath

import com.intellij.openapi.vfs.VirtualFileManager; //导入方法依赖的package包/类
public static String getPresentablePath(final String url) {
  String presentablePath = VirtualFileManager.extractPath(url);
  if (isJarFileRoot(url)) {
    presentablePath = presentablePath.substring(0, presentablePath.length() - JarFileSystem.JAR_SEPARATOR.length());
  }
  return presentablePath;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ItemElement.java

示例7: getProjectPath

import com.intellij.openapi.vfs.VirtualFileManager; //导入方法依赖的package包/类
@Nullable
private static String getProjectPath(final Project project) {
  final String url = project.getPresentableUrl();
  if (url == null) {
    return null;
  }
  return VirtualFileManager.extractPath(url);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:BuildManager.java

示例8: getPresentableString

import com.intellij.openapi.vfs.VirtualFileManager; //导入方法依赖的package包/类
@Override
@NotNull
public String getPresentableString() {
  String path = VirtualFileManager.extractPath(myUrl);
  if (path.endsWith(URLUtil.JAR_SEPARATOR)) {
    path = path.substring(0, path.length() - URLUtil.JAR_SEPARATOR.length());
  }
  return path.replace('/', File.separatorChar);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:SimpleProjectRoot.java

示例9: toPresentableUrl

import com.intellij.openapi.vfs.VirtualFileManager; //导入方法依赖的package包/类
public static String toPresentableUrl(String url) {
  String path = VirtualFileManager.extractPath(url);
  if (path.endsWith(JarFileSystem.JAR_SEPARATOR)) {
    path = path.substring(0, path.length() - JarFileSystem.JAR_SEPARATOR.length());
  }
  return path.replace('/', File.separatorChar);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:LightFilePointer.java

示例10: getLocation

import com.intellij.openapi.vfs.VirtualFileManager; //导入方法依赖的package包/类
@Nullable
private Location<?> getLocation(String url) {
  String protocol = VirtualFileManager.extractProtocol(url);
  String path = VirtualFileManager.extractPath(url);
  if (protocol == null) {
    return null;
  }
  return Iterables.getFirst(
      handler
          .getTestLocator()
          .getLocation(protocol, path, getProject(), GlobalSearchScope.allScope(getProject())),
      null);
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:14,代码来源:BlazeAndroidTestEventsHandlerTest.java

示例11: derivePackagePrefix

import com.intellij.openapi.vfs.VirtualFileManager; //导入方法依赖的package包/类
private static String derivePackagePrefix(File file, SourceFolder parentFolder) {
  String parentPackagePrefix = parentFolder.getPackagePrefix();
  String parentPath = VirtualFileManager.extractPath(parentFolder.getUrl());
  String relativePath =
      FileUtil.toCanonicalPath(
          FileUtil.getRelativePath(parentPath, file.getPath(), File.separatorChar));
  if (Strings.isNullOrEmpty(relativePath)) {
    return parentPackagePrefix;
  }
  relativePath = relativePath.replaceAll(File.separator, ".");
  return Strings.isNullOrEmpty(parentPackagePrefix)
      ? relativePath
      : parentPackagePrefix + "." + relativePath;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:15,代码来源:JavaSourceFolderProvider.java

示例12: readExternal

import com.intellij.openapi.vfs.VirtualFileManager; //导入方法依赖的package包/类
public void readExternal(@NotNull Element element, @Nullable ProjectJdkTable projectJdkTable) {
  myName = element.getChild(ELEMENT_NAME).getAttributeValue(ATTRIBUTE_VALUE);
  final Element typeChild = element.getChild(ELEMENT_TYPE);
  final String sdkTypeName = typeChild != null ? typeChild.getAttributeValue(ATTRIBUTE_VALUE) : null;
  if (sdkTypeName != null) {
    if (projectJdkTable == null) {
      projectJdkTable = ProjectJdkTable.getInstance();
    }
    mySdkType = projectJdkTable.getSdkTypeByName(sdkTypeName);
  }
  final Element version = element.getChild(ELEMENT_VERSION);

  // set version if it was cached (defined)
  // otherwise it will be null && undefined
  if (version != null) {
    setVersionString(version.getAttributeValue(ATTRIBUTE_VALUE));
  }
  else {
    myVersionDefined = false;
  }

  if (element.getAttribute(ELEMENT_VERSION) == null || !"2".equals(element.getAttributeValue(ELEMENT_VERSION))) {
    myRootContainer.startChange();
    myRootContainer.readOldVersion(element.getChild(ELEMENT_ROOTS));
    final List children = element.getChild(ELEMENT_ROOTS).getChildren(ELEMENT_ROOT);
    for (final Object aChildren : children) {
      Element root = (Element)aChildren;
      for (final Object o : root.getChildren(ELEMENT_PROPERTY)) {
        Element prop = (Element)o;
        if (ELEMENT_TYPE.equals(prop.getAttributeValue(ELEMENT_NAME)) && VALUE_JDKHOME.equals(prop.getAttributeValue(ATTRIBUTE_VALUE))) {
          myHomePath = VirtualFileManager.extractPath(root.getAttributeValue(ATTRIBUTE_FILE));
        }
      }
    }
    myRootContainer.finishChange();
  }
  else {
    myHomePath = element.getChild(ELEMENT_HOMEPATH).getAttributeValue(ATTRIBUTE_VALUE);
    myRootContainer.readExternal(element.getChild(ELEMENT_ROOTS));
  }

  final Element additional = element.getChild(ELEMENT_ADDITIONAL);
  if (additional != null) {
    LOG.assertTrue(mySdkType != null);
    myAdditionalData = mySdkType.loadAdditionalData(this, additional);
  }
  else {
    myAdditionalData = null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:51,代码来源:ProjectJdkImpl.java

示例13: urlToFile

import com.intellij.openapi.vfs.VirtualFileManager; //导入方法依赖的package包/类
public static File urlToFile(String url) {
  return new File(VirtualFileManager.extractPath(url));
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:4,代码来源:UrlUtil.java


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