Browse Source

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

修复主线程弹窗死锁的问题
master
juhaoyu 7 years ago
parent
commit
95ad5839be
  1. 39
      designer_base/src/com/fr/design/extra/PluginOperateUtils.java

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

@ -24,12 +24,16 @@ import com.fr.stable.StringUtils;
import javax.swing.*;
import java.io.File;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
/**
* Created by ibm on 2017/5/26.
*/
public class PluginOperateUtils {
private static final Executor EXECUTOR = Executors.newSingleThreadExecutor();
public static void installPluginOnline(final PluginMarker pluginMarker, JSCallback jsCallback) {
//下载插件
@ -88,19 +92,28 @@ public class PluginOperateUtils {
PluginManager.getController().enable(pluginMarker, modifyStatusCallback);
}
}
public static void uninstallPlugin(final String pluginInfo, final boolean isForce, JSCallback jsCallback) {
int rv = JOptionPane.showConfirmDialog(
null,
Inter.getLocText("FR-Designer-Plugin_Delete_Confirmed"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE
);
if (rv == JOptionPane.OK_OPTION) {
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
PluginManager.getController().uninstall(pluginMarker, isForce, new UninstallPluginCallback(pluginMarker, jsCallback));
}
public static void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSCallback jsCallback) {
EXECUTOR.execute(new Runnable() {
@Override
public void run() {
int rv = JOptionPane.showConfirmDialog(
null,
Inter.getLocText("FR-Designer-Plugin_Delete_Confirmed"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE
);
if (rv == JOptionPane.OK_OPTION) {
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
PluginManager.getController().uninstall(pluginMarker, isForce, new UninstallPluginCallback(pluginMarker, jsCallback));
}
}
});
}
public static void readUpdateOnline(final JSCallback jsCallback) {

Loading…
Cancel
Save