本文整理汇总了Java中org.eclipse.core.runtime.URIUtil.toURI方法的典型用法代码示例。如果您正苦于以下问题:Java URIUtil.toURI方法的具体用法?Java URIUtil.toURI怎么用?Java URIUtil.toURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.runtime.URIUtil
的用法示例。
在下文中一共展示了URIUtil.toURI方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getScriptsHome
import org.eclipse.core.runtime.URIUtil; //导入方法依赖的package包/类
public static String getScriptsHome() throws IOException, URISyntaxException {
File scriptsHome;
try {
URL url = new URL("platform:/plugin/" + PLUGIN_ID + "/scripts");
URL fileURL = FileLocator.toFileURL(url);
scriptsHome = new File(URIUtil.toURI(fileURL));
} catch (MalformedURLException e) {
// Running without OSGi, make a guess the scripts are relative to the local directory
scriptsHome = new File("scripts/");
}
if (!scriptsHome.exists()) {
throw new IOException("Failed to find " + PLUGIN_ID + "/scripts, expected it here: " + scriptsHome);
}
return scriptsHome.toString();
}
示例2: getSciSoftPyHome
import org.eclipse.core.runtime.URIUtil; //导入方法依赖的package包/类
public static String getSciSoftPyHome() throws IOException, URISyntaxException {
File scriptsHome;
try {
URL url = new URL("platform:/plugin/org.eclipse.triquetrum.python.service/scripts");
URL fileURL = FileLocator.toFileURL(url);
scriptsHome = new File(URIUtil.toURI(fileURL));
} catch (MalformedURLException e) {
// Running without OSGi, make a guess the scripts are relative to the local directory
scriptsHome = new File("../org.eclipse.triquetrum.python.service/scripts/");
}
if (!scriptsHome.exists()) {
throw new IOException("Failed to find org.eclipse.triquetrum.python.service/scripts, expected it here: " + scriptsHome);
}
return scriptsHome.toString();
}
示例3: getExampleScriptsHome
import org.eclipse.core.runtime.URIUtil; //导入方法依赖的package包/类
private String getExampleScriptsHome() throws IOException, URISyntaxException {
String location = System.getProperty(OVERRIDE_LOCATION_PROPERTY);
if (location != null) {
return location;
}
URL url = new URL("platform:/plugin/" + PLUGIN_ID + "/scripts");
URL fileURL = FileLocator.toFileURL(url);
File exampleScriptsHome = new File(URIUtil.toURI(fileURL));
if (!exampleScriptsHome.exists()) {
throw new IOException("Failed to find " + PLUGIN_ID + "/scripts, expected it here: " + exampleScriptsHome);
}
return exampleScriptsHome.toString();
}
示例4: getSystemScriptsHome
import org.eclipse.core.runtime.URIUtil; //导入方法依赖的package包/类
private static String getSystemScriptsHome() throws IOException, URISyntaxException {
URL url = new URL("platform:/plugin/" + PLUGIN_ID + "/scripts");
URL fileURL = FileLocator.toFileURL(url);
File systemScriptsHome = new File(URIUtil.toURI(fileURL));
if (!systemScriptsHome.exists()) {
throw new IOException("Failed to find " + PLUGIN_ID + "/scripts, expected it here: " + systemScriptsHome);
}
return systemScriptsHome.toString();
}
示例5: validateURL
import org.eclipse.core.runtime.URIUtil; //导入方法依赖的package包/类
private void validateURL(URL location) throws MalformedURLException, URISyntaxException {
URI path= URIUtil.toURI(location);
URI index = URIUtil.append(path, "index.html"); //$NON-NLS-1$
URI packagelist = URIUtil.append(path, "package-list"); //$NON-NLS-1$
URL indexURL = URIUtil.toURL(index);
URL packagelistURL = URIUtil.toURL(packagelist);
boolean suc= checkURLConnection(indexURL) && checkURLConnection(packagelistURL);
if (suc) {
showConfirmValidationDialog(indexURL);
} else {
MessageDialog.openWarning(fShell, fTitle, fInvalidMessage);
}
}
示例6: getFileFromOsgiRes
import org.eclipse.core.runtime.URIUtil; //导入方法依赖的package包/类
/**
* @param url url should NOT be URL-encoded
*/
public static File getFileFromOsgiRes(URL url) throws URISyntaxException, IOException {
return new File(
URIUtil.toURI(url.getProtocol().equals("file") ?
url : FileLocator.toFileURL(url)));
}