From bd06e8242ed106b2436ac9cdcad2d91d43a79e47 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Sun, 11 Sep 2016 15:23:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=9D=E8=B5=96=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DownLoadDependenceUI.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) 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 4209857bc..5fa360753 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());