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


Java VfsUtilCore.pathToUrl方法代码示例

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


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

示例1: getReference

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
@Nullable
@Override
public RefEntity getReference(final String type, final String fqName) {
  for (RefManagerExtension extension : myExtensions.values()) {
    final RefEntity refEntity = extension.getReference(type, fqName);
    if (refEntity != null) return refEntity;
  }
  if (SmartRefElementPointer.FILE.equals(type)) {
    return RefFileImpl.fileFromExternalName(this, fqName);
  }
  if (SmartRefElementPointer.MODULE.equals(type)) {
    return RefModuleImpl.moduleFromName(this, fqName);
  }
  if (SmartRefElementPointer.PROJECT.equals(type)) {
    return getRefProject();
  }
  if (SmartRefElementPointer.DIR.equals(type)) {
    String url = VfsUtilCore.pathToUrl(PathMacroManager.getInstance(getProject()).expandPath(fqName));
    VirtualFile vFile = VirtualFileManager.getInstance().findFileByUrl(url);
    if (vFile != null) {
      final PsiDirectory dir = PsiManager.getInstance(getProject()).findDirectory(vFile);
      return getReference(dir);
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:RefManagerImpl.java

示例2: DefaultHtmlDoctypeInitialConfigurator

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
public DefaultHtmlDoctypeInitialConfigurator(ProjectManager projectManager,
                                             PropertiesComponent propertiesComponent) {
  if (!propertiesComponent.getBoolean("DefaultHtmlDoctype.MigrateToHtml5")) {
    propertiesComponent.setValue("DefaultHtmlDoctype.MigrateToHtml5", true);
    ExternalResourceManagerEx.getInstanceEx()
      .setDefaultHtmlDoctype(Html5SchemaProvider.getHtml5SchemaLocation(), projectManager.getDefaultProject());
  }
  // sometimes VFS fails to pick up updated schema contents and we need to force refresh
  if (StringUtilRt.parseInt(propertiesComponent.getValue("DefaultHtmlDoctype.Refreshed"), 0) < VERSION) {
    propertiesComponent.setValue("DefaultHtmlDoctype.Refreshed", Integer.toString(VERSION));
    final String schemaUrl = VfsUtilCore.pathToUrl(Html5SchemaProvider.getHtml5SchemaLocation());
    final VirtualFile schemaFile = VirtualFileManager.getInstance().findFileByUrl(schemaUrl);
    if (schemaFile != null) {
      schemaFile.getParent().refresh(false, true);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:DefaultHtmlDoctypeInitialConfigurator.java

示例3: getUrls

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
@NotNull
public List<String> getUrls() {
  final List<String> paths = getOsPaths();

  if (paths.isEmpty()) {
    return Collections.emptyList();
  }
  final List<String> result = new ArrayList<String>(paths.size());

  for (String path : paths) {
    String url = VfsUtilCore.pathToUrl(FileUtil.toSystemIndependentName(path));
    final String sdkHome = getCanonicalSdkHome();

    if (sdkHome != null) {
      url = StringUtil.replace(url, sdkHome, AndroidCommonUtils.SDK_HOME_MACRO);
    }
    result.add(url);
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ProGuardConfigFilesPanel.java

示例4: testCustomizeModule

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
public void testCustomizeModule() {
  File rootDir = androidProject.getRootDir();
  IdeaAndroidProject ideaAndroidProject = new IdeaAndroidProject(GradleConstants.SYSTEM_ID, myModule.getName(), rootDir, androidProject,
                                                                 "debug", AndroidProject.ARTIFACT_ANDROID_TEST);
  String compilerOutputPath = "";
  final IdeModifiableModelsProviderImpl modelsProvider = new IdeModifiableModelsProviderImpl(myProject);
  try {
    customizer.customizeModule(myProject, myModule, modelsProvider, ideaAndroidProject);
    CompilerModuleExtension compilerSettings = modelsProvider.getModifiableRootModel(myModule).getModuleExtension(CompilerModuleExtension.class);
    compilerOutputPath = compilerSettings.getCompilerOutputUrl();
    modelsProvider.commit();
  }
  catch (Throwable t) {
    modelsProvider.dispose();
    ExceptionUtil.rethrowAllAsUnchecked(t);
  }

  File classesFolder = ideaAndroidProject.getSelectedVariant().getMainArtifact().getClassesFolder();
  String path = FileUtil.toSystemIndependentName(classesFolder.getPath());
  String expected = VfsUtilCore.pathToUrl(ExternalSystemApiUtil.toCanonicalPath(path));
  assertEquals(expected, compilerOutputPath);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:CompilerOutputModuleCustomizerTest.java

示例5: getUrl

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
public static String getUrl(@NonNls String path) {
  try {
    path = FileUtil.resolveShortWindowsName(path);
  }
  catch (IOException ignored) { }
  return VfsUtilCore.pathToUrl(FileUtil.toSystemIndependentName(path));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ProjectOpenProcessorBase.java

示例6: migrateJdkAnnotationsToCommunityForDevIdea

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
private static String migrateJdkAnnotationsToCommunityForDevIdea(String url) {
  File root = new File(VfsUtilCore.urlToPath(url) + "/..");
  boolean isOldJdkAnnotations = new File(root, "community/java/jdkAnnotations").exists()
              && new File(root, "idea.iml").exists()
              && new File(root, "testData").exists();
  if (isOldJdkAnnotations) {
    return VfsUtilCore.pathToUrl(PathUtil.getCanonicalPath(VfsUtilCore.urlToPath(url + "/../community/java/jdkAnnotations")));
  }
  return url;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:SimpleProjectRoot.java

示例7: assertContentRoots

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
protected void assertContentRoots(String moduleName, String... expectedRoots) {
  List<String> actual = new ArrayList<String>();
  for (ContentEntry e : getContentRoots(moduleName)) {
    actual.add(e.getUrl());
  }

  for (int i = 0; i < expectedRoots.length; i++) {
    expectedRoots[i] = VfsUtilCore.pathToUrl(expectedRoots[i]);
  }

  assertUnorderedPathsAreEqual(actual, Arrays.asList(expectedRoots));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ExternalSystemImportingTestCase.java

示例8: getState

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
@Override
public Element getState() {
  final Element root = new Element("root");
  for (VirtualFile vf : getSortedFiles()) {
    final Element vfElement = new Element(FILE_ELEMENT);
    final Attribute filePathAttr = new Attribute(PATH_ATTR, VfsUtilCore.pathToUrl(vf.getPath()));
    vfElement.setAttribute(filePathAttr);
    root.addContent(vfElement);
  }
  return root;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PersistentFileSetManager.java

示例9: process

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
@Override
public void process(ModuleSettings settings) throws CannotConvertException {
  final Element confElement = AndroidConversionUtil.findAndroidFacetConfigurationElement(settings);

  if (confElement == null) {
    return;
  }
  final Element proguardCfgOptionElement = AndroidConversionUtil.getOptionElement(confElement, PROGUARD_CFG_PATH_OPTION);
  String proguardCfgRelPath = proguardCfgOptionElement != null
                              ? proguardCfgOptionElement.getAttributeValue(AndroidConversionUtil.OPTION_VALUE_ATTRIBUTE)
                              : null;

  if (proguardCfgRelPath == null || proguardCfgRelPath.length() == 0) {
    proguardCfgRelPath = "/" + AndroidCommonUtils.PROGUARD_CFG_FILE_NAME;
  }
  if (proguardCfgOptionElement != null) {
    confElement.removeContent(proguardCfgOptionElement);
  }
  final String proguardCfgFileUrl = VfsUtilCore.pathToUrl('$' + PathMacroUtil.MODULE_DIR_MACRO_NAME + '$' + proguardCfgRelPath);
  final Element includeSystemCfgElement = confElement.getChild("includeSystemProguardFile");
  final String includeSystemCfgStr = includeSystemCfgElement != null ? includeSystemCfgElement.getText() : null;

  if (includeSystemCfgElement != null) {
    confElement.removeContent(includeSystemCfgElement);
  }
  final List<String> proguardCfgUrls = new ArrayList<String>();

  if (!Boolean.FALSE.toString().equals(includeSystemCfgStr)) {
    proguardCfgUrls.add(AndroidCommonUtils.PROGUARD_SYSTEM_CFG_FILE_URL);
  }
  proguardCfgUrls.add(proguardCfgFileUrl);
  final Element newElement = new Element("proGuardCfgFiles");

  for (String url : proguardCfgUrls) {
    final Element fileElement = new Element("file");
    fileElement.setText(url);
    newElement.addContent(fileElement);
  }
  confElement.addContent(newElement);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:AndroidProguardOptionsConverterProvider.java

示例10: setAdditionalNativeLibraries

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
public void setAdditionalNativeLibraries(@NotNull List<AndroidNativeLibData> additionalNativeLibraries) {
  myProperties.myNativeLibs = new ArrayList<JpsAndroidModuleProperties.
    AndroidNativeLibDataEntry>(additionalNativeLibraries.size());

  for (AndroidNativeLibData lib : additionalNativeLibraries) {
    final JpsAndroidModuleProperties.AndroidNativeLibDataEntry data =
      new JpsAndroidModuleProperties.AndroidNativeLibDataEntry();
    data.myArchitecture = lib.getArchitecture();
    data.myUrl = VfsUtilCore.pathToUrl(lib.getPath());
    data.myTargetFileName = lib.getTargetFileName();
    myProperties.myNativeLibs.add(data);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:AndroidFacetConfiguration.java

示例11: doAssertSourceRoots

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
protected void doAssertSourceRoots(List<String> actualRoots, String... roots) {
  List<String> expectedRootUrls = new ArrayList<String>();

  for (String r : roots) {
    String url = VfsUtilCore.pathToUrl(getProjectPath() + "/" + r);
    expectedRootUrls.add(url);
  }

  assertUnorderedPathsAreEqual(actualRoots, expectedRootUrls);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:FacetImporterTestCase.java

示例12: getVirtualFile

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
public static VirtualFile getVirtualFile(final String filePath) {
  @NonNls final String path = VfsUtilCore.pathToUrl(filePath.replace(File.separatorChar, '/'));
  return ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile>() {
    @Nullable
    public VirtualFile compute() {
      return VirtualFileManager.getInstance().findFileByUrl(path);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:SvnUtil.java

示例13: pathToUrl

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
@NotNull
private static String pathToUrl(@NotNull String filePath) {
  filePath = FileUtil.toSystemIndependentName(filePath);
  if (filePath.endsWith(".srcjar") || filePath.endsWith(".jar")) {
    return URLUtil.JAR_PROTOCOL + URLUtil.SCHEME_SEPARATOR + filePath + URLUtil.JAR_SEPARATOR;
  } else if (filePath.contains("src.jar!")) {
    return URLUtil.JAR_PROTOCOL + URLUtil.SCHEME_SEPARATOR + filePath;
  } else {
    return VfsUtilCore.pathToUrl(filePath);
  }
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:12,代码来源:ResourceModuleContentRootCustomizer.java

示例14: getUrl

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
protected String getUrl(String relativePath) {
  return VfsUtilCore.pathToUrl(getAbsolutePath(relativePath));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:JpsSerializationTestCase.java

示例15: getCompilerOutputUrl

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
public String getCompilerOutputUrl() {
  return VfsUtilCore.pathToUrl(myProjectCompilerOutput.getText().trim());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:ProjectConfigurable.java


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