Browse Source

修改PMD

master
kerry 8 years ago
parent
commit
47138c4840
  1. 20
      designer_base/src/com/fr/design/extra/exe/InstallFromDiskExecutor.java
  2. 12
      designer_base/src/com/fr/design/extra/exe/InstallOnlineExecutor.java
  3. 4
      designer_base/src/com/fr/design/extra/exe/UninstallExecutor.java
  4. 5
      designer_base/src/com/fr/design/extra/exe/UpdateFromDiskExecutor.java
  5. 11
      designer_base/src/com/fr/design/extra/exe/UpdateOnlineExecutor.java
  6. 4
      designer_base/src/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java

20
designer_base/src/com/fr/design/extra/exe/InstallFromDiskExecutor.java

@ -24,7 +24,7 @@ public class InstallFromDiskExecutor implements Executor {
@Override @Override
public String getTaskFinishMessage() { public String getTaskFinishMessage() {
return "已成功安装"; return Inter.getLocText("FR-Designer-Plugin_Success_Install");
} }
@Override @Override
@ -33,7 +33,7 @@ public class InstallFromDiskExecutor implements Executor {
new Command() { new Command() {
@Override @Override
public String getExecuteMessage() { public String getExecuteMessage() {
return "正在解压文件" + filePath; return Inter.getLocText("FR-Designer-Plugin_Unzipping") + filePath;
} }
@Override @Override
@ -44,7 +44,7 @@ public class InstallFromDiskExecutor implements Executor {
new Command() { new Command() {
@Override @Override
public String getExecuteMessage() { public String getExecuteMessage() {
return "正在安装"; return Inter.getLocText("FR-Designer-Plugin_Installing");
} }
@Override @Override
@ -56,11 +56,11 @@ public class InstallFromDiskExecutor implements Executor {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
if (result.isSuccess()) { if (result.isSuccess()) {
FRLogger.getLogger().info("插件安装成功"); FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Success"));
} else if(result.errorCode() == PluginErrorCode.OperationNotSupport.getCode()){ } else if(result.errorCode() == PluginErrorCode.OperationNotSupport.getCode()){
int rv = JOptionPane.showOptionDialog( int rv = JOptionPane.showOptionDialog(
null, null,
Inter.getLocText("安装依赖"), Inter.getLocText(Inter.getLocText("FR-Designer-Plugin_Install_Dependence")),
Inter.getLocText("FR-Designer-Plugin_Warning"), Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, JOptionPane.INFORMATION_MESSAGE,
@ -71,9 +71,9 @@ public class InstallFromDiskExecutor implements Executor {
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
return; return;
} }
installWithDepenndence(); installWithDependence();
}else{ }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); 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() { PluginManager.getController().install(new File(filePath), new ProgressCallback() {
@Override @Override
public void updateProgress(String description, double progress) { public void updateProgress(String description, double progress) {
@ -91,10 +91,10 @@ public class InstallFromDiskExecutor implements Executor {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
if (result.isSuccess()) { 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")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful"));
} else{ } 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); JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }

12
designer_base/src/com/fr/design/extra/exe/InstallOnlineExecutor.java

@ -36,7 +36,7 @@ public class InstallOnlineExecutor implements Executor {
new Command() { new Command() {
@Override @Override
public String getExecuteMessage() { public String getExecuteMessage() {
return "正在下载插件:" + pluginInfo.split("_")[0]; return Inter.getLocText("FR-Designer-Plugin_Downloading") + ":" + pluginInfo.split("_")[0];
} }
@Override @Override
@ -79,13 +79,13 @@ public class InstallOnlineExecutor implements Executor {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
if (result.isSuccess()) { 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")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful"));
} else if (result.errorCode() == PluginErrorCode.OperationNotSupport.getCode()) { } else if (result.errorCode() == PluginErrorCode.OperationNotSupport.getCode()) {
int rv = JOptionPane.showOptionDialog( int rv = JOptionPane.showOptionDialog(
null, null,
Inter.getLocText("安装依赖"), Inter.getLocText(Inter.getLocText("FR-Designer-Plugin_Install_Success")),
Inter.getLocText("FR-Designer-Plugin_Warning"), Inter.getLocText("FR-Designer-Plugin_Install_Dependence"),
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, JOptionPane.INFORMATION_MESSAGE,
null, null,
@ -112,10 +112,10 @@ public class InstallOnlineExecutor implements Executor {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
if (result.isSuccess()) { 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")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful"));
} else { } 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); JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }

4
designer_base/src/com/fr/design/extra/exe/UninstallExecutor.java

@ -47,10 +47,10 @@ public class UninstallExecutor implements Executor {
public void done(PluginTaskResult pluginTaskResult) { public void done(PluginTaskResult pluginTaskResult) {
if (pluginTaskResult.isSuccess()) { if (pluginTaskResult.isSuccess()) {
result = "done"; 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")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful"));
} else { } 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); JOptionPane.showMessageDialog(null, pluginTaskResult.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }

5
designer_base/src/com/fr/design/extra/exe/UpdateFromDiskExecutor.java

@ -24,7 +24,7 @@ public class UpdateFromDiskExecutor implements Executor {
@Override @Override
public String getTaskFinishMessage() { public String getTaskFinishMessage() {
return "插件更新操作结束"; return Inter.getLocText("FR-Designer-Plugin_Update_End");
} }
@Override @Override
@ -47,7 +47,7 @@ public class UpdateFromDiskExecutor implements Executor {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
if (result.isSuccess()) { 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")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful"));
} else if (result.errorCode() == PluginErrorCode.OperationNotSupport.getCode()) { } else if (result.errorCode() == PluginErrorCode.OperationNotSupport.getCode()) {
updatePluginWithDependence(); updatePluginWithDependence();
@ -71,7 +71,6 @@ public class UpdateFromDiskExecutor implements Executor {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
if (result.isSuccess()) { if (result.isSuccess()) {
FRLogger.getLogger().info("更新成功");
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful"));
} else { } else {
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/UpdateOnlineExecutor.java

@ -10,6 +10,7 @@ import com.fr.json.JSONObject;
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.bbs.BBSPluginLogin;
import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.manage.control.PluginTaskResult;
import com.fr.plugin.manage.control.ProgressCallback; import com.fr.plugin.manage.control.ProgressCallback;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -46,10 +47,10 @@ public class UpdateOnlineExecutor implements Executor {
@Override @Override
public void run(Process<String> process) { public void run(Process<String> process) {
if (StringUtils.isBlank(DesignerEnvManager.getEnvManager().getBBSName())) { if (!(BBSPluginLogin.getInstance().hasLogin())){
LoginCheckContext.fireLoginCheckListener(); LoginCheckContext.fireLoginCheckListener();
} }
if (StringUtils.isNotBlank(DesignerEnvManager.getEnvManager().getBBSName())) { if (BBSPluginLogin.getInstance().hasLogin()) {
List<PluginMarker> pluginMarkerList = new ArrayList<PluginMarker>(); List<PluginMarker> pluginMarkerList = new ArrayList<PluginMarker>();
for (int i = 0; i < pluginInfos.length; i++) { for (int i = 0; i < pluginInfos.length; i++) {
pluginMarkerList.add(PluginUtils.createPluginMarker(pluginInfos[i])); pluginMarkerList.add(PluginUtils.createPluginMarker(pluginInfos[i]));
@ -70,10 +71,8 @@ public class UpdateOnlineExecutor implements Executor {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
if (result.isSuccess()) { if (result.isSuccess()) {
FRLogger.getLogger().info("更新成功");
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful"));
} else { } else {
FRLogger.getLogger().info("更新失败");
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);
} }
} }
@ -87,7 +86,7 @@ public class UpdateOnlineExecutor implements Executor {
//todo check下此插件的最新版本 //todo check下此插件的最新版本
String latestPluginInfo = PluginUtils.getLatestPluginInfo(pluginMarkerList.get(i).getPluginID()); String latestPluginInfo = PluginUtils.getLatestPluginInfo(pluginMarkerList.get(i).getPluginID());
if (StringUtils.isEmpty(latestPluginInfo) || PluginConstants.CONNECTION_404.equals(latestPluginInfo)) { 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; return;
} }
JSONObject resultArr = new JSONObject(latestPluginInfo); JSONObject resultArr = new JSONObject(latestPluginInfo);
@ -102,12 +101,10 @@ public class UpdateOnlineExecutor implements Executor {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
if (result.isSuccess()) { if (result.isSuccess()) {
FRLogger.getLogger().info("更新成功");
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful"));
} else if (result.errorCode() == PluginErrorCode.OperationNotSupport.getCode()) { } else if (result.errorCode() == PluginErrorCode.OperationNotSupport.getCode()) {
updatePluginWithDependence(pluginMarkerList.get(a), PluginMarker.create(pluginMarkerList.get(a).getPluginID(), latestPluginVersion)); updatePluginWithDependence(pluginMarkerList.get(a), PluginMarker.create(pluginMarkerList.get(a).getPluginID(), latestPluginVersion));
} else { } else {
FRLogger.getLogger().info("更新失败");
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);
} }
} }

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

@ -30,7 +30,7 @@ public class UpdateOnlineCallback extends AbstractPluginTaskCallback {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
if (result.isSuccess()) { 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")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful"));
} else if (result.errorCode() == PluginErrorCode.OperationNotSupport.getCode()) { } else if (result.errorCode() == PluginErrorCode.OperationNotSupport.getCode()) {
int rv = JOptionPane.showOptionDialog( int rv = JOptionPane.showOptionDialog(
@ -48,7 +48,7 @@ public class UpdateOnlineCallback extends AbstractPluginTaskCallback {
} }
PluginManager.getController().update(pluginMarker, toPluginMarker, new UpdateOnlineCallback(pluginMarker, toPluginMarker, jsCallback)); PluginManager.getController().update(pluginMarker, toPluginMarker, new UpdateOnlineCallback(pluginMarker, toPluginMarker, jsCallback));
} else { } 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); JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }

Loading…
Cancel
Save