diff --git a/designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java b/designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java index 4209857bcb..5fa360753a 100644 --- a/designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java +++ b/designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java @@ -164,9 +164,13 @@ public class DownLoadDependenceUI implements ActionListener { return result; } - private List downloadPluginDependenceFile() throws Exception { + /** + * 下载和安装不分开是因为,本地如果只安装好了一个依赖,下次就不需要重复下载了 + * @return + * @throws Exception + */ + private void downloadAndInstallPluginDependenceFile() throws Exception { totalBytesRead = 0; - List pathList = new ArrayList(); for (int i = 0; i < list.size(); i++) { PluginDependenceUnit dependenceUnit = list.get(i); httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind(dependenceUnit.getDependenceID())); @@ -191,21 +195,23 @@ public class DownLoadDependenceUI implements ActionListener { result = false; throw new PluginDependenceException(Inter.getLocText("FR-Designer-Dependence_Install_Failed")); } - pathList.add(temp); + + //安装文件 + IOUtils.unzip(new File(temp), FRContext.getCurrentEnv().getPath() + dependenceUnit.getDependenceDir()); } else { result = false; throw new PluginDependenceException(Inter.getLocText("FR-Designer-Dependence_Install_Failed")); } } - return pathList; + //所有依赖都正常安装下载完毕,则结果为true + result = true; } public void installDependenceOnline() { try { - List filePathList = downloadPluginDependenceFile(); - //安装文件 - installPluginDependenceFile(filePathList); + //下载并安装文件 + downloadAndInstallPluginDependenceFile(); } catch (Exception e) { result = false; FRContext.getLogger().error(e.getMessage());