Browse Source

update

master
Fangjie Hu 8 years ago
parent
commit
4ebbd2a495
  1. 6
      designer_base/src/com/fr/design/extra/PluginHelper.java
  2. 16
      designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java

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

@ -132,9 +132,9 @@ public class PluginHelper {
String currentID = dependence.getCurrentPluginID(); String currentID = dependence.getCurrentPluginID();
List<PluginDependenceUnit> list = dependence.getDependPlugins(); List<PluginDependenceUnit> list = dependence.getDependPlugins();
for (int i = 0;list != null && i < list.size(); i++){ for (int i = 0;list != null && i < list.size(); i++){
PluginDependenceUnit preDependence = list.get(i); PluginDependenceUnit dependenceUnit = list.get(i);
if (!preDependence.checkFileEnv()){ if (!dependenceUnit.checkFileEnv()){
PluginDependenceUtils.installDependenceOnline(currentID, preDependence.getDependenceID(), preDependence.getFileDir()); PluginDependenceUtils.installDependenceOnline(currentID, dependenceUnit.getDependenceID(), dependenceUnit.getFileDir());
} }
} }
} }

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

@ -133,7 +133,7 @@ public class DownLoadDependenceUI implements ActionListener {
Thread thread = new Thread(new Runnable() { Thread thread = new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
installPhantomJsOnline(); installDependenceOnline();
} }
}); });
thread.start(); thread.start();
@ -151,7 +151,7 @@ public class DownLoadDependenceUI implements ActionListener {
return result; return result;
} }
private String downloadPluginPhantomJSFile() throws Exception { private String downloadPluginDependenceFile() throws Exception {
httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind(dependenceID)); httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind(dependenceID));
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
InputStream reader = httpClient.getResponseStream(); InputStream reader = httpClient.getResponseStream();
@ -184,12 +184,12 @@ public class DownLoadDependenceUI implements ActionListener {
} }
} }
public void installPhantomJsOnline(){ public void installDependenceOnline(){
try { try {
String filePath = downloadPluginPhantomJSFile(); String filePath = downloadPluginDependenceFile();
if (!StringUtils.EMPTY.equals(filePath)){ if (!StringUtils.EMPTY.equals(filePath)){
//安装文件 //安装文件
installPluginPhantomJsFile(filePath); installPluginDependenceFile(filePath);
result = true; result = true;
} }
} catch (Exception e) { } catch (Exception e) {
@ -198,7 +198,7 @@ public class DownLoadDependenceUI implements ActionListener {
} }
//安装已经下载好的文件 //安装已经下载好的文件
private void installPluginPhantomJsFile(String filePath){ private void installPluginDependenceFile(String filePath){
IOUtils.unzip(new File(filePath), dependenceDir); IOUtils.unzip(new File(filePath), dependenceDir);
} }
@ -224,10 +224,10 @@ public class DownLoadDependenceUI implements ActionListener {
} }
//安装依赖环境 //安装依赖环境
if (install()){ if (install()){
JOptionPane.showMessageDialog(null, dependenceID + Inter.getLocText("Install_Succeed") + "!!"); JOptionPane.showMessageDialog(null, dependenceID + Inter.getLocText("FR-Designer-Dependence_Install_Succeed") + "!!");
return true; return true;
}else { }else {
JOptionPane.showMessageDialog(null, dependenceID + Inter.getLocText("Install_Failed") + "!!", "alert", JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, dependenceID + Inter.getLocText("FR-Designer-Dependence_Install_Failed") + "!!", "alert", JOptionPane.ERROR_MESSAGE);
return false; return false;
} }
}else {//不安装。无需为用户准备环境 }else {//不安装。无需为用户准备环境

Loading…
Cancel
Save