Java Code Examples for com.intellij.openapi.vfs.VfsUtil#toUri()
The following examples show how to use
com.intellij.openapi.vfs.VfsUtil#toUri() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RefactoringUtils.java From netbeans-mmd-plugin with Apache License 2.0 | 5 votes |
public static MMapURI makeNewMMapUri(@Nonnull final Project project, @Nonnull final MMapURI oldFile, @Nonnull VirtualFile newFile) { final File projectFolder = IdeaUtils.findProjectFolder(project); if (projectFolder == null) { throw new NullPointerException("Project folder is not found for " + project); } URI baseURI = VfsUtil.toUri(newFile); if (baseURI.isAbsolute()) { final URI projectURI = VfsUtil.toUri(projectFolder); baseURI = projectURI.relativize(baseURI); } return MMapURI.makeFromFilePath(projectFolder, baseURI.toString(), oldFile.getParameters()); }
Example 2
Source File: CommonProxy.java From consulo with Apache License 2.0 | 4 votes |
private static URI createUri(final URL url) { return VfsUtil.toUri(url.toString()); }
Example 3
Source File: HttpConfigurable.java From consulo with Apache License 2.0 | 4 votes |
public boolean isHttpProxyEnabledForUrl(@Nullable String url) { if (!USE_HTTP_PROXY) return false; URI uri = url != null ? VfsUtil.toUri(url) : null; return uri == null || !mySelector.isProxyException(uri.getHost()); }
Example 4
Source File: BrowserLauncherAppless.java From consulo with Apache License 2.0 | 4 votes |
private void openOrBrowse(@Nonnull String url, boolean browse) { url = url.trim(); if (url.startsWith("jar:")) { String files = extractFiles(url); if (files == null) { return; } url = files; } URI uri; if (BrowserUtil.isAbsoluteURL(url)) { uri = VfsUtil.toUri(url); } else { File file = new File(url); if (!browse && isDesktopActionSupported(Desktop.Action.OPEN)) { if (!file.exists()) { doShowError(IdeBundle.message("error.file.does.not.exist", file.getPath()), null, null, null, null); return; } try { Desktop.getDesktop().open(file); return; } catch (IOException e) { LOG.debug(e); } } browse(file); return; } if (uri == null) { doShowError(IdeBundle.message("error.malformed.url", url), null, null, null, null); } else { browse(uri); } }