Browse Source

update

master
Fangjie Hu 8 years ago
parent
commit
d23e620ac9
  1. 2
      designer_base/src/com/fr/design/extra/PluginHelper.java
  2. 21
      designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java
  3. 6
      designer_base/src/com/fr/design/extra/plugindependence/PluginDependenceUtils.java

2
designer_base/src/com/fr/design/extra/PluginHelper.java

@ -134,7 +134,7 @@ public class PluginHelper {
for (int i = 0;list != null && i < list.size(); i++){ for (int i = 0;list != null && i < list.size(); i++){
PluginDependenceUnit dependenceUnit = list.get(i); PluginDependenceUnit dependenceUnit = list.get(i);
if (!dependenceUnit.checkFileEnv()){ if (!dependenceUnit.checkFileEnv()){
PluginDependenceUtils.installDependenceOnline(currentID, dependenceUnit.getDependenceID(), dependenceUnit.getFileDir()); PluginDependenceUtils.installDependenceOnline(currentID, dependenceUnit.getDependenceID(),dependenceUnit.getDependenceType(), dependenceUnit.getDependenceDir());
} }
} }
} }

21
designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java

@ -1,5 +1,7 @@
package com.fr.design.extra.plugindependence; package com.fr.design.extra.plugindependence;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.design.extra.PluginConstants; import com.fr.design.extra.PluginConstants;
import com.fr.design.extra.PluginHelper; import com.fr.design.extra.PluginHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -7,6 +9,7 @@ import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.plugin.dependence.PluginDependenceType;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -45,6 +48,7 @@ public class DownLoadDependenceUI implements ActionListener {
private String currentID; private String currentID;
private String dependenceID; private String dependenceID;
private String dependenceDir; private String dependenceDir;
private PluginDependenceType dependenceType;
//安装结果 //安装结果
private boolean result = false; private boolean result = false;
//链接服务器的客户端 //链接服务器的客户端
@ -54,13 +58,13 @@ public class DownLoadDependenceUI implements ActionListener {
//文件总长度 //文件总长度
private int totalSize = 0; private int totalSize = 0;
public DownLoadDependenceUI(String ID, String dir) { public DownLoadDependenceUI() {
} }
public DownLoadDependenceUI(String currentID, String dependenceID, PluginDependenceType dependenceType, String dependenceDir) {
public DownLoadDependenceUI(String currentID, String dependenceID, String dependenceDir) {
this.currentID = currentID; this.currentID = currentID;
this.dependenceID = dependenceID; this.dependenceID = dependenceID;
this.dependenceDir = dependenceDir; this.dependenceDir = dependenceDir;
this.dependenceType = dependenceType;
this.totalSize = getFileLength(); this.totalSize = getFileLength();
init(); init();
} }
@ -197,9 +201,14 @@ public class DownLoadDependenceUI implements ActionListener {
} }
} }
//安装已经下载好的文件 //安装已经下载好的文件,如果是服务文件,则需要复制一份到安装目录下,
private void installPluginDependenceFile(String filePath) throws Exception { //以便切换远程时,使用本地的服务
IOUtils.unzip(new File(filePath), dependenceDir); //如果是服务器环境,则只会安装一份
private void installPluginDependenceFile(String filePath){
IOUtils.unzip(new File(filePath), FRContext.getCurrentEnv().getPath() + dependenceDir);
if (dependenceType == PluginDependenceType.SERVICE) {
IOUtils.unzip(new File(filePath), StableUtils.getInstallHome() + dependenceDir);
}
} }
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {

6
designer_base/src/com/fr/design/extra/plugindependence/PluginDependenceUtils.java

@ -1,13 +1,15 @@
package com.fr.design.extra.plugindependence; package com.fr.design.extra.plugindependence;
import com.fr.plugin.dependence.PluginDependenceType;
/** /**
* Created by hufan on 2016/8/31. * Created by hufan on 2016/8/31.
*/ */
public class PluginDependenceUtils { public class PluginDependenceUtils {
public static boolean installDependenceOnline(String currentID, String dependenceID, String dependenceDir) { public static boolean installDependenceOnline(String currentID, String dependenceID, PluginDependenceType dependenceType, String dependenceDir) {
DownLoadDependenceUI ui = new DownLoadDependenceUI(currentID, dependenceID, dependenceDir); DownLoadDependenceUI ui = new DownLoadDependenceUI(currentID, dependenceID, dependenceType, dependenceDir);
return ui.installOnline(); return ui.installOnline();
} }
} }

Loading…
Cancel
Save