Browse Source

冲突

master
juhaoyu 8 years ago
parent
commit
2594dc627e
  1. 45
      designer_base/src/com/fr/design/extra/PluginOperateUtils.java
  2. 4
      designer_base/src/com/fr/design/extra/PluginStoreConstants.java
  3. 9
      designer_base/src/com/fr/design/extra/PluginUtils.java
  4. 3
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  5. 84
      designer_base/src/com/fr/design/extra/WebViewDlgHelper.java
  6. 29
      designer_base/src/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java
  7. 37
      designer_base/src/com/fr/design/extra/exe/callback/InstallOnlineCallback.java
  8. 19
      designer_base/src/com/fr/design/extra/exe/callback/JSCallback.java
  9. 8
      designer_base/src/com/fr/design/extra/exe/callback/JSExecutor.java
  10. 1
      designer_base/src/com/fr/design/extra/exe/callback/UninstallPluginCallback.java
  11. 29
      designer_base/src/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java
  12. 18
      designer_base/src/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java
  13. 7
      designer_base/src/com/fr/design/locale/designer.properties
  14. 7
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  15. 7
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  16. 7
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  17. 11
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  18. 7
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties

45
designer_base/src/com/fr/design/extra/PluginOperateUtils.java

@ -6,6 +6,7 @@ import com.fr.design.extra.exe.callback.*;
import com.fr.design.extra.exe.extratask.InstallPluginTask;
import com.fr.design.extra.exe.extratask.UpdatePluginTask;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
@ -19,6 +20,7 @@ import com.fr.plugin.manage.control.PluginTaskCallback;
import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.io.File;
import java.util.List;
@ -28,12 +30,11 @@ import java.util.List;
*/
public class PluginOperateUtils {
public static void installPluginOnline(final String pluginInfo, JSCallback jsCallback) {
public static void installPluginOnline(final PluginMarker pluginMarker, JSCallback jsCallback) {
//下载插件
if (!BBSPluginLogin.getInstance().hasLogin()) {
LoginCheckContext.fireLoginCheckListener();
}
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
if (BBSPluginLogin.getInstance().hasLogin()) {
PluginManager.getController().download(pluginMarker, new DownloadCallback(new InstallPluginTask(pluginMarker, jsCallback), jsCallback));
}
@ -43,29 +44,36 @@ public class PluginOperateUtils {
PluginManager.getController().install(zipFile, new InstallFromDiskCallback(zipFile, jsCallback));
}
public static void updatePluginOnline(List<PluginMarker> pluginMarkerList, JSCallback jsCallback) {
if (!(BBSPluginLogin.getInstance().hasLogin())) {
LoginCheckContext.fireLoginCheckListener();
}
if (BBSPluginLogin.getInstance().hasLogin()) {
for (int i = 0; i < pluginMarkerList.size(); i++) {
try {
JSONObject latestPluginInfo = PluginUtils.getLatestPluginInfo(pluginMarkerList.get(i).getPluginID());
String latestPluginVersion = (String) latestPluginInfo.get("version");
PluginMarker pluginMarker = pluginMarkerList.get(i);
PluginMarker toPluginMarker = PluginMarker.create(pluginMarkerList.get(i).getPluginID(), latestPluginVersion);
PluginManager.getController().download(pluginMarkerList.get(i), new DownloadCallback(new UpdatePluginTask(pluginMarker, toPluginMarker, jsCallback), jsCallback));
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
updatePluginOnline(pluginMarkerList.get(i), jsCallback);
}
}
}
public static void updatePluginOnline(PluginMarker pluginMarker, JSCallback jsCallback) {
try {
JSONObject latestPluginInfo = PluginUtils.getLatestPluginInfo(pluginMarker.getPluginID());
String latestPluginVersion = (String) latestPluginInfo.get("version");
PluginMarker toPluginMarker = PluginMarker.create(pluginMarker.getPluginID(), latestPluginVersion);
PluginManager.getController().download(toPluginMarker, new DownloadCallback(new UpdatePluginTask(pluginMarker, toPluginMarker, jsCallback), jsCallback));
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
public static void updatePluginFromDisk(final String filePath, JSCallback jsCallback) {
PluginManager.getController().update(new File(filePath), new UpdateFromDiskCallback(new File(filePath), jsCallback));
}
public static void setPluginActive(String pluginInfo, JSCallback jsCallback) {
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
PluginContext plugin = PluginManager.getContext(pluginMarker);
@ -79,8 +87,17 @@ public class PluginOperateUtils {
}
public static void uninstallPlugin(final String pluginInfo, final boolean isForce, JSCallback jsCallback) {
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
PluginManager.getController().uninstall(pluginMarker, isForce, new UninstallPluginCallback(pluginMarker, jsCallback));
int rv = JOptionPane.showConfirmDialog(
null,
Inter.getLocText("FR-Designer-Plugin_Delete_Confirmed"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE
);
if (rv == JOptionPane.OK_OPTION) {
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
PluginManager.getController().uninstall(pluginMarker, isForce, new UninstallPluginCallback(pluginMarker, jsCallback));
}
}
public static void readUpdateOnline(final JSCallback jsCallback) {
@ -237,7 +254,7 @@ public class PluginOperateUtils {
}
public static void getLoginInfo(JSCallback jsCallback) {
if (!BBSPluginLogin.getInstance().hasLogin()) {
String userName = DesignerEnvManager.getEnvManager().getBBSName();
String password = DesignerEnvManager.getEnvManager().getBBSPassword();

4
designer_base/src/com/fr/design/extra/PluginStoreConstants.java

@ -1,9 +1,9 @@
package com.fr.design.extra;
import com.fr.base.FRContext;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import java.io.File;
import java.io.FileInputStream;
import java.util.Properties;
@ -20,7 +20,7 @@ public class PluginStoreConstants {
if (PROP == null) {
PROP = new Properties();
try {
PROP.load(new FileInputStream(StableUtils.pathJoin(new File(StableUtils.getInstallHome()).getAbsolutePath(), "scripts/store/web/plugin_store.properties")));
PROP.load(new FileInputStream(StableUtils.pathJoin(FRContext.getCurrentEnv().getWebReportPath(), "scripts/store/web/plugin_store.properties")));
} catch (Exception e) {
}
}

9
designer_base/src/com/fr/design/extra/PluginUtils.java

@ -108,12 +108,15 @@ public class PluginUtils {
map.put("id", id);
map.put("username", username);
map.put("password", password);
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.download"), map);
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("shop.plugin.scripts"));
httpClient.asGet();
String resText = httpClient.getResponseText();
JSONObject resultJSONObject = new JSONObject(resText);
String scriptUrl = resultJSONObject.optString("result");
String charSet = EncodeConstants.ENCODING_UTF_8;
resText = URLDecoder.decode(URLDecoder.decode(resText, charSet), charSet);
scriptUrl = URLDecoder.decode(URLDecoder.decode(scriptUrl, charSet), charSet);
return resText;
return scriptUrl;
}
public static boolean isPluginMatch(PluginView pluginView, String text) {

3
designer_base/src/com/fr/design/extra/PluginWebBridge.java

@ -148,7 +148,8 @@ public class PluginWebBridge {
*/
public void installPluginOnline(final String pluginInfo, final JSObject callback) {
JSCallback jsCallback = new JSCallback(webEngine, callback);
PluginOperateUtils.installPluginOnline(pluginInfo, jsCallback);
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
PluginOperateUtils.installPluginOnline(pluginMarker, jsCallback);
}

84
designer_base/src/com/fr/design/extra/WebViewDlgHelper.java

@ -12,12 +12,16 @@ import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONObject;
import com.fr.plugin.PluginVerifyException;
import com.fr.stable.StableUtils;
import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.util.concurrent.ExecutionException;
@ -30,26 +34,30 @@ public class WebViewDlgHelper {
private static final int VERSION_8 = 8;
// 调试时,使用installHome = ClassLoader.getSystemResource("").getPath()代替下面
private static String installHome = StableUtils.getInstallHome();
private static final int BYTES_NUM = 1024;
public static void createPluginDialog() {
if (StableUtils.getMajorJavaVersion() >= VERSION_8) {
String relativePath = "index.html";
String relativePath = "/scripts/store/web/index.html";
String mainJsPath = StableUtils.pathJoin(FRContext.getCurrentEnv().getWebReportPath(), relativePath);
File file = new File(mainJsPath);
if (!file.exists()) {
// int rv = JOptionPane.showConfirmDialog(
// null,
// Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"),
// Inter.getLocText("FR-Designer-Plugin_Warning"),
// JOptionPane.OK_CANCEL_OPTION,
// JOptionPane.INFORMATION_MESSAGE
// );
// if (rv == JOptionPane.OK_OPTION) {
// downloadShopScripts(SHOP_SCRIPTS);
// }
int rv = JOptionPane.showConfirmDialog(
null,
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE
);
if (rv == JOptionPane.OK_OPTION) {
downloadShopScripts(SHOP_SCRIPTS);
}
} else {
String indexPath = "index.html";
String mainIndexPath = StableUtils.pathJoin(FRContext.getCurrentEnv().getWebReportPath(), indexPath);
checkAndCopyMainFile(mainIndexPath, mainJsPath);
updateShopScripts(SHOP_SCRIPTS);
showPluginDlg(mainJsPath);
showPluginDlg(mainIndexPath);
}
} else {
BasicPane traditionalStorePane = new BasicPane() {
@ -65,6 +73,31 @@ public class WebViewDlgHelper {
}
}
/**
* 检查script文件夹中的index.html文件
*
*/
public static void checkAndCopyMainFile(String indexPath, String mainJsPath){
File file = new File(indexPath);
if (!file.exists()) {
try {
File mainJsFile = new File(mainJsPath);
int byteread = 0;
if (mainJsFile.exists()) {
InputStream inStream = new FileInputStream(mainJsPath);
FileOutputStream fs = new FileOutputStream(indexPath);
byte[] buffer = new byte[BYTES_NUM];
while ((byteread = inStream.read(buffer)) != -1) {
fs.write(buffer, 0, byteread);
}
inStream.close();
}
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage());
}
}
}
/**
* 以关键词打开设计器商店
*
@ -181,20 +214,23 @@ public class WebViewDlgHelper {
new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("store.version") + "&version=" + PluginStoreConstants.VERSION);
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("shop.plugin.cv") + "&version=" + PluginStoreConstants.VERSION);
httpClient.asGet();
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
String text = httpClient.getResponseText();
if (!ComparatorUtils.equals(text, LATEST)) {
// int rv = JOptionPane.showConfirmDialog(
// null,
// Inter.getLocText("FR-Designer-Plugin_Shop_Need_Update"),
// Inter.getLocText("FR-Designer-Plugin_Warning"),
// JOptionPane.OK_CANCEL_OPTION,
// JOptionPane.INFORMATION_MESSAGE
// );
// if (rv == JOptionPane.OK_OPTION) {
// downloadShopScripts(scriptsId);
// }
JSONObject resultJSONObject = new JSONObject(text);
String isLatest = resultJSONObject.optString("result");
if (!ComparatorUtils.equals(isLatest, LATEST)) {
int rv = JOptionPane.showConfirmDialog(
null,
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Update"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE
);
if (rv == JOptionPane.OK_OPTION) {
downloadShopScripts(scriptsId);
}
}
}
return null;

29
designer_base/src/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java

@ -1,14 +1,18 @@
package com.fr.design.extra.exe.callback;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.PluginUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.control.PluginTask;
import com.fr.plugin.manage.control.PluginTaskResult;
import javax.swing.*;
import java.io.File;
import java.util.List;
/**
* Created by ibm on 2017/5/26.
@ -31,8 +35,8 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
@Override
public void done(PluginTaskResult result) {
jsCallback.execute("success");
if (result.isSuccess()) {
jsCallback.execute("success");
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Success"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Success"));
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
@ -49,8 +53,29 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
return;
}
List<PluginTask> pluginTasks = result.getPreTasks();
for(PluginTask pluginTask : pluginTasks){
PluginMarker marker = pluginTask.getMarker();
PluginOperateUtils.installPluginOnline(marker, jsCallback);
}
PluginManager.getController().install(zipFile, new InstallFromDiskCallback(zipFile, jsCallback));
} else {
} else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){
int rv = JOptionPane.showOptionDialog(
null,
Inter.getLocText("FR-Designer-Plugin_Has_Install_Lower"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
null,
null
);
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
return;
}
PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback);
}else {
jsCallback.execute("failed");
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Failed"));
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}

37
designer_base/src/com/fr/design/extra/exe/callback/InstallOnlineCallback.java

@ -1,14 +1,18 @@
package com.fr.design.extra.exe.callback;
import com.fr.design.extra.PluginUtils;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.control.PluginTask;
import com.fr.plugin.manage.control.PluginTaskResult;
import javax.swing.*;
import java.util.List;
/**
* Created by ibm on 2017/5/26.
@ -30,10 +34,12 @@ public class InstallOnlineCallback extends AbstractPluginTaskCallback {
@Override
public void done(PluginTaskResult result) {
jsCallback.execute("success");
if (result.isSuccess()) {
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Success"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Success"));
PluginContext pluginContext = PluginManager.getContext(pluginMarker);
String pluginName = pluginContext.getName();
jsCallback.execute("success");
FRLogger.getLogger().info(pluginName + Inter.getLocText("FR-Designer-Plugin_Install_Success"));
JOptionPane.showMessageDialog(null, pluginName + Inter.getLocText("FR-Designer-Plugin_Install_Success"));
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
int rv = JOptionPane.showOptionDialog(
null,
@ -48,9 +54,30 @@ public class InstallOnlineCallback extends AbstractPluginTaskCallback {
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
return;
}
List<PluginTask> pluginTasks = result.getPreTasks();
for(PluginTask pluginTask : pluginTasks){
PluginMarker marker = pluginTask.getMarker();
PluginOperateUtils.installPluginOnline(marker, jsCallback );
}
//执行JS回调
PluginManager.getController().install(pluginMarker, new InstallOnlineCallback(pluginMarker, jsCallback));
} else {
PluginOperateUtils.installPluginOnline(pluginMarker, jsCallback);
} else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){
int rv = JOptionPane.showOptionDialog(
null,
Inter.getLocText("FR-Designer-Plugin_Has_Install_Lower"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
null,
null
);
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
return;
}
PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback);
}else {
jsCallback.execute("failed");
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Failed"));
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}

19
designer_base/src/com/fr/design/extra/exe/callback/JSCallback.java

@ -2,9 +2,6 @@ package com.fr.design.extra.exe.callback;
import com.fr.stable.StringUtils;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Task;
import javafx.scene.web.WebEngine;
import netscape.javascript.JSObject;
@ -14,17 +11,18 @@ import java.util.regex.Pattern;
/**
* Created by ibm on 2017/5/27.
*/
public class JSCallback<T> extends Task<T> {
public class JSCallback {
private JSExecutor executeScript;
public JSCallback(final WebEngine webEngine, final JSObject callback) {
init(webEngine, callback);
}
public void init(final WebEngine webEngine, final JSObject callback){
messageProperty().addListener(new ChangeListener<String>() {
executeScript = new JSExecutor() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, final String newValue) {
public void executor(String newValue) {
Platform.runLater(new Runnable() {
@Override
public void run() {
@ -37,15 +35,11 @@ public class JSCallback<T> extends Task<T> {
}
});
}
});
}
@Override
protected T call() throws Exception {
return null;
};
}
public void execute(String newValue) {
updateMessage(newValue);
executeScript.executor(newValue);
}
@ -88,5 +82,6 @@ public class JSCallback<T> extends Task<T> {
}
}

8
designer_base/src/com/fr/design/extra/exe/callback/JSExecutor.java

@ -0,0 +1,8 @@
package com.fr.design.extra.exe.callback;
/**
* Created by ibm on 2017/6/21.
*/
public interface JSExecutor {
void executor(String newValue);
}

1
designer_base/src/com/fr/design/extra/exe/callback/UninstallPluginCallback.java

@ -43,6 +43,7 @@ public class UninstallPluginCallback extends AbstractPluginTaskCallback {
}
PluginManager.getController().uninstall(pluginMarker, true, new UninstallPluginCallback(pluginMarker, jsCallback));
} else {
jsCallback.execute("failed");
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Delete_Failed"));
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}

29
designer_base/src/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java

@ -1,14 +1,18 @@
package com.fr.design.extra.exe.callback;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.PluginUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.control.PluginTask;
import com.fr.plugin.manage.control.PluginTaskResult;
import javax.swing.*;
import java.io.File;
import java.util.List;
/**
* Created by ibm on 2017/5/27.
@ -31,8 +35,8 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
@Override
public void done(PluginTaskResult result) {
jsCallback.execute("success");
if (result.isSuccess()) {
jsCallback.execute("success");
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Update_Success"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Update_Success"));
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
@ -49,8 +53,29 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
return;
}
List<PluginTask> pluginTasks = result.getPreTasks();
for(PluginTask pluginTask : pluginTasks){
PluginMarker marker = pluginTask.getMarker();
PluginOperateUtils.updatePluginOnline(marker, jsCallback);
}
PluginManager.getController().update(zipFile, new UpdateFromDiskCallback(zipFile, jsCallback));
} else {
} else if(result.errorCode() == PluginErrorCode.NoPluginToUpdate){
int rv = JOptionPane.showOptionDialog(
null,
Inter.getLocText("FR-Designer-Plugin_No_Plugin_Update"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
null,
null
);
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
return;
}
PluginOperateUtils.installPluginFromDisk(zipFile, jsCallback);
}else {
jsCallback.execute("failed");
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Update_Failed"));
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}

18
designer_base/src/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java

@ -1,14 +1,18 @@
package com.fr.design.extra.exe.callback;
import com.fr.design.extra.PluginUtils;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.control.PluginTask;
import com.fr.plugin.manage.control.PluginTaskResult;
import javax.swing.*;
import java.util.List;
/**
* Created by ibm on 2017/5/26.
@ -31,10 +35,12 @@ public class UpdateOnlineCallback extends AbstractPluginTaskCallback {
@Override
public void done(PluginTaskResult result) {
jsCallback.execute("success");
if (result.isSuccess()) {
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Update_Success"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Update_Success"));
PluginContext pluginContext = PluginManager.getContext(toPluginMarker);
String pluginName = pluginContext.getName();
jsCallback.execute("success");
FRLogger.getLogger().info(pluginName + Inter.getLocText("FR-Designer-Plugin_Update_Success"));
JOptionPane.showMessageDialog(null,pluginName + Inter.getLocText("FR-Designer-Plugin_Update_Success"));
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
int rv = JOptionPane.showOptionDialog(
null,
@ -49,8 +55,14 @@ public class UpdateOnlineCallback extends AbstractPluginTaskCallback {
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
return;
}
List<PluginTask> pluginTasks = result.getPreTasks();
for(PluginTask pluginTask : pluginTasks){
PluginMarker marker = pluginTask.getMarker();
PluginOperateUtils.updatePluginOnline(marker, jsCallback);
}
PluginManager.getController().update(pluginMarker, toPluginMarker, new UpdateOnlineCallback(pluginMarker, toPluginMarker, jsCallback));
} else {
jsCallback.execute("failed");
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Update_Failed"));
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}

7
designer_base/src/com/fr/design/locale/designer.properties

@ -2005,7 +2005,14 @@ FR-Designer-Alphafine_No_Remind=
FR-Designer-Plugin_Install_Success=
FR-Designer-Plugin_Install_Failed=
FR-Designer-Plugin_Install_Dependence=
FR-Designer-Plugin_Has_Install_Lower=
FR-Designer-Plugin_No_Plugin_Update=
FR-Designer-Plugin-Install_Package=
FR-Designer-Plugin-Update_Dependence_Success=
FR-Designer-Plugin-Update_Dependence_Failed=
FR-Designer-Plugin-Install_Dependence_Success=
FR-Designer-Plugin-Install_Dependence_Failed=
FR-Designer-Plugin_Delete_Confirmed=
FR-Designer-Plugin_Delete_Dependence=
FR-Designer-Plugin_Delete_Success=
FR-Designer-Plugin_Delete_Failed=

7
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -2003,7 +2003,14 @@ FR-Designer-Alphafine_No_Remind=don't remind
Designer-Plugin_Install_Success=
FR-Designer-Plugin_Install_Failed=
FR-Designer-Plugin_Install_Dependence=
FR-Designer-Plugin_Has_Install_Lower=
FR-Designer-Plugin_No_Plugin_Update=
FR-Designer-Plugin-Install_Package=
FR-Designer-Plugin-Update_Dependence_Success=
FR-Designer-Plugin-Update_Dependence_Failed=
FR-Designer-Plugin-Install_Dependence_Success=
FR-Designer-Plugin-Install_Dependence_Failed=
FR-Designer-Plugin_Delete_Confirmed=
FR-Designer-Plugin_Delete_Dependence=
FR-Designer-Plugin_Delete_Success=
FR-Designer-Plugin_Delete_Failed=

7
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -1985,7 +1985,14 @@ FormulaD-Data_Fields=\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9
Designer-Plugin_Install_Success=
FR-Designer-Plugin_Install_Failed=
FR-Designer-Plugin_Install_Dependence=
FR-Designer-Plugin_Has_Install_Lower=
FR-Designer-Plugin_No_Plugin_Update=
FR-Designer-Plugin-Install_Package=
FR-Designer-Plugin-Update_Dependence_Success=
FR-Designer-Plugin-Update_Dependence_Failed=
FR-Designer-Plugin-Install_Dependence_Success=
FR-Designer-Plugin-Install_Dependence_Failed=
FR-Designer-Plugin_Delete_Confirmed=
FR-Designer-Plugin_Delete_Dependence=
FR-Designer-Plugin_Delete_Success=
FR-Designer-Plugin_Delete_Failed=

7
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -1986,7 +1986,14 @@ FormulaD-Data_Fields=\uB370\uC774\uD130\uD56D\uBAA9
Designer-Plugin_Install_Success=
FR-Designer-Plugin_Install_Failed=
FR-Designer-Plugin_Install_Dependence=
FR-Designer-Plugin_Has_Install_Lower=
FR-Designer-Plugin_No_Plugin_Update=
FR-Designer-Plugin-Install_Package=
FR-Designer-Plugin-Update_Dependence_Success=
FR-Designer-Plugin-Update_Dependence_Failed=
FR-Designer-Plugin-Install_Dependence_Success=
FR-Designer-Plugin-Install_Dependence_Failed=
FR-Designer-Plugin_Delete_Confirmed=
FR-Designer-Plugin_Delete_Dependence=
FR-Designer-Plugin_Delete_Success=
FR-Designer-Plugin_Delete_Failed=

11
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -2001,12 +2001,19 @@ FR-Designer_Alphafine=AlphaFine\u667A\u80FD\u641C\u7D22
FR-Designer-Alphafine_No_Remind=\u4E0D\u518D\u63D0\u793A
FR-Designer-Plugin_Install_Success=\u63D2\u4EF6\u5B89\u88C5\u6210\u529F
FR-Designer-Plugin_Install_Failed=\u63D2\u4EF6\u5B89\u88C5\u5931\u8D25
FR-Designer-Plugin_Install_Dependence=\u662F\u5426\u5B89\u88C5\u4F9D\u8D56\u73AF\u5883
FR-Designer-Plugin_Install_Dependence=\u662F\u5426\u5B89\u88C5\u4F9D\u8D56\u63D2\u4EF6
FR-Designer-Plugin_Has_Install_Lower=\u5DF2\u7ECF\u5B89\u88C5\u4F4E\u7248\u672C\u63D2\u4EF6\uFF0C\u662F\u5426\u8FDB\u884C\u66F4\u65B0\uFF1F
FR-Designer-Plugin_No_Plugin_Update=\u6CA1\u6709\u627E\u5230\u5BF9\u5E94\u7684\u63D2\u4EF6\uFF0C\u662F\u5426\u5B89\u88C5\uFF1F
FR-Designer-Plugin-Install_Package=\u63D2\u4EF6\u5B89\u88C5\u5305
FR-Designer-Plugin-Update_Dependence_Success=\u4F9D\u8D56\u63D2\u4EF6\u66F4\u65B0\u6210\u529F
FR-Designer-Plugin-Update_Dependence_Failed=\u4F9D\u8D56\u63D2\u4EF6\u66F4\u65B0\u5931\u8D25
FR-Designer-Plugin-Install_Dependence_Success=\u4F9D\u8D56\u63D2\u4EF6\u5B89\u88C5\u6210\u529F
FR-Designer-Plugin-Install_Dependence_Failed=\u4F9D\u8D56\u63D2\u4EF6\u5B89\u88C5\u5931\u8D25
FR-Designer-Plugin_Delete_Confirmed=\u786E\u5B9A\u5220\u9664\u6B64\u63D2\u4EF6\uFF1F
FR-Designer-Plugin_Delete_Dependence=\u662F\u5426\u5220\u9664\u4F9D\u8D56\u73AF\u5883
FR-Designer-Plugin_Delete_Success=\u63D2\u4EF6\u5220\u9664\u6210\u529F
FR-Designer-Plugin_Delete_Failed=\u63D2\u4EF6\u5220\u9664\u5931\u8D25
FR-Designer-Plugin_Update_Dependence=\u662F\u5426\u66F4\u65B0\u4F9D\u8D56\u73AF\u5883
FR-Designer-Plugin_Update_Dependence=\u662F\u5426\u66F4\u65B0\u4F9D\u8D56\u63D2\u4EF6
FR-Designer-Plugin_Update_Success=\u63D2\u4EF6\u66F4\u65B0\u6210\u529F
FR-Designer-Plugin_Update_Failed=\u63D2\u4EF6\u66F4\u65B0\u5931\u8D25
FR-Designer-Plugin_Actived=\u63D2\u4EF6\u5DF2\u88AB\u542F\u7528

7
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -2003,7 +2003,14 @@ FR-Designer-Alphafine_No_Remind=\u4E0D\u518D\u63D0\u793A
Designer-Plugin_Install_Success=
FR-Designer-Plugin_Install_Failed=
FR-Designer-Plugin_Install_Dependence=
FR-Designer-Plugin_Has_Install_Lower=
FR-Designer-Plugin_No_Plugin_Update=
FR-Designer-Plugin-Install_Package=
FR-Designer-Plugin-Update_Dependence_Success=
FR-Designer-Plugin-Update_Dependence_Failed=
FR-Designer-Plugin-Install_Dependence_Success=
FR-Designer-Plugin-Install_Dependence_Failed=
FR-Designer-Plugin_Delete_Confirmed=
FR-Designer-Plugin_Delete_Dependence=
FR-Designer-Plugin_Delete_Success=
FR-Designer-Plugin_Delete_Failed=

Loading…
Cancel
Save