Browse Source

REPORT-2354 将平台的插件管理和设计器的插件管理统一起来

master
kerry 8 years ago
parent
commit
18840749a4
  1. 59
      designer_base/src/com/fr/design/extra/PluginOperateUtils.java
  2. 3
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  3. 38
      designer_base/src/com/fr/design/extra/exe/callback/InstallDependenceCallback.java
  4. 29
      designer_base/src/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java
  5. 31
      designer_base/src/com/fr/design/extra/exe/callback/InstallOnlineCallback.java
  6. 1
      designer_base/src/com/fr/design/extra/exe/callback/UninstallPluginCallback.java
  7. 39
      designer_base/src/com/fr/design/extra/exe/callback/UpdateDependenceCallback.java
  8. 29
      designer_base/src/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java
  9. 11
      designer_base/src/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java
  10. 24
      designer_base/src/com/fr/design/extra/exe/extratask/InstallDependenceTask.java
  11. 26
      designer_base/src/com/fr/design/extra/exe/extratask/UpdateDependenceTask.java
  12. 7
      designer_base/src/com/fr/design/locale/designer.properties
  13. 7
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  14. 7
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  15. 7
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  16. 7
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  17. 7
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties

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

@ -3,9 +3,12 @@ package com.fr.design.extra;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.extra.exe.callback.*; import com.fr.design.extra.exe.callback.*;
import com.fr.design.extra.exe.extratask.InstallDependenceTask;
import com.fr.design.extra.exe.extratask.InstallPluginTask; import com.fr.design.extra.exe.extratask.InstallPluginTask;
import com.fr.design.extra.exe.extratask.UpdateDependenceTask;
import com.fr.design.extra.exe.extratask.UpdatePluginTask; import com.fr.design.extra.exe.extratask.UpdatePluginTask;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
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.json.JSONArray; import com.fr.json.JSONArray;
@ -19,6 +22,7 @@ import com.fr.plugin.manage.control.PluginTaskCallback;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
@ -28,12 +32,11 @@ import java.util.List;
*/ */
public class PluginOperateUtils { 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()) { if (!BBSPluginLogin.getInstance().hasLogin()) {
LoginCheckContext.fireLoginCheckListener(); LoginCheckContext.fireLoginCheckListener();
} }
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
if (BBSPluginLogin.getInstance().hasLogin()) { if (BBSPluginLogin.getInstance().hasLogin()) {
PluginManager.getController().download(pluginMarker, new DownloadCallback(new InstallPluginTask(pluginMarker, jsCallback), jsCallback)); PluginManager.getController().download(pluginMarker, new DownloadCallback(new InstallPluginTask(pluginMarker, jsCallback), jsCallback));
} }
@ -43,29 +46,50 @@ public class PluginOperateUtils {
PluginManager.getController().install(zipFile, new InstallFromDiskCallback(zipFile, jsCallback)); PluginManager.getController().install(zipFile, new InstallFromDiskCallback(zipFile, jsCallback));
} }
public static void installPluginDependence(PluginMarker pluginMarker, JSCallback jsCallback){
PluginManager.getController().download(pluginMarker, new DownloadCallback(new InstallDependenceTask(pluginMarker, jsCallback), jsCallback));
}
public static void updatePluginOnline(List<PluginMarker> pluginMarkerList, JSCallback jsCallback) { public static void updatePluginOnline(List<PluginMarker> pluginMarkerList, JSCallback jsCallback) {
if (!(BBSPluginLogin.getInstance().hasLogin())) { if (!(BBSPluginLogin.getInstance().hasLogin())) {
LoginCheckContext.fireLoginCheckListener(); LoginCheckContext.fireLoginCheckListener();
} }
if (BBSPluginLogin.getInstance().hasLogin()) { if (BBSPluginLogin.getInstance().hasLogin()) {
for (int i = 0; i < pluginMarkerList.size(); i++) { for (int i = 0; i < pluginMarkerList.size(); i++) {
try { updatePluginOnline(pluginMarkerList.get(i), jsCallback);
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);
}
} }
} }
} }
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(pluginMarker, 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) { public static void updatePluginFromDisk(final String filePath, JSCallback jsCallback) {
PluginManager.getController().update(new File(filePath), new UpdateFromDiskCallback(new File(filePath), jsCallback)); PluginManager.getController().update(new File(filePath), new UpdateFromDiskCallback(new File(filePath), jsCallback));
} }
public static void updatePluginDependence(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(pluginMarker, new DownloadCallback(new UpdateDependenceTask(pluginMarker, toPluginMarker, jsCallback), jsCallback));
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
public static void setPluginActive(String pluginInfo, JSCallback jsCallback) { public static void setPluginActive(String pluginInfo, JSCallback jsCallback) {
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
PluginContext plugin = PluginManager.getContext(pluginMarker); PluginContext plugin = PluginManager.getContext(pluginMarker);
@ -79,8 +103,17 @@ public class PluginOperateUtils {
} }
public static void uninstallPlugin(final String pluginInfo, final boolean isForce, JSCallback jsCallback) { public static void uninstallPlugin(final String pluginInfo, final boolean isForce, JSCallback jsCallback) {
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); int rv = JOptionPane.showConfirmDialog(
PluginManager.getController().uninstall(pluginMarker, isForce, new UninstallPluginCallback(pluginMarker, jsCallback)); 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) { public static void readUpdateOnline(final JSCallback jsCallback) {

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) { public void installPluginOnline(final String pluginInfo, final JSObject callback) {
JSCallback jsCallback = new JSCallback(webEngine, callback); JSCallback jsCallback = new JSCallback(webEngine, callback);
PluginOperateUtils.installPluginOnline(pluginInfo, jsCallback); PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
PluginOperateUtils.installPluginOnline(pluginMarker, jsCallback);
} }

38
designer_base/src/com/fr/design/extra/exe/callback/InstallDependenceCallback.java

@ -0,0 +1,38 @@
package com.fr.design.extra.exe.callback;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.manage.control.PluginTaskResult;
import javax.swing.*;
/**
* Created by ibm on 2017/6/21.
*/
public class InstallDependenceCallback extends AbstractPluginTaskCallback {
protected JSCallback jsCallback;
private static int HUNDRED_PERCENT = 100;
public InstallDependenceCallback(PluginMarker pluginMarker, JSCallback jsCallback){
this.pluginMarker = pluginMarker;
this.jsCallback = jsCallback;
}
@Override
public void updateProgress(String description, double aProgress) {
jsCallback.execute(String.valueOf(aProgress * HUNDRED_PERCENT + "%"));
}
@Override
public void done(PluginTaskResult result) {
if (result.isSuccess()) {
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin-Install_Dependence_Success"));
}else {
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin-Install_Dependence_Failed"));
JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
}
}

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

@ -1,13 +1,17 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode; import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.control.PluginTask;
import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.manage.control.PluginTaskResult;
import javax.swing.*; import javax.swing.*;
import java.io.File; import java.io.File;
import java.util.List;
/** /**
* Created by ibm on 2017/5/26. * Created by ibm on 2017/5/26.
@ -30,8 +34,8 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
jsCallback.execute("success");
if (result.isSuccess()) { if (result.isSuccess()) {
jsCallback.execute("success");
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Success")); FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Success"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Success")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Success"));
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) { } else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
@ -48,8 +52,29 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
return; return;
} }
List<PluginTask> pluginTasks = result.getPreTasks();
for(PluginTask pluginTask : pluginTasks){
PluginMarker marker = pluginTask.getMarker();
PluginOperateUtils.installPluginDependence(marker, jsCallback);
}
PluginManager.getController().install(zipFile, new InstallFromDiskCallback(zipFile, 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")); FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Failed"));
JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }

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

@ -1,13 +1,15 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode; 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 com.fr.plugin.manage.control.PluginTaskResult;
import javax.swing.*; import javax.swing.*;
import java.util.List;
/** /**
* Created by ibm on 2017/5/26. * Created by ibm on 2017/5/26.
@ -29,8 +31,8 @@ public class InstallOnlineCallback extends AbstractPluginTaskCallback {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
jsCallback.execute("success");
if (result.isSuccess()) { if (result.isSuccess()) {
jsCallback.execute("success");
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Success")); FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Success"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Success")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Success"));
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) { } else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
@ -47,9 +49,30 @@ public class InstallOnlineCallback extends AbstractPluginTaskCallback {
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
return; return;
} }
List<PluginTask> pluginTasks = result.getPreTasks();
for(PluginTask pluginTask : pluginTasks){
PluginMarker marker = pluginTask.getMarker();
PluginOperateUtils.installPluginDependence(marker, jsCallback );
}
//执行JS回调 //执行JS回调
PluginManager.getController().install(pluginMarker, new InstallOnlineCallback(pluginMarker, jsCallback)); PluginOperateUtils.installPluginOnline(pluginMarker, 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")); FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Failed"));
JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }

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

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

39
designer_base/src/com/fr/design/extra/exe/callback/UpdateDependenceCallback.java

@ -0,0 +1,39 @@
package com.fr.design.extra.exe.callback;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.manage.control.PluginTaskResult;
import javax.swing.*;
/**
* Created by ibm on 2017/6/21.
*/
public class UpdateDependenceCallback extends AbstractPluginTaskCallback {
public PluginMarker toPluginMarker;
protected JSCallback jsCallback;
private static int HUNDRED_PERCENT = 100;
public UpdateDependenceCallback(PluginMarker pluginMarker, PluginMarker toPluginMarker, JSCallback jsCallback){
this.pluginMarker = pluginMarker;
this.toPluginMarker = toPluginMarker;
this.jsCallback = jsCallback;
}
@Override
public void updateProgress(String description, double aProgress) {
jsCallback.execute(String.valueOf(aProgress * HUNDRED_PERCENT + "%"));
}
@Override
public void done(PluginTaskResult result) {
if (result.isSuccess()) {
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin-Update_Dependence_Success"));
}else {
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin-Update_Dependence_Failed"));
JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
}
}

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

@ -1,13 +1,17 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode; import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.control.PluginTask;
import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.manage.control.PluginTaskResult;
import javax.swing.*; import javax.swing.*;
import java.io.File; import java.io.File;
import java.util.List;
/** /**
* Created by ibm on 2017/5/27. * Created by ibm on 2017/5/27.
@ -30,8 +34,8 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
jsCallback.execute("success");
if (result.isSuccess()) { if (result.isSuccess()) {
jsCallback.execute("success");
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Update_Success")); FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Update_Success"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Update_Success")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Update_Success"));
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) { } else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
@ -48,8 +52,29 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
return; return;
} }
List<PluginTask> pluginTasks = result.getPreTasks();
for(PluginTask pluginTask : pluginTasks){
PluginMarker marker = pluginTask.getMarker();
PluginOperateUtils.updatePluginDependence(marker, jsCallback);
}
PluginManager.getController().update(zipFile, new UpdateFromDiskCallback(zipFile, 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")); FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Update_Failed"));
JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }

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

@ -1,13 +1,16 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode; import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.control.PluginTask;
import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.manage.control.PluginTaskResult;
import javax.swing.*; import javax.swing.*;
import java.util.List;
/** /**
* Created by ibm on 2017/5/26. * Created by ibm on 2017/5/26.
@ -30,8 +33,8 @@ public class UpdateOnlineCallback extends AbstractPluginTaskCallback {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
jsCallback.execute("success");
if (result.isSuccess()) { if (result.isSuccess()) {
jsCallback.execute("success");
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Update_Success")); FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Update_Success"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Update_Success")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Update_Success"));
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) { } else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
@ -48,8 +51,14 @@ public class UpdateOnlineCallback extends AbstractPluginTaskCallback {
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
return; return;
} }
List<PluginTask> pluginTasks = result.getPreTasks();
for(PluginTask pluginTask : pluginTasks){
PluginMarker marker = pluginTask.getMarker();
PluginOperateUtils.updatePluginDependence(marker, jsCallback);
}
PluginManager.getController().update(pluginMarker, toPluginMarker, new UpdateOnlineCallback(pluginMarker, toPluginMarker, jsCallback)); PluginManager.getController().update(pluginMarker, toPluginMarker, new UpdateOnlineCallback(pluginMarker, toPluginMarker, jsCallback));
} else { } else {
jsCallback.execute("failed");
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Update_Failed")); FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Update_Failed"));
JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }

24
designer_base/src/com/fr/design/extra/exe/extratask/InstallDependenceTask.java

@ -0,0 +1,24 @@
package com.fr.design.extra.exe.extratask;
import com.fr.design.extra.exe.callback.InstallDependenceCallback;
import com.fr.design.extra.exe.callback.JSCallback;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.manage.PluginManager;
/**
* Created by ibm on 2017/6/21.
*/
public class InstallDependenceTask extends AbstractExtraPluginTask {
protected JSCallback jsCallback;
public InstallDependenceTask(PluginMarker pluginMarker, JSCallback jsCallback) {
this.pluginMarker = pluginMarker;
this.jsCallback = jsCallback;
}
@Override
public void doExtraPluginTask() {
PluginManager.getController().install(pluginMarker, new InstallDependenceCallback(pluginMarker, jsCallback));
}
}

26
designer_base/src/com/fr/design/extra/exe/extratask/UpdateDependenceTask.java

@ -0,0 +1,26 @@
package com.fr.design.extra.exe.extratask;
import com.fr.design.extra.exe.callback.JSCallback;
import com.fr.design.extra.exe.callback.UpdateDependenceCallback;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.manage.PluginManager;
/**
* Created by ibm on 2017/6/21.
*/
public class UpdateDependenceTask extends AbstractExtraPluginTask {
public PluginMarker toPluginMarker;
protected JSCallback jsCallback;
public UpdateDependenceTask(PluginMarker pluginMarker, PluginMarker toPluginMarker, JSCallback jsCallback) {
this.pluginMarker = pluginMarker;
this.toPluginMarker = toPluginMarker;
this.jsCallback = jsCallback;
}
@Override
public void doExtraPluginTask() {
PluginManager.getController().update(pluginMarker, toPluginMarker, new UpdateDependenceCallback(pluginMarker, toPluginMarker, jsCallback));
}
}

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_Success=
FR-Designer-Plugin_Install_Failed= FR-Designer-Plugin_Install_Failed=
FR-Designer-Plugin_Install_Dependence= 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-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_Dependence=
FR-Designer-Plugin_Delete_Success= FR-Designer-Plugin_Delete_Success=
FR-Designer-Plugin_Delete_Failed= 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= Designer-Plugin_Install_Success=
FR-Designer-Plugin_Install_Failed= FR-Designer-Plugin_Install_Failed=
FR-Designer-Plugin_Install_Dependence= 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-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_Dependence=
FR-Designer-Plugin_Delete_Success= FR-Designer-Plugin_Delete_Success=
FR-Designer-Plugin_Delete_Failed= 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= Designer-Plugin_Install_Success=
FR-Designer-Plugin_Install_Failed= FR-Designer-Plugin_Install_Failed=
FR-Designer-Plugin_Install_Dependence= 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-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_Dependence=
FR-Designer-Plugin_Delete_Success= FR-Designer-Plugin_Delete_Success=
FR-Designer-Plugin_Delete_Failed= 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= Designer-Plugin_Install_Success=
FR-Designer-Plugin_Install_Failed= FR-Designer-Plugin_Install_Failed=
FR-Designer-Plugin_Install_Dependence= 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-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_Dependence=
FR-Designer-Plugin_Delete_Success= FR-Designer-Plugin_Delete_Success=
FR-Designer-Plugin_Delete_Failed= FR-Designer-Plugin_Delete_Failed=

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

@ -2002,7 +2002,14 @@ FR-Designer-Alphafine_No_Remind=\u4E0D\u518D\u63D0\u793A
FR-Designer-Plugin_Install_Success=\u63D2\u4EF6\u5B89\u88C5\u6210\u529F 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_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\u73AF\u5883
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-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_Dependence=\u662F\u5426\u5220\u9664\u4F9D\u8D56\u73AF\u5883
FR-Designer-Plugin_Delete_Success=\u63D2\u4EF6\u5220\u9664\u6210\u529F 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_Delete_Failed=\u63D2\u4EF6\u5220\u9664\u5931\u8D25

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= Designer-Plugin_Install_Success=
FR-Designer-Plugin_Install_Failed= FR-Designer-Plugin_Install_Failed=
FR-Designer-Plugin_Install_Dependence= 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-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_Dependence=
FR-Designer-Plugin_Delete_Success= FR-Designer-Plugin_Delete_Success=
FR-Designer-Plugin_Delete_Failed= FR-Designer-Plugin_Delete_Failed=

Loading…
Cancel
Save