Browse Source

Merge pull request #66 in BA/design from ~VITO/design:dev to dev

* commit '54b0ac13b7993d10b50f39a1e41303d46b74edc9':
  1、更新对话框在插件管理背面的问题 2、下载插件和更新插件时提醒登陆
master
neil 9 years ago
parent
commit
8c99018577
  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()) {
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);

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.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<String> process) {
String username = DesignerEnvManager.getEnvManager().getBBSName();
String password = DesignerEnvManager.getEnvManager().getBBSPassword();
try {
PluginHelper.downloadPluginFile(pluginID, username, password, new Process<Double>() {
@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<Double>() {
@Override
public void process(Double integer) {
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.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<String> 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<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();
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);
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();
}
}
}
};

Loading…
Cancel
Save