|
|
@ -1,8 +1,8 @@ |
|
|
|
package com.fr.design.extra; |
|
|
|
package com.fr.design.extra; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.FRContext; |
|
|
|
import com.fr.base.FRContext; |
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
|
|
|
|
import com.fr.design.extra.exe.callback.*; |
|
|
|
import com.fr.design.extra.exe.callback.*; |
|
|
|
|
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.general.FRLogger; |
|
|
|
import com.fr.general.FRLogger; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.SiteCenter; |
|
|
|
import com.fr.general.SiteCenter; |
|
|
@ -33,15 +33,8 @@ public class PluginOperateUtils { |
|
|
|
|
|
|
|
|
|
|
|
public static void installPluginOnline(final PluginMarker pluginMarker, JSCallback jsCallback) { |
|
|
|
public static void installPluginOnline(final PluginMarker pluginMarker, JSCallback jsCallback) { |
|
|
|
//下载插件
|
|
|
|
//下载插件
|
|
|
|
if (!BBSPluginLogin.getInstance().hasLogin()) { |
|
|
|
PluginTask pluginTask = PluginTask.installTask(pluginMarker); |
|
|
|
UserLoginContext.fireLoginContextListener(); |
|
|
|
PluginControllerHelper.installOnline(pluginMarker, new InstallOnlineCallback(pluginTask, jsCallback)); |
|
|
|
} |
|
|
|
|
|
|
|
if (BBSPluginLogin.getInstance().hasLogin()) { |
|
|
|
|
|
|
|
PluginTask pluginTask = PluginTask.installTask(pluginMarker); |
|
|
|
|
|
|
|
PluginControllerHelper.installOnline(pluginMarker, new InstallOnlineCallback(pluginTask, jsCallback)); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
jsCallback.execute("success"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void installPluginFromDisk(File zipFile, JSCallback jsCallback) { |
|
|
|
public static void installPluginFromDisk(File zipFile, JSCallback jsCallback) { |
|
|
@ -50,13 +43,8 @@ public class PluginOperateUtils { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void updatePluginOnline(List<PluginMarker> pluginMarkerList, JSCallback jsCallback) { |
|
|
|
public static void updatePluginOnline(List<PluginMarker> pluginMarkerList, JSCallback jsCallback) { |
|
|
|
if (!(BBSPluginLogin.getInstance().hasLogin())) { |
|
|
|
for (int i = 0; i < pluginMarkerList.size(); i++) { |
|
|
|
LoginCheckContext.fireLoginCheckListener(); |
|
|
|
updatePluginOnline(pluginMarkerList.get(i), jsCallback); |
|
|
|
} |
|
|
|
|
|
|
|
if (BBSPluginLogin.getInstance().hasLogin()) { |
|
|
|
|
|
|
|
for (int i = 0; i < pluginMarkerList.size(); i++) { |
|
|
|
|
|
|
|
updatePluginOnline(pluginMarkerList.get(i), jsCallback); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -76,8 +64,8 @@ public class PluginOperateUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void updatePluginFromDisk(final String filePath, JSCallback jsCallback) { |
|
|
|
public static void updatePluginFromDisk(File zipFile, JSCallback jsCallback) { |
|
|
|
PluginManager.getController().update(new File(filePath), new UpdateFromDiskCallback(new File(filePath), jsCallback)); |
|
|
|
PluginManager.getController().update(zipFile, new UpdateFromDiskCallback(zipFile, jsCallback)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -101,7 +89,7 @@ public class PluginOperateUtils { |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
|
int rv = JOptionPane.showConfirmDialog( |
|
|
|
int rv = JOptionPane.showConfirmDialog( |
|
|
|
null, |
|
|
|
null, |
|
|
|
Inter.getLocText("FR-Designer-Plugin_Delete_Confirmed"), |
|
|
|
Inter.getLocText("FR-Plugin_Delete_Confirmed"), |
|
|
|
Inter.getLocText("FR-Designer-Plugin_Warning"), |
|
|
|
Inter.getLocText("FR-Designer-Plugin_Warning"), |
|
|
|
JOptionPane.OK_CANCEL_OPTION, |
|
|
|
JOptionPane.OK_CANCEL_OPTION, |
|
|
|
JOptionPane.INFORMATION_MESSAGE |
|
|
|
JOptionPane.INFORMATION_MESSAGE |
|
|
@ -271,22 +259,16 @@ public class PluginOperateUtils { |
|
|
|
}).start(); |
|
|
|
}).start(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void getLoginInfo(JSCallback jsCallback) { |
|
|
|
public static void getLoginInfo(JSCallback jsCallback, UILabel uiLabel) { |
|
|
|
|
|
|
|
|
|
|
|
if (!BBSPluginLogin.getInstance().hasLogin()) { |
|
|
|
|
|
|
|
String userName = DesignerEnvManager.getEnvManager().getBBSName(); |
|
|
|
|
|
|
|
String password = DesignerEnvManager.getEnvManager().getBBSPassword(); |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(userName)) { |
|
|
|
|
|
|
|
BBSPluginLogin.getInstance().login(new BBSUserInfo(userName, password)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
BBSUserInfo bbsUserInfo = BBSPluginLogin.getInstance().getUserInfo(); |
|
|
|
BBSUserInfo bbsUserInfo = BBSPluginLogin.getInstance().getUserInfo(); |
|
|
|
String username = bbsUserInfo == null ? "" : bbsUserInfo.getUserName(); |
|
|
|
String username = bbsUserInfo == null ? "" : bbsUserInfo.getUserName(); |
|
|
|
String inShowUsername = DesignerEnvManager.getEnvManager().getInShowBBsName(); |
|
|
|
|
|
|
|
if (StringUtils.isEmpty(username) && StringUtils.isEmpty(inShowUsername)) { |
|
|
|
if (StringUtils.isEmpty(username)) { |
|
|
|
return; |
|
|
|
jsCallback.execute(""); |
|
|
|
|
|
|
|
uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn")); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
String result = StringUtils.isEmpty(inShowUsername) ? username : inShowUsername; |
|
|
|
uiLabel.setText(username); |
|
|
|
|
|
|
|
String result = username; |
|
|
|
jsCallback.execute(result); |
|
|
|
jsCallback.execute(result); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|