Browse Source

1、更新对话框在插件管理背面的问题

2、下载插件和更新插件时提醒登陆
master
vito 9 years ago
parent
commit
54b0ac13b7
  1. 10
      designer_base/src/com/fr/design/extra/PluginManagerPane.java
  2. 29
      designer_base/src/com/fr/design/extra/exe/InstallOnlineExecutor.java
  3. 71
      designer_base/src/com/fr/design/extra/exe/UpdateOnlineExecutor.java

10
designer_base/src/com/fr/design/extra/PluginManagerPane.java

@ -42,6 +42,7 @@ public class PluginManagerPane extends BasicPane {
if (StableUtils.isDebug()) { if (StableUtils.isDebug()) {
URL url = ClassLoader.getSystemResource(""); URL url = ClassLoader.getSystemResource("");
installHome = url.getPath(); installHome = url.getPath();
addPane(installHome);
} else { } else {
installHome = StableUtils.getInstallHome(); installHome = StableUtils.getInstallHome();
File file = new File(StableUtils.pathJoin(installHome, "scripts")); File file = new File(StableUtils.pathJoin(installHome, "scripts"));
@ -57,16 +58,21 @@ public class PluginManagerPane extends BasicPane {
downloadShopScripts(); downloadShopScripts();
} }
} else { } else {
addPane(installHome);
updateShopScripts(); updateShopScripts();
} }
} }
PluginWebPane webPane = new PluginWebPane(new File(installHome).getAbsolutePath());
add(webPane, BorderLayout.CENTER);
} else { } else {
initTraditionalStore(); initTraditionalStore();
} }
} }
private void addPane(String installHome) {
PluginWebPane webPane = new PluginWebPane(new File(installHome).getAbsolutePath());
add(webPane, BorderLayout.CENTER);
}
private void initTraditionalStore() { private void initTraditionalStore() {
UITabbedPane tabbedPane = new UITabbedPane(); UITabbedPane tabbedPane = new UITabbedPane();
add(tabbedPane, BorderLayout.CENTER); add(tabbedPane, BorderLayout.CENTER);

29
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.DesignerEnvManager;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.extra.After; import com.fr.design.extra.After;
import com.fr.design.extra.LoginCheckContext;
import com.fr.design.extra.PluginHelper; import com.fr.design.extra.PluginHelper;
import com.fr.design.extra.Process; import com.fr.design.extra.Process;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.PluginVerifyException; import com.fr.plugin.PluginVerifyException;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -38,17 +40,22 @@ public class InstallOnlineExecutor implements Executor {
@Override @Override
public void run(final Process<String> process) { public void run(final Process<String> process) {
String username = DesignerEnvManager.getEnvManager().getBBSName(); if(StringUtils.isBlank(DesignerEnvManager.getEnvManager().getBBSName())){
String password = DesignerEnvManager.getEnvManager().getBBSPassword(); LoginCheckContext.fireLoginCheckListener();
try { }
PluginHelper.downloadPluginFile(pluginID, username, password, new Process<Double>() { if(StringUtils.isNotBlank(DesignerEnvManager.getEnvManager().getBBSName())) {
@Override String username = DesignerEnvManager.getEnvManager().getBBSName();
public void process(Double integer) { String password = DesignerEnvManager.getEnvManager().getBBSPassword();
process.process(Math.round(integer * 100) + "%"); try {
} PluginHelper.downloadPluginFile(pluginID, username, password, new Process<Double>() {
}); @Override
} catch (Exception e) { public void process(Double integer) {
FRContext.getLogger().error(e.getMessage(), e); process.process(Math.round(integer * 100) + "%");
}
});
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
} }
} }
}, },

71
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.DesignerEnvManager;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.extra.After; import com.fr.design.extra.After;
import com.fr.design.extra.LoginCheckContext;
import com.fr.design.extra.PluginHelper; import com.fr.design.extra.PluginHelper;
import com.fr.design.extra.Process; import com.fr.design.extra.Process;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.Plugin; import com.fr.plugin.Plugin;
import com.fr.plugin.PluginLoader; import com.fr.plugin.PluginLoader;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import java.io.File; import java.io.File;
@ -41,41 +43,46 @@ public class UpdateOnlineExecutor implements Executor {
@Override @Override
public void run(Process<String> process) { public void run(Process<String> process) {
for (int i = 0; i < pluginIDs.length; i++) { if(StringUtils.isBlank(DesignerEnvManager.getEnvManager().getBBSName())){
Plugin plugin = PluginLoader.getLoader().getPluginById(pluginIDs[i]); LoginCheckContext.fireLoginCheckListener();
String id = null; }
if (plugin != null) { if(StringUtils.isNotBlank(DesignerEnvManager.getEnvManager().getBBSName())){
id = plugin.getId(); 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<Double>() {
@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(); int rv = JOptionPane.showOptionDialog(
String password = DesignerEnvManager.getEnvManager().getBBSPassword(); null,
try { Inter.getLocText("FR-Designer-Plugin_Update_Successful"),
PluginHelper.downloadPluginFile(id, username, password, new Process<Double>() { Inter.getLocText("FR-Designer-Plugin_Warning"),
@Override JOptionPane.YES_NO_OPTION,
public void process(Double integer) { JOptionPane.INFORMATION_MESSAGE,
} null,
}); new String[]{Inter.getLocText("FR-Designer-Basic_Restart_Designer"),
updateFileFromDisk(PluginHelper.getDownloadTempFile()); Inter.getLocText("FR-Designer-Basic_Restart_Designer_Later")
process.process(PERCENT_100 / pluginIDs.length * (i + 1) + "%"); },
} catch (Exception e) { null
FRContext.getLogger().error(e.getMessage(), e); );
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();
}
} }
} }
}; };

Loading…
Cancel
Save