From 47138c4840c132eb3228af6f320c4cedd9beb6b7 Mon Sep 17 00:00:00 2001 From: kerry Date: Sat, 27 May 2017 14:39:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9PMD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extra/exe/InstallFromDiskExecutor.java | 20 +++++++++---------- .../extra/exe/InstallOnlineExecutor.java | 12 +++++------ .../design/extra/exe/UninstallExecutor.java | 4 ++-- .../extra/exe/UpdateFromDiskExecutor.java | 5 ++--- .../extra/exe/UpdateOnlineExecutor.java | 11 ++++------ .../exe/callback/UpdateOnlineCallback.java | 4 ++-- 6 files changed, 26 insertions(+), 30 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/exe/InstallFromDiskExecutor.java b/designer_base/src/com/fr/design/extra/exe/InstallFromDiskExecutor.java index 5e7f5e2b82..3d5629a3c2 100644 --- a/designer_base/src/com/fr/design/extra/exe/InstallFromDiskExecutor.java +++ b/designer_base/src/com/fr/design/extra/exe/InstallFromDiskExecutor.java @@ -24,7 +24,7 @@ public class InstallFromDiskExecutor implements Executor { @Override public String getTaskFinishMessage() { - return "已成功安装"; + return Inter.getLocText("FR-Designer-Plugin_Success_Install"); } @Override @@ -33,7 +33,7 @@ public class InstallFromDiskExecutor implements Executor { new Command() { @Override public String getExecuteMessage() { - return "正在解压文件" + filePath; + return Inter.getLocText("FR-Designer-Plugin_Unzipping") + filePath; } @Override @@ -44,7 +44,7 @@ public class InstallFromDiskExecutor implements Executor { new Command() { @Override public String getExecuteMessage() { - return "正在安装"; + return Inter.getLocText("FR-Designer-Plugin_Installing"); } @Override @@ -56,11 +56,11 @@ public class InstallFromDiskExecutor implements Executor { @Override public void done(PluginTaskResult result) { if (result.isSuccess()) { - FRLogger.getLogger().info("插件安装成功"); + FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Success")); } else if(result.errorCode() == PluginErrorCode.OperationNotSupport.getCode()){ int rv = JOptionPane.showOptionDialog( null, - Inter.getLocText("安装依赖"), + Inter.getLocText(Inter.getLocText("FR-Designer-Plugin_Install_Dependence")), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, @@ -71,9 +71,9 @@ public class InstallFromDiskExecutor implements Executor { if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { return; } - installWithDepenndence(); + installWithDependence(); }else{ - FRLogger.getLogger().info("插件安装失败"); + FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Failed")); JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); } } @@ -83,7 +83,7 @@ public class InstallFromDiskExecutor implements Executor { }; } - public void installWithDepenndence(){ + public void installWithDependence(){ PluginManager.getController().install(new File(filePath), new ProgressCallback() { @Override public void updateProgress(String description, double progress) { @@ -91,10 +91,10 @@ public class InstallFromDiskExecutor implements Executor { @Override public void done(PluginTaskResult result) { if (result.isSuccess()) { - FRLogger.getLogger().info("插件安装成功"); + FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Success")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful")); } else{ - FRLogger.getLogger().info("插件安装失败"); + FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Failed")); JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); } } diff --git a/designer_base/src/com/fr/design/extra/exe/InstallOnlineExecutor.java b/designer_base/src/com/fr/design/extra/exe/InstallOnlineExecutor.java index 2a95ec29ae..fd960d3e83 100644 --- a/designer_base/src/com/fr/design/extra/exe/InstallOnlineExecutor.java +++ b/designer_base/src/com/fr/design/extra/exe/InstallOnlineExecutor.java @@ -36,7 +36,7 @@ public class InstallOnlineExecutor implements Executor { new Command() { @Override public String getExecuteMessage() { - return "正在下载插件:" + pluginInfo.split("_")[0]; + return Inter.getLocText("FR-Designer-Plugin_Downloading") + ":" + pluginInfo.split("_")[0]; } @Override @@ -79,13 +79,13 @@ public class InstallOnlineExecutor implements Executor { @Override public void done(PluginTaskResult result) { if (result.isSuccess()) { - FRLogger.getLogger().info("插件安装成功"); + FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Success")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful")); } else if (result.errorCode() == PluginErrorCode.OperationNotSupport.getCode()) { int rv = JOptionPane.showOptionDialog( null, - Inter.getLocText("安装依赖"), - Inter.getLocText("FR-Designer-Plugin_Warning"), + Inter.getLocText(Inter.getLocText("FR-Designer-Plugin_Install_Success")), + Inter.getLocText("FR-Designer-Plugin_Install_Dependence"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, null, @@ -112,10 +112,10 @@ public class InstallOnlineExecutor implements Executor { @Override public void done(PluginTaskResult result) { if (result.isSuccess()) { - FRLogger.getLogger().info("插件安装成功"); + FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Success")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful")); } else { - FRLogger.getLogger().info("插件安装失败"); + FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Failed")); JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); } } diff --git a/designer_base/src/com/fr/design/extra/exe/UninstallExecutor.java b/designer_base/src/com/fr/design/extra/exe/UninstallExecutor.java index 9eaa49ac93..79d34bf21e 100644 --- a/designer_base/src/com/fr/design/extra/exe/UninstallExecutor.java +++ b/designer_base/src/com/fr/design/extra/exe/UninstallExecutor.java @@ -47,10 +47,10 @@ public class UninstallExecutor implements Executor { public void done(PluginTaskResult pluginTaskResult) { if (pluginTaskResult.isSuccess()) { result = "done"; - FRLogger.getLogger().info("删除成功"); + FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Delete_Success")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful")); } else { - FRLogger.getLogger().info("删除失败"); + FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Delete_Failed")); JOptionPane.showMessageDialog(null, pluginTaskResult.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); } } diff --git a/designer_base/src/com/fr/design/extra/exe/UpdateFromDiskExecutor.java b/designer_base/src/com/fr/design/extra/exe/UpdateFromDiskExecutor.java index c415127f70..8be5a38341 100644 --- a/designer_base/src/com/fr/design/extra/exe/UpdateFromDiskExecutor.java +++ b/designer_base/src/com/fr/design/extra/exe/UpdateFromDiskExecutor.java @@ -24,7 +24,7 @@ public class UpdateFromDiskExecutor implements Executor { @Override public String getTaskFinishMessage() { - return "插件更新操作结束"; + return Inter.getLocText("FR-Designer-Plugin_Update_End"); } @Override @@ -47,7 +47,7 @@ public class UpdateFromDiskExecutor implements Executor { @Override public void done(PluginTaskResult result) { if (result.isSuccess()) { - FRLogger.getLogger().info("更新成功"); + FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Update_Success")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful")); } else if (result.errorCode() == PluginErrorCode.OperationNotSupport.getCode()) { updatePluginWithDependence(); @@ -71,7 +71,6 @@ public class UpdateFromDiskExecutor implements Executor { @Override public void done(PluginTaskResult result) { if (result.isSuccess()) { - FRLogger.getLogger().info("更新成功"); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful")); } else { JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); diff --git a/designer_base/src/com/fr/design/extra/exe/UpdateOnlineExecutor.java b/designer_base/src/com/fr/design/extra/exe/UpdateOnlineExecutor.java index 7cb4674706..c8f1fc7788 100644 --- a/designer_base/src/com/fr/design/extra/exe/UpdateOnlineExecutor.java +++ b/designer_base/src/com/fr/design/extra/exe/UpdateOnlineExecutor.java @@ -10,6 +10,7 @@ import com.fr.json.JSONObject; import com.fr.plugin.context.PluginMarker; import com.fr.plugin.error.PluginErrorCode; import com.fr.plugin.manage.PluginManager; +import com.fr.plugin.manage.bbs.BBSPluginLogin; import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.manage.control.ProgressCallback; import com.fr.stable.StringUtils; @@ -46,10 +47,10 @@ public class UpdateOnlineExecutor implements Executor { @Override public void run(Process process) { - if (StringUtils.isBlank(DesignerEnvManager.getEnvManager().getBBSName())) { + if (!(BBSPluginLogin.getInstance().hasLogin())){ LoginCheckContext.fireLoginCheckListener(); } - if (StringUtils.isNotBlank(DesignerEnvManager.getEnvManager().getBBSName())) { + if (BBSPluginLogin.getInstance().hasLogin()) { List pluginMarkerList = new ArrayList(); for (int i = 0; i < pluginInfos.length; i++) { pluginMarkerList.add(PluginUtils.createPluginMarker(pluginInfos[i])); @@ -70,10 +71,8 @@ public class UpdateOnlineExecutor implements Executor { @Override public void done(PluginTaskResult result) { if (result.isSuccess()) { - FRLogger.getLogger().info("更新成功"); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful")); } else { - FRLogger.getLogger().info("更新失败"); JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); } } @@ -87,7 +86,7 @@ public class UpdateOnlineExecutor implements Executor { //todo check下此插件的最新版本 String latestPluginInfo = PluginUtils.getLatestPluginInfo(pluginMarkerList.get(i).getPluginID()); if (StringUtils.isEmpty(latestPluginInfo) || PluginConstants.CONNECTION_404.equals(latestPluginInfo)) { - JOptionPane.showMessageDialog(null, "插件商城连接失败", Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Connect_Failed"), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); return; } JSONObject resultArr = new JSONObject(latestPluginInfo); @@ -102,12 +101,10 @@ public class UpdateOnlineExecutor implements Executor { @Override public void done(PluginTaskResult result) { if (result.isSuccess()) { - FRLogger.getLogger().info("更新成功"); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful")); } else if (result.errorCode() == PluginErrorCode.OperationNotSupport.getCode()) { updatePluginWithDependence(pluginMarkerList.get(a), PluginMarker.create(pluginMarkerList.get(a).getPluginID(), latestPluginVersion)); } else { - FRLogger.getLogger().info("更新失败"); JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); } } diff --git a/designer_base/src/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java b/designer_base/src/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java index 7d709e935d..cce4934b6e 100644 --- a/designer_base/src/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java +++ b/designer_base/src/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java @@ -30,7 +30,7 @@ public class UpdateOnlineCallback extends AbstractPluginTaskCallback { @Override public void done(PluginTaskResult result) { if (result.isSuccess()) { - FRLogger.getLogger().info("更新成功"); + FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Update_Success")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful")); } else if (result.errorCode() == PluginErrorCode.OperationNotSupport.getCode()) { int rv = JOptionPane.showOptionDialog( @@ -48,7 +48,7 @@ public class UpdateOnlineCallback extends AbstractPluginTaskCallback { } PluginManager.getController().update(pluginMarker, toPluginMarker, new UpdateOnlineCallback(pluginMarker, toPluginMarker, jsCallback)); } else { - FRLogger.getLogger().info("更新失败"); + FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Delete_Failed")); JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); } }