當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。