本文整理匯總了Java中com.intellij.openapi.vfs.VirtualFileManager.constructUrl方法的典型用法代碼示例。如果您正苦於以下問題:Java VirtualFileManager.constructUrl方法的具體用法?Java VirtualFileManager.constructUrl怎麽用?Java VirtualFileManager.constructUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.vfs.VirtualFileManager
的用法示例。
在下文中一共展示了VirtualFileManager.constructUrl方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getBundledGdslFiles
import com.intellij.openapi.vfs.VirtualFileManager; //導入方法依賴的package包/類
private static List<VirtualFile> getBundledGdslFiles() {
final List<VirtualFile> result = ContainerUtil.newArrayList();
for (File file : getBundledScriptFolders()) {
if (file.exists()) {
File[] children = file.listFiles();
if (children != null) {
for (File child : children) {
final String fileName = child.getName();
if (fileName.endsWith(".gdsl")) {
String path = FileUtil.toSystemIndependentName(child.getPath());
String url = VirtualFileManager.constructUrl(URLUtil.FILE_PROTOCOL, path);
ContainerUtil.addIfNotNull(result, VirtualFileManager.getInstance().refreshAndFindFileByUrl(url));
}
}
}
}
}
return result;
}
示例2: pathToUrl
import com.intellij.openapi.vfs.VirtualFileManager; //導入方法依賴的package包/類
protected static String pathToUrl(File path) {
String name = path.getName();
boolean isJarFile =
FileUtilRt.extensionEquals(name, "jar") || FileUtilRt.extensionEquals(name, "zip");
// .jar files require an URL with "jar" protocol.
String protocol =
isJarFile
? StandardFileSystems.JAR_PROTOCOL
: VirtualFileSystemProvider.getInstance().getSystem().getProtocol();
String filePath = FileUtil.toSystemIndependentName(path.getPath());
String url = VirtualFileManager.constructUrl(protocol, filePath);
if (isJarFile) {
url += URLUtil.JAR_SEPARATOR;
}
return url;
}
示例3: 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);
}
}
}
}
示例4: writeExternal
import com.intellij.openapi.vfs.VirtualFileManager; //導入方法依賴的package包/類
public final void writeExternal(@NotNull Element parentElement) {
Element moduleElement = new Element(ELEMENT_MODULE);
final String moduleFilePath = getModuleFilePath();
final String url = VirtualFileManager.constructUrl(URLUtil.FILE_PROTOCOL, moduleFilePath);
moduleElement.setAttribute(ATTRIBUTE_FILEURL, url);
// [dsl] support for older builds
moduleElement.setAttribute(ATTRIBUTE_FILEPATH, moduleFilePath);
final String groupPath = getGroupPathString();
if (groupPath != null) {
moduleElement.setAttribute(ATTRIBUTE_GROUP, groupPath);
}
parentElement.addContent(moduleElement);
}
示例5: correctRepositoryRule
import com.intellij.openapi.vfs.VirtualFileManager; //導入方法依賴的package包/類
private static String correctRepositoryRule(String input) {
String protocol = VirtualFileManager.extractProtocol(input);
if (protocol == null) {
input = VirtualFileManager.constructUrl(URLUtil.HTTP_PROTOCOL, input);
}
return input;
}
示例6: FileOrDirectoryTreeNode
import com.intellij.openapi.vfs.VirtualFileManager; //導入方法依賴的package包/類
protected FileOrDirectoryTreeNode(@NotNull String path,
@NotNull SimpleTextAttributes invalidAttributes,
@NotNull Project project,
@Nullable String parentPath) {
String preparedPath = path.replace(File.separatorChar, '/');
String url = VirtualFileManager.constructUrl(LocalFileSystem.getInstance().getProtocol(), preparedPath);
setUserObject(VirtualFilePointerManager.getInstance().create(url, this, this));
myFile = new File(getFilePath());
myInvalidAttributes = invalidAttributes;
myProject = project;
myName = parentPath == null ? myFile.getAbsolutePath() : myFile.getName();
}
示例7: getUrl
import com.intellij.openapi.vfs.VirtualFileManager; //導入方法依賴的package包/類
@Nullable
public String getUrl() {
String url = StringUtil.nullize(myUrlField.getText(), true);
if (url != null) {
url = url.trim();
if (!URLUtil.containsScheme(url)) {
return VirtualFileManager.constructUrl(URLUtil.HTTP_PROTOCOL, url);
}
}
return url;
}
示例8: updateUrl
import com.intellij.openapi.vfs.VirtualFileManager; //導入方法依賴的package包/類
private static void updateUrl(Library.ModifiableModel library,
OrderRootType type,
MavenArtifact artifact,
MavenExtraArtifactType artifactType,
MavenProject project,
boolean clearAll) {
String classifier = null;
String extension = null;
if (artifactType != null) {
Pair<String, String> result = project.getClassifierAndExtension(artifact, artifactType);
classifier = result.first;
extension = result.second;
}
String newPath = artifact.getPathForExtraArtifact(classifier, extension);
String newUrl = VirtualFileManager.constructUrl(JarFileSystem.PROTOCOL, newPath) + JarFileSystem.JAR_SEPARATOR;
boolean urlExists = false;
for (String url : library.getUrls(type)) {
if (newUrl.equals(url)) {
urlExists = true;
continue;
}
if (clearAll || (isRepositoryUrl(artifact, url) && !url.startsWith(newUrl))) {
library.removeRoot(url, type);
}
}
if (!urlExists) {
library.addRoot(newUrl, type);
}
}
示例9: pathToUrl
import com.intellij.openapi.vfs.VirtualFileManager; //導入方法依賴的package包/類
public static String pathToUrl(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 VirtualFileManager.constructUrl(
VirtualFileSystemProvider.getInstance().getSystem().getProtocol(), filePath);
}
}
示例10: extractPresentableUrl
import com.intellij.openapi.vfs.VirtualFileManager; //導入方法依賴的package包/類
@NotNull
@Override
public String extractPresentableUrl(@NotNull String path) {
return VirtualFileManager.constructUrl(myProtocol, path);
}
示例11: urlValue
import com.intellij.openapi.vfs.VirtualFileManager; //導入方法依賴的package包/類
public static String urlValue(String localPath) {
return StringUtil.isEmptyOrSpaces(localPath) ? "" : VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, localPath.trim().replace(File.separatorChar, '/'));
}
示例12: writeExternal
import com.intellij.openapi.vfs.VirtualFileManager; //導入方法依賴的package包/類
public void writeExternal(final Element element) {
String url = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, myFile.getAbsolutePath().replace(File.separatorChar, '/'));
element.setAttribute(PATH, url);
}
示例13: writeExternal
import com.intellij.openapi.vfs.VirtualFileManager; //導入方法依賴的package包/類
public void writeExternal(final Element dataElement) {
String url = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, myDir.getAbsolutePath().replace(File.separatorChar, '/'));
dataElement.setAttribute(DIR, url);
}
示例14: pathToUrl
import com.intellij.openapi.vfs.VirtualFileManager; //導入方法依賴的package包/類
private static String pathToUrl(File path) {
String filePath = FileUtil.toSystemIndependentName(path.getPath());
return VirtualFileManager.constructUrl(
VirtualFileSystemProvider.getInstance().getSystem().getProtocol(), filePath);
}