本文整理汇总了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;
}
示例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);
}
}
}
示例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;
}
示例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);
}
示例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));
}
示例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;
}
示例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));
}
示例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;
}
示例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);
}
}
示例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);
}
示例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);
}
});
}
示例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);
}
}
示例14: getUrl
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
protected String getUrl(String relativePath) {
return VfsUtilCore.pathToUrl(getAbsolutePath(relativePath));
}
示例15: getCompilerOutputUrl
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
public String getCompilerOutputUrl() {
return VfsUtilCore.pathToUrl(myProjectCompilerOutput.getText().trim());
}