本文整理匯總了Java中com.intellij.openapi.vfs.VirtualFileManager.extractProtocol方法的典型用法代碼示例。如果您正苦於以下問題:Java VirtualFileManager.extractProtocol方法的具體用法?Java VirtualFileManager.extractProtocol怎麽用?Java VirtualFileManager.extractProtocol使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.vfs.VirtualFileManager
的用法示例。
在下文中一共展示了VirtualFileManager.extractProtocol方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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;
}
示例2: 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);
}
示例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: 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;
}
示例5: readExternal
import com.intellij.openapi.vfs.VirtualFileManager; //導入方法依賴的package包/類
@Override
public void readExternal(final Element element) throws InvalidDataException {
final String value = element.getAttributeValue(VALUE_ATTRIBUTE);
myUrl = value != null ? value : "";
final String protocol = VirtualFileManager.extractProtocol(myUrl);
if (protocol == null) myUrl = urlValue(myUrl);
}
示例6: getUrl
import com.intellij.openapi.vfs.VirtualFileManager; //導入方法依賴的package包/類
public String getUrl() {
String result = myUrlField.getText();
if (VirtualFileManager.extractProtocol(result) == null) {
result = "http://" + result;
}
return result;
}
示例7: 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);
}