diff --git a/designer_base/src/com/fr/design/extra/PluginManagerPane.java b/designer_base/src/com/fr/design/extra/PluginManagerPane.java index ae64f58a6..36948fe36 100644 --- a/designer_base/src/com/fr/design/extra/PluginManagerPane.java +++ b/designer_base/src/com/fr/design/extra/PluginManagerPane.java @@ -42,6 +42,7 @@ public class PluginManagerPane extends BasicPane { if (StableUtils.isDebug()) { URL url = ClassLoader.getSystemResource(""); installHome = url.getPath(); + addPane(installHome); } else { installHome = StableUtils.getInstallHome(); File file = new File(StableUtils.pathJoin(installHome, "scripts")); @@ -57,16 +58,21 @@ public class PluginManagerPane extends BasicPane { downloadShopScripts(); } } else { + addPane(installHome); updateShopScripts(); } } - PluginWebPane webPane = new PluginWebPane(new File(installHome).getAbsolutePath()); - add(webPane, BorderLayout.CENTER); } else { initTraditionalStore(); } } + private void addPane(String installHome) { + PluginWebPane webPane = new PluginWebPane(new File(installHome).getAbsolutePath()); + add(webPane, BorderLayout.CENTER); + } + + private void initTraditionalStore() { UITabbedPane tabbedPane = new UITabbedPane(); add(tabbedPane, BorderLayout.CENTER); 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 d343ec590..70509575d 100644 --- a/designer_base/src/com/fr/design/extra/exe/InstallOnlineExecutor.java +++ b/designer_base/src/com/fr/design/extra/exe/InstallOnlineExecutor.java @@ -4,10 +4,12 @@ import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; import com.fr.design.RestartHelper; import com.fr.design.extra.After; +import com.fr.design.extra.LoginCheckContext; import com.fr.design.extra.PluginHelper; import com.fr.design.extra.Process; import com.fr.general.Inter; import com.fr.plugin.PluginVerifyException; +import com.fr.stable.StringUtils; import javax.swing.*; @@ -38,17 +40,22 @@ public class InstallOnlineExecutor implements Executor { @Override public void run(final Process process) { - String username = DesignerEnvManager.getEnvManager().getBBSName(); - String password = DesignerEnvManager.getEnvManager().getBBSPassword(); - try { - PluginHelper.downloadPluginFile(pluginID, username, password, new Process() { - @Override - public void process(Double integer) { - process.process(Math.round(integer * 100) + "%"); - } - }); - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + if(StringUtils.isBlank(DesignerEnvManager.getEnvManager().getBBSName())){ + LoginCheckContext.fireLoginCheckListener(); + } + if(StringUtils.isNotBlank(DesignerEnvManager.getEnvManager().getBBSName())) { + String username = DesignerEnvManager.getEnvManager().getBBSName(); + String password = DesignerEnvManager.getEnvManager().getBBSPassword(); + try { + PluginHelper.downloadPluginFile(pluginID, username, password, new Process() { + @Override + public void process(Double integer) { + process.process(Math.round(integer * 100) + "%"); + } + }); + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); + } } } }, 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 f1c3b0f04..30fe07896 100644 --- a/designer_base/src/com/fr/design/extra/exe/UpdateOnlineExecutor.java +++ b/designer_base/src/com/fr/design/extra/exe/UpdateOnlineExecutor.java @@ -4,11 +4,13 @@ import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; import com.fr.design.RestartHelper; import com.fr.design.extra.After; +import com.fr.design.extra.LoginCheckContext; import com.fr.design.extra.PluginHelper; import com.fr.design.extra.Process; import com.fr.general.Inter; import com.fr.plugin.Plugin; import com.fr.plugin.PluginLoader; +import com.fr.stable.StringUtils; import javax.swing.*; import java.io.File; @@ -41,41 +43,46 @@ public class UpdateOnlineExecutor implements Executor { @Override public void run(Process process) { - for (int i = 0; i < pluginIDs.length; i++) { - Plugin plugin = PluginLoader.getLoader().getPluginById(pluginIDs[i]); - String id = null; - if (plugin != null) { - id = plugin.getId(); + if(StringUtils.isBlank(DesignerEnvManager.getEnvManager().getBBSName())){ + LoginCheckContext.fireLoginCheckListener(); + } + if(StringUtils.isNotBlank(DesignerEnvManager.getEnvManager().getBBSName())){ + for (int i = 0; i < pluginIDs.length; i++) { + Plugin plugin = PluginLoader.getLoader().getPluginById(pluginIDs[i]); + String id = null; + if (plugin != null) { + id = plugin.getId(); + } + String username = DesignerEnvManager.getEnvManager().getBBSName(); + String password = DesignerEnvManager.getEnvManager().getBBSPassword(); + try { + PluginHelper.downloadPluginFile(id, username, password, new Process() { + @Override + public void process(Double integer) { + } + }); + updateFileFromDisk(PluginHelper.getDownloadTempFile()); + process.process(PERCENT_100 / pluginIDs.length * (i + 1) + "%"); + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); + } } - String username = DesignerEnvManager.getEnvManager().getBBSName(); - String password = DesignerEnvManager.getEnvManager().getBBSPassword(); - try { - PluginHelper.downloadPluginFile(id, username, password, new Process() { - @Override - public void process(Double integer) { - } - }); - updateFileFromDisk(PluginHelper.getDownloadTempFile()); - process.process(PERCENT_100 / pluginIDs.length * (i + 1) + "%"); - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + int rv = JOptionPane.showOptionDialog( + null, + Inter.getLocText("FR-Designer-Plugin_Update_Successful"), + Inter.getLocText("FR-Designer-Plugin_Warning"), + JOptionPane.YES_NO_OPTION, + JOptionPane.INFORMATION_MESSAGE, + null, + new String[]{Inter.getLocText("FR-Designer-Basic_Restart_Designer"), + Inter.getLocText("FR-Designer-Basic_Restart_Designer_Later") + }, + null + ); + if (rv == JOptionPane.OK_OPTION) { + RestartHelper.restart(); } } - int rv = JOptionPane.showOptionDialog( - null, - Inter.getLocText("FR-Designer-Plugin_Update_Successful"), - Inter.getLocText("FR-Designer-Plugin_Warning"), - JOptionPane.YES_NO_OPTION, - JOptionPane.INFORMATION_MESSAGE, - null, - new String[]{Inter.getLocText("FR-Designer-Basic_Restart_Designer"), - Inter.getLocText("FR-Designer-Basic_Restart_Designer_Later") - }, - null - ); - if (rv == JOptionPane.OK_OPTION) { - RestartHelper.restart(); - } } } };