Browse Source

Pull request #6754: REPORT-62680 插件-插件管理-设计器里没有适配禁用提示

Merge in DESIGN/design from ~YVAN/design:release/11.0 to release/11.0

* commit '3e6b0f874e3928d485c059ac61b8010a2fb30a99':
  REPORT-62680 插件-插件管理-设计器里没有适配禁用提示 代码质量问题
  REPORT-62680 插件-插件管理-设计器里没有适配禁用提示 【问题原因】设计器里没适配 【改动思路】1. 适配下弹窗提示;2. 之前把forbid-reminder放到PluginView里还是不合适,换成通过xml获取的方式 【review建议】无
bugfix/11.0
Yvan 3 years ago
parent
commit
6d2d495ffd
  1. 42
      designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java

42
designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java

@ -25,6 +25,8 @@ import com.fr.plugin.manage.control.PluginTask;
import com.fr.plugin.manage.control.PluginTaskCallback; import com.fr.plugin.manage.control.PluginTaskCallback;
import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.manage.control.PluginTaskResult;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
import com.fr.plugin.xml.PluginElementName;
import com.fr.plugin.xml.PluginXmlElement;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
@ -91,15 +93,37 @@ public class PluginOperateUtils {
public static void setPluginActive(String pluginInfo, JSCallback jsCallback) { public static void setPluginActive(String pluginInfo, JSCallback jsCallback) {
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); SwingUtilities.invokeLater(new Runnable() {
PluginContext plugin = PluginManager.getContext(pluginMarker);
boolean active = plugin.isActive(); @Override
PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(active, jsCallback); public void run() {
if (active) { PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); PluginContext plugin = PluginManager.getContext(pluginMarker);
} else { boolean active = plugin.isActive();
PluginManager.getController().enable(pluginMarker, modifyStatusCallback); PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(active, jsCallback);
} if (active) {
PluginXmlElement forbidReminder = plugin.getXml().getElement(PluginElementName.ForbidReminder);
if (forbidReminder != null && forbidReminder.getContent() != null) {
// 禁用前提示
int rv = FineJOptionPane.showConfirmDialog(
null,
forbidReminder.getContent(),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.WARNING_MESSAGE
);
if (rv == JOptionPane.OK_OPTION) {
PluginManager.getController().forbid(pluginMarker, modifyStatusCallback);
}
} else {
// 正常禁用
PluginManager.getController().forbid(pluginMarker, modifyStatusCallback);
}
} else {
PluginManager.getController().enable(pluginMarker, modifyStatusCallback);
}
}
});
} }
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) {

Loading…
Cancel
Save