本文整理了Java中net.sf.okapi.common.Util.toURL()
方法的一些代码示例,展示了Util.toURL()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.toURL()
方法的具体详情如下:
包路径:net.sf.okapi.common.Util
类名称:Util
方法名:toURL
[英]Creates a new URL object from a path or a URI string. This is a convenience wrapper to catch the various conversion exceptions.
[中]从路径或URI字符串创建新的URL对象。这是一个方便的包装器,用于捕获各种转换异常。
代码示例来源:origin: net.sf.okapi.lib/okapi-lib-verification-ui
private void importConfiguration() {
try {
String[] paths = Dialogs.browseFilenames(shell, "Import Configuration", false, null,
String.format("Quality Check Configurations (*%s)\tAll Files (*.*)", Parameters.FILE_EXTENSION),
String.format("*%s\t*.*", Parameters.FILE_EXTENSION));
if (paths == null) {
return;
}
params.load(Util.toURL(paths[0]), false);
setData();
} catch (Throwable e) {
Dialogs.showError(shell, "Error while saving configuration.\n" + e.getMessage(), null);
}
}
代码示例来源:origin: net.sf.okapi.lib/okapi-lib-verification-ui
private void loadConfiguration () {
try {
String[] paths = Dialogs.browseFilenames(shell, "Load Configuration", false, null,
String.format("Quality Check Configurations (*%s)\tAll Files (*.*)", Parameters.FILE_EXTENSION),
String.format("*%s\t*.*", Parameters.FILE_EXTENSION));
if ( paths == null ) return;
startWaiting("Loading configuration...");
Parameters params = session.getParameters();
params.load(Util.toURL(paths[0]), false);
}
catch ( Throwable e ) {
Dialogs.showError(shell, "Error while saving configuration.\n"+e.getMessage(), null);
}
finally {
stopWaiting();
}
}
代码示例来源:origin: net.sf.okapi.steps/okapi-step-searchandreplace-ui
public void widgetSelected(SelectionEvent e) {
FileDialog fd = new FileDialog(shell, SWT.OPEN);
fd.setText("Import Search and Replace Options");
String selected = fd.open();
if ( selected != null ) {
try {
Parameters tmpParams = new Parameters();
tmpParams.load(Util.toURL(selected), false);
setData(tmpParams);
}
catch ( Throwable err ) {
Dialogs.showError(shell, err.getMessage(), null);
}
}
}
});
内容来源于网络,如有侵权,请联系作者删除!