diff --git a/designer_base/src/com/fr/design/extra/LoginWebBridge.java b/designer_base/src/com/fr/design/extra/LoginWebBridge.java index 7db9fc5ac4..2990ad1331 100644 --- a/designer_base/src/com/fr/design/extra/LoginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/LoginWebBridge.java @@ -9,6 +9,8 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.general.SiteCenter; import com.fr.general.http.HttpClient; import com.fr.json.JSONObject; +import com.fr.plugin.manage.bbs.BBSPluginLogin; +import com.fr.plugin.manage.bbs.BBSUserInfo; import com.fr.stable.EncodeConstants; import com.fr.stable.StringUtils; import javafx.scene.web.WebEngine; @@ -320,6 +322,7 @@ public class LoginWebBridge { DesignerEnvManager.getEnvManager().setBBSName(username); DesignerEnvManager.getEnvManager().setInShowBBsName(username); DesignerEnvManager.getEnvManager().setBBSPassword(password); + BBSPluginLogin.getInstance().login(new BBSUserInfo(username, password)); return LOGININ;//登录成功,0 } else if ($uid == -1) { return USERNAME_NOT_EXSIT;//用户名不存在,-1 diff --git a/designer_base/src/com/fr/design/extra/PluginFromStorePane.java b/designer_base/src/com/fr/design/extra/PluginFromStorePane.java index 0b8393ccf1..4de4b0d186 100644 --- a/designer_base/src/com/fr/design/extra/PluginFromStorePane.java +++ b/designer_base/src/com/fr/design/extra/PluginFromStorePane.java @@ -6,6 +6,7 @@ import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ilable.UILabel; import com.fr.general.FRLogger; import com.fr.general.Inter; +import com.fr.json.JSONObject; import com.fr.plugin.context.PluginMarker; import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.bbs.BBSPluginLogin; @@ -199,8 +200,9 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane plugins = PluginsReaderFromStore.readPluginsForUpdate(); - JSONArray jsonArray = new JSONArray(); - for (PluginView plugin : plugins) { - org.json.JSONObject jsonObject = new org.json.JSONObject(); - jsonObject.put("pluginid", plugin.getID()); - jsonArray.put(jsonObject); + + new Thread(new Runnable() { + @Override + public void run() { + try { + List plugins = PluginsReaderFromStore.readPluginsForUpdate(); + JSONArray jsonArray = new JSONArray(); + for (PluginView plugin : plugins) { + org.json.JSONObject jsonObject = new org.json.JSONObject(); + jsonObject.put("pluginid", plugin.getID()); + jsonArray.put(jsonObject); + } + String result = jsonArray.toString(); + jsCallback.execute(result); + } catch (Exception e) { + FRLogger.getLogger().error(e.getMessage()); + } } - String result = jsonArray.toString(); - jsCallback.execute(result); - } catch (Exception e) { - FRLogger.getLogger().error(e.getMessage()); - } + }).start(); + } public static void searchPlugin(String keyword, JSCallback jsCallback) { try { - HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.plist") + "&keyword=" + keyword); - String result = httpClient.getResponseText(); - jsCallback.execute(result); + new Thread(new Runnable() { + @Override + public void run() { + HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.plist") + "&keyword=" + keyword); + String result = httpClient.getResponseText(); + jsCallback.execute(result); + } + }).start(); } catch (Exception e) { FRLogger.getLogger().error(e.getMessage()); } @@ -150,19 +155,25 @@ public class PluginOperateUtils { } public static void getPluginCategories(JSCallback jsCallback) { - String result; - String url = SiteCenter.getInstance().acquireUrlByKind("plugin.category"); - if (url != null) { - HttpClient httpClient = new HttpClient(url); - result = httpClient.getResponseText(); - } else { - result = PluginConstants.CONNECTION_404; - } - jsCallback.execute(result); + new Thread(new Runnable() { + @Override + public void run() { + String result; + String url = SiteCenter.getInstance().acquireUrlByKind("plugin.category"); + if (url != null) { + HttpClient httpClient = new HttpClient(url); + result = httpClient.getResponseText(); + } else { + result = PluginConstants.CONNECTION_404; + } + jsCallback.execute(result); + } + }).start(); } public static void getLoginInfo(JSCallback jsCallback) { - String username = BBSPluginLogin.getInstance().getUserInfo().getUserName(); + BBSUserInfo bbsUserInfo = BBSPluginLogin.getInstance().getUserInfo(); + String username = bbsUserInfo == null ? "" : bbsUserInfo.getUserName(); String inShowUsername = DesignerEnvManager.getEnvManager().getInShowBBsName(); if (StringUtils.isEmpty(username) && StringUtils.isEmpty(inShowUsername)) { return; @@ -172,11 +183,11 @@ public class PluginOperateUtils { } } - public static boolean pluginValidate(PluginView pluginView){ + public static boolean pluginValidate(PluginView pluginView) { return StringUtils.isNotEmpty(pluginView.getID()) && StringUtils.isNotEmpty(pluginView.getName()) && StringUtils.isNotEmpty(pluginView.getVersion()) && StringUtils.isNotEmpty(pluginView.getEnvVersion()); } - } +} diff --git a/designer_base/src/com/fr/design/extra/PluginUpdatePane.java b/designer_base/src/com/fr/design/extra/PluginUpdatePane.java index 5506b5dc43..5de8c9588c 100644 --- a/designer_base/src/com/fr/design/extra/PluginUpdatePane.java +++ b/designer_base/src/com/fr/design/extra/PluginUpdatePane.java @@ -8,6 +8,7 @@ import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ilable.UILabel; import com.fr.general.FRLogger; import com.fr.general.Inter; +import com.fr.json.JSONObject; import com.fr.plugin.context.PluginMarker; import com.fr.plugin.error.PluginErrorCode; import com.fr.plugin.manage.PluginManager; @@ -179,11 +180,15 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane plugins) throws Exception { @@ -69,7 +74,7 @@ public class PluginUtils { return jsonArray.toString(); } - public static void downloadShopScripts(String id, String username, String password, Process p) throws Exception{ + public static void downloadShopScripts(String id, String username, String password, Process p) throws Exception { HttpClient httpClient = new HttpClient(getDownloadPath(id, username, password)); if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { int totalSize = httpClient.getContentLength(); @@ -108,7 +113,7 @@ public class PluginUtils { return resText; } - public static boolean isPluginMatch(PluginView pluginView, String text){ + public static boolean isPluginMatch(PluginView pluginView, String text) { return StringUtils.contains(pluginView.getID(), text) || StringUtils.contains(pluginView.getName(), text) || StringUtils.contains(pluginView.getVersion(), text) @@ -119,7 +124,7 @@ public class PluginUtils { } - public static String pluginToHtml(PluginView pluginView){ + public static String pluginToHtml(PluginView pluginView) { String pluginName = Inter.getLocText("FR-Plugin-Plugin_Name"); String pluginVersion = Inter.getLocText("FR-Plugin-Plugin_Version"); String startVersion = Inter.getLocText("FR-Plugin-Start_Version"); diff --git a/designer_base/src/com/fr/design/extra/PluginWebBridge.java b/designer_base/src/com/fr/design/extra/PluginWebBridge.java index be0d9a3ba5..a961183ad1 100644 --- a/designer_base/src/com/fr/design/extra/PluginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/PluginWebBridge.java @@ -4,10 +4,7 @@ import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; import com.fr.design.RestartHelper; import com.fr.design.dialog.UIDialog; -import com.fr.design.extra.exe.*; import com.fr.design.extra.exe.callback.JSCallback; -import com.fr.design.extra.exe.extratask.ExtraPluginTask; -import com.fr.design.extra.exe.extratask.UpdatePluginTask; import com.fr.design.gui.ilable.UILabel; import com.fr.general.FRLogger; import com.fr.general.Inter; @@ -19,7 +16,6 @@ import com.fr.plugin.context.PluginMarker; import com.fr.plugin.manage.PluginManager; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import javafx.concurrent.Task; import javafx.scene.web.WebEngine; import javafx.stage.FileChooser; import javafx.stage.Stage; @@ -488,8 +484,11 @@ public class PluginWebBridge { * @param password * @return */ - public String defaultLogin(String username, String password) { - return LoginWebBridge.getHelper().pluginManageLogin(username, password, uiLabel); + public void defaultLogin(String username, String password, final JSObject callback) { + JSCallback jsCallback = new JSCallback(webEngine, callback); + String result = LoginWebBridge.getHelper().pluginManageLogin(username, password, uiLabel); + jsCallback.execute(result); + } /**