Browse Source

PFC-607 插件安装删除更新不重启支持

修复主线程弹窗死锁的问题
master
juhaoyu 8 years ago
parent
commit
266511537a
  1. 34
      designer_base/src/com/fr/design/extra/PluginOperateUtils.java

34
designer_base/src/com/fr/design/extra/PluginOperateUtils.java

@ -24,8 +24,6 @@ import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
/** /**
@ -33,8 +31,6 @@ import java.util.concurrent.Executors;
*/ */
public class PluginOperateUtils { public class PluginOperateUtils {
private static final Executor EXECUTOR = Executors.newSingleThreadExecutor();
public static void installPluginOnline(final PluginMarker pluginMarker, JSCallback jsCallback) { public static void installPluginOnline(final PluginMarker pluginMarker, JSCallback jsCallback) {
//下载插件 //下载插件
if (!BBSPluginLogin.getInstance().hasLogin()) { if (!BBSPluginLogin.getInstance().hasLogin()) {
@ -95,11 +91,10 @@ public class PluginOperateUtils {
public static void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSCallback jsCallback) { public static void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSCallback jsCallback) {
EXECUTOR.execute(new Runnable() { new Thread(new Runnable() {
@Override @Override
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-Designer-Plugin_Delete_Confirmed"),
@ -112,13 +107,12 @@ public class PluginOperateUtils {
PluginManager.getController().uninstall(pluginMarker, isForce, new UninstallPluginCallback(pluginMarker, jsCallback)); PluginManager.getController().uninstall(pluginMarker, isForce, new UninstallPluginCallback(pluginMarker, jsCallback));
} }
} }
}); }).start();
} }
public static void readUpdateOnline(final JSCallback jsCallback) { public static void readUpdateOnline(final JSCallback jsCallback) {
EXECUTOR.execute(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
try { try {
@ -135,13 +129,14 @@ public class PluginOperateUtils {
FRLogger.getLogger().error(e.getMessage()); FRLogger.getLogger().error(e.getMessage());
} }
} }
}); }).start();
} }
public static void searchPlugin(final String keyword, final JSCallback jsCallback) { public static void searchPlugin(final String keyword, final JSCallback jsCallback) {
EXECUTOR.execute(new Runnable() {
new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
try { try {
@ -159,12 +154,13 @@ public class PluginOperateUtils {
FRLogger.getLogger().error(e.getMessage()); FRLogger.getLogger().error(e.getMessage());
} }
} }
}); }).start();
} }
public static void getPluginFromStore(final String category, final String seller, final String fee, final JSCallback jsCallback) { public static void getPluginFromStore(final String category, final String seller, final String fee, final JSCallback jsCallback) {
EXECUTOR.execute(new Runnable() {
new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
String plistUrl = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.plist") + "?"; String plistUrl = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.plist") + "?";
@ -194,7 +190,7 @@ public class PluginOperateUtils {
} }
} }
}); }).start();
} }
@ -243,7 +239,8 @@ public class PluginOperateUtils {
} }
public static void getPluginCategories(final JSCallback jsCallback) { public static void getPluginCategories(final JSCallback jsCallback) {
EXECUTOR.execute(new Runnable() {
new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
String result; String result;
@ -256,17 +253,18 @@ public class PluginOperateUtils {
} }
jsCallback.execute(result); jsCallback.execute(result);
} }
}); }).start();
} }
public static void getPluginPrefix(final JSCallback jsCallback) { public static void getPluginPrefix(final JSCallback jsCallback) {
EXECUTOR.execute(new Runnable() {
new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
String result = SiteCenter.getInstance().acquireUrlByKind("plugin.url.prefix"); String result = SiteCenter.getInstance().acquireUrlByKind("plugin.url.prefix");
jsCallback.execute(result); jsCallback.execute(result);
} }
}); }).start();
} }
public static void getLoginInfo(JSCallback jsCallback) { public static void getLoginInfo(JSCallback jsCallback) {

Loading…
Cancel
Save