Browse Source

Merge pull request #958 in BA/design from ~JU/ba-9.0-design:9.0 to 9.0

* commit '8a10b3f7ceaac99d3907c39ed50e9f8d968aa2ce':
  PFC-607 插件安装删除更新不重启支持 fix
  PFC-607 插件安装删除更新不重启支持 fix
  PFC-607 插件安装删除更新不重启支持 修复主线程弹窗死锁的问题
  PFC-607 插件安装删除更新不重启支持 修复主线程弹窗死锁的问题
  PFC-607 插件安装删除更新不重启支持 修复主线程弹窗死锁的问题
  PFC-607 插件安装删除更新不重启支持 添加一个较简陋的沙盒容器,自动处理插件的热部署
master
superman 7 years ago
parent
commit
c1475c5f54
  1. 45
      designer_base/src/com/fr/design/extra/PluginOperateUtils.java
  2. 10
      designer_base/src/com/fr/design/extra/PluginUtils.java

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

@ -63,8 +63,10 @@ public class PluginOperateUtils {
JSONObject latestPluginInfo = PluginUtils.getLatestPluginInfo(pluginMarker.getPluginID());
String latestPluginVersion = (String) latestPluginInfo.get("version");
PluginMarker toPluginMarker = PluginMarker.create(pluginMarker.getPluginID(), latestPluginVersion);
PluginTask pluginTask = PluginTask.updateTask(pluginMarker, toPluginMarker);
PluginControllerHelper.updateOnline(pluginMarker, toPluginMarker, new UpdateOnlineCallback(pluginTask, jsCallback));
//当前已经安装的相同ID插件marker
PluginMarker currentMarker = PluginUtils.getInstalledPluginMarkerByID(pluginMarker.getPluginID());
PluginTask pluginTask = PluginTask.updateTask(currentMarker, toPluginMarker);
PluginControllerHelper.updateOnline(currentMarker, toPluginMarker, new UpdateOnlineCallback(pluginTask, jsCallback));
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
@ -89,22 +91,29 @@ public class PluginOperateUtils {
}
}
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) {
SwingUtilities.invokeLater(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) {
new Thread(new Runnable() {
@Override
public void run() {
@ -128,6 +137,7 @@ public class PluginOperateUtils {
}
public static void searchPlugin(final String keyword, final JSCallback jsCallback) {
new Thread(new Runnable() {
@Override
public void run() {
@ -151,6 +161,7 @@ public class PluginOperateUtils {
}
public static void getPluginFromStore(final String category, final String seller, final String fee, final JSCallback jsCallback) {
new Thread(new Runnable() {
@Override
public void run() {
@ -180,7 +191,7 @@ public class PluginOperateUtils {
jsCallback.execute(result);
}
}
}).start();
}
@ -230,6 +241,7 @@ public class PluginOperateUtils {
}
public static void getPluginCategories(final JSCallback jsCallback) {
new Thread(new Runnable() {
@Override
public void run() {
@ -247,6 +259,7 @@ public class PluginOperateUtils {
}
public static void getPluginPrefix(final JSCallback jsCallback) {
new Thread(new Runnable() {
@Override
public void run() {

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

@ -11,6 +11,7 @@ import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.view.PluginView;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StableUtils;
@ -173,4 +174,13 @@ public class PluginUtils {
return ERROR_CODE_I18N_PREFIX + errorCode.getDescription();
}
public static PluginMarker getInstalledPluginMarkerByID(String pluginID) {
PluginContext context = PluginManager.getContext(pluginID);
if (context != null) {
return context.getMarker();
}
return null;
}
}

Loading…
Cancel
Save