Browse Source

Pull request #12222: REPORT-89867 【降本增效】插件管理优化

Merge in DESIGN/design from ~DESTINY.LIN/design:feature/x to feature/x

* commit '609e9ce595488b0da58b4ad326d69b15c217576c':
  REPORT-89867 【降本增效】插件管理优化 优化代码
  REPORT-89867 【降本增效】插件管理优化 去除两次for循环
  REPORT-89867 【降本增效】插件管理优化
  REPORT-89867 【降本增效】插件管理优化
  REPORT-89867 【降本增效】插件管理优化
  REPORT-89867 【降本增效】插件管理优化
  REPORT-89867 【降本增效】插件管理优化
  REPORT-89867 【降本增效】插件管理优化
feature/x
parent
commit
46694d80e8
  1. 184
      designer-base/src/main/java/com/fr/design/extra/PluginBatchModifyDetailPane.java
  2. 69
      designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java
  3. 127
      designer-base/src/main/java/com/fr/design/extra/exe/callback/AbstractBatchModifyStatusCallback.java
  4. 43
      designer-base/src/main/java/com/fr/design/extra/exe/callback/BatchModifyStatusCallback.java
  5. 77
      designer-base/src/main/java/com/fr/design/extra/exe/callback/BatchUpdateOnlineCallback.java
  6. 13
      designer-base/src/main/java/com/fr/design/upm/UpmBridge.java

184
designer-base/src/main/java/com/fr/design/extra/PluginBatchModifyDetailPane.java

@ -0,0 +1,184 @@
package com.fr.design.extra;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
* 插件批量处理弹窗面板
*
* @author Destiny.Lin
* @since 11.0
* Created on 2023/5/19
*/
public class PluginBatchModifyDetailPane {
private UILabel message = new UILabel();
private UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK"));
private UILabel uiLabel = new UILabel();
private UILabel directUiLabel = new UILabel();
private UILabel detailLabel = new UILabel();
private JPanel upPane;
private JPanel midPane;
private JPanel downPane;
private JPanel hiddenPanel;
private JTextArea jta;
private JDialog dialog;
/**
* 弹窗面板默认大小
*/
public static final Dimension DEFAULT = new Dimension(380, 150);
/**
* 弹窗面板展开大小
*/
public static final Dimension DEFAULT_PRO = new Dimension(380, 270);
public PluginBatchModifyDetailPane(Dialog parent) {
init(parent);
}
private void init(Dialog parent) {
message.setBorder(BorderFactory.createEmptyBorder(8, 5, 0, 0));
dialog = new JDialog(parent, Toolkit.i18nText("Fine-Design_Basic_Plugin_Manager"), true);
dialog.setSize(DEFAULT);
JPanel jp = new JPanel();
initUpPane();
initDownPane();
initMidPane();
initHiddenPanel();
initListener();
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
jp.add(upPane);
jp.add(midPane);
jp.add(hiddenPanel);
jp.add(downPane);
hiddenPanel.setVisible(false);
dialog.add(jp);
dialog.setResizable(false);
dialog.setLocationRelativeTo(SwingUtilities.getWindowAncestor(parent));
}
private void initDownPane() {
downPane = new JPanel();
downPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 15, 9));
downPane.add(cancelButton);
}
private void initUpPane() {
upPane = new JPanel();
uiLabel = new UILabel(UIManager.getIcon("OptionPane.errorIcon"));
upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
upPane.add(uiLabel);
upPane.add(message);
}
private void initMidPane() {
midPane = new JPanel();
midPane.add(directUiLabel);
midPane.add(detailLabel);
midPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 0));
detailLabel.setText(Toolkit.i18nText("Fine_Designer_Look_Detail"));
detailLabel.setForeground(Color.BLUE);
detailLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.right"));
}
private void initHiddenPanel() {
hiddenPanel = new JPanel();
hiddenPanel.setLayout(new BorderLayout(2, 0));
hiddenPanel.add(new JPanel(), BorderLayout.WEST);
hiddenPanel.add(new JPanel(), BorderLayout.EAST);
JPanel borderPanel = new JPanel();
borderPanel.setLayout(new BorderLayout());
jta = new JTextArea();
JScrollPane jsp = new JScrollPane(jta);
jsp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jta.setEditable(false);
borderPanel.add(jsp, BorderLayout.CENTER);
hiddenPanel.add(borderPanel);
}
/**
* 补充更详细的报错信息
*
* @param message 信息
*/
public void updateDetailArea(String message) {
jta.append(message + "\n");
}
private void initListener() {
detailLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (hiddenPanel.isVisible()) {
hiddenPanel.setVisible(false);
dialog.setSize(DEFAULT);
detailLabel.setText(Toolkit.i18nText("Fine_Designer_Look_Detail"));
directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.right"));
} else {
dialog.setSize(DEFAULT_PRO);
hiddenPanel.setVisible(true);
detailLabel.setText(Toolkit.i18nText("Fine_Designer_Hide_Detail"));
directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.down"));
}
}
});
cancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
hiddenPanel.removeAll();
dialog.dispose();
}
});
}
/**
* 更新标题
* @param title 标题
*/
public void updateTitle(String title) {
dialog.setTitle(title);
}
/**
* 更新展示信息
*
* @param failedCount 处理失败个数
* @param successCount 处理成功个数
*/
public void updateMessage(int failedCount, int successCount) {
message.setText(Toolkit.i18nText("Fine-Design_Basic_Plugin_Batch_Modify_Info", failedCount, successCount));
}
/**
* 显示面板
*/
public void show() {
dialog.setVisible(true);
}
}

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

@ -3,6 +3,8 @@ package com.fr.design.extra;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.bridge.exec.JSCallback; import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.exe.callback.BatchModifyStatusCallback;
import com.fr.design.extra.exe.callback.BatchUpdateOnlineCallback;
import com.fr.design.extra.exe.callback.InstallFromDiskCallback; import com.fr.design.extra.exe.callback.InstallFromDiskCallback;
import com.fr.design.extra.exe.callback.InstallOnlineCallback; import com.fr.design.extra.exe.callback.InstallOnlineCallback;
import com.fr.design.extra.exe.callback.ModifyStatusCallback; import com.fr.design.extra.exe.callback.ModifyStatusCallback;
@ -28,11 +30,13 @@ import com.fr.plugin.view.PluginView;
import com.fr.plugin.xml.PluginElementName; import com.fr.plugin.xml.PluginElementName;
import com.fr.plugin.xml.PluginXmlElement; import com.fr.plugin.xml.PluginXmlElement;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.teamdev.jxbrowser.chromium.JSArray;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import java.io.File; import java.io.File;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -65,12 +69,14 @@ public class PluginOperateUtils {
public static void updatePluginOnline(List<PluginMarker> pluginMarkerList, JSCallback jsCallback) { public static void updatePluginOnline(List<PluginMarker> pluginMarkerList, JSCallback jsCallback) {
for (int i = 0; i < pluginMarkerList.size(); i++) { int size = pluginMarkerList.size();
updatePluginOnline(pluginMarkerList.get(i), jsCallback); BatchUpdateOnlineCallback batchUpdateOnlineCallback = new BatchUpdateOnlineCallback(jsCallback, size);
for (int i = 0; i < size; i++) {
updatePluginOnline(pluginMarkerList.get(i), jsCallback, batchUpdateOnlineCallback);
} }
} }
public static void updatePluginOnline(PluginMarker pluginMarker, JSCallback jsCallback) { private static void updatePluginOnline(PluginMarker pluginMarker, JSCallback jsCallback, BatchUpdateOnlineCallback batchUpdateOnlineCallback) {
try { try {
JSONObject latestPluginInfo = PluginUtils.getLatestPluginInfo(pluginMarker.getPluginID()); JSONObject latestPluginInfo = PluginUtils.getLatestPluginInfo(pluginMarker.getPluginID());
String latestPluginVersion = latestPluginInfo.getString("version"); String latestPluginVersion = latestPluginInfo.getString("version");
@ -79,11 +85,25 @@ public class PluginOperateUtils {
//当前已经安装的相同ID插件marker //当前已经安装的相同ID插件marker
PluginMarker currentMarker = PluginMarkerAdapter.create(PluginUtils.getInstalledPluginMarkerByID(pluginMarker.getPluginID()), pluginName); PluginMarker currentMarker = PluginMarkerAdapter.create(PluginUtils.getInstalledPluginMarkerByID(pluginMarker.getPluginID()), pluginName);
PluginTask pluginTask = PluginTask.updateTask(currentMarker, toPluginMarker); PluginTask pluginTask = PluginTask.updateTask(currentMarker, toPluginMarker);
if (!batchUpdateOnlineCallback.equals(BatchUpdateOnlineCallback.NONE)) {
batchUpdateOnlineCallback.createInnerPreTaskCallback(pluginTask, jsCallback);
PluginControllerHelper.updateOnline(currentMarker, toPluginMarker, batchUpdateOnlineCallback.getInnerPreTaskCallback(), PluginExtraInfo.newBuilder().username(DesignerEnvManager.getEnvManager().getDesignerLoginUsername()).build());
} else {
PluginControllerHelper.updateOnline(currentMarker, toPluginMarker, new UpdateOnlineCallback(pluginTask, jsCallback), PluginExtraInfo.newBuilder().username(DesignerEnvManager.getEnvManager().getDesignerLoginUsername()).build()); PluginControllerHelper.updateOnline(currentMarker, toPluginMarker, new UpdateOnlineCallback(pluginTask, jsCallback), PluginExtraInfo.newBuilder().username(DesignerEnvManager.getEnvManager().getDesignerLoginUsername()).build());
}
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
}
/**
* 更新插件
*
* @param pluginMarker 插件marker
* @param jsCallback 回调
*/
public static void updatePluginOnline(PluginMarker pluginMarker, JSCallback jsCallback) {
updatePluginOnline(pluginMarker, jsCallback, BatchUpdateOnlineCallback.NONE);
} }
@ -92,15 +112,37 @@ public class PluginOperateUtils {
} }
public static void setPluginActive(String pluginInfo, JSCallback jsCallback) { /**
* 批量启用或禁用插件
*
* @param pluginIDs 要处理的插件信息
* @param jsCallback 回调函数
*/
public static void setPluginActive(JSArray pluginIDs, JSCallback jsCallback) {
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override @Override
public void run() { public void run() {
int len = pluginIDs.length();
BatchModifyStatusCallback modifyStatusCallback = new BatchModifyStatusCallback(jsCallback, len);
for (int i = 0; i < len; i++) {
String pluginInfo = pluginIDs.get(i).asString().getValue();
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
dealWithPluginActive(pluginMarker, modifyStatusCallback);
}
}
});
}
private static void dealWithPluginActive(PluginMarker pluginMarker, BatchModifyStatusCallback modifyStatusCallback) {
PluginContext plugin = PluginManager.getContext(pluginMarker); PluginContext plugin = PluginManager.getContext(pluginMarker);
boolean isRunning = plugin.isRunning(); boolean running = plugin.isRunning();
PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(isRunning, jsCallback); modifyStatusCallback.updateActiveStatus(running);
changePluginActive(running, pluginMarker, modifyStatusCallback, plugin);
}
private static void changePluginActive(boolean isRunning, PluginMarker pluginMarker, PluginTaskCallback modifyStatusCallback, PluginContext plugin) {
if (isRunning) { if (isRunning) {
PluginXmlElement forbidReminder = plugin.getXml().getElement(PluginElementName.ForbidReminder); PluginXmlElement forbidReminder = plugin.getXml().getElement(PluginElementName.ForbidReminder);
if (forbidReminder != null && forbidReminder.getContent() != null) { if (forbidReminder != null && forbidReminder.getContent() != null) {
@ -123,6 +165,18 @@ public class PluginOperateUtils {
PluginManager.getController().enablePersistently(pluginMarker, modifyStatusCallback); PluginManager.getController().enablePersistently(pluginMarker, modifyStatusCallback);
} }
} }
public static void setPluginActive(String pluginInfo, JSCallback jsCallback) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
PluginContext plugin = PluginManager.getContext(pluginMarker);
boolean isRunning = plugin.isRunning();
PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(isRunning, jsCallback);
changePluginActive(isRunning, pluginMarker, modifyStatusCallback, plugin);
}
}); });
} }
@ -255,8 +309,7 @@ public class PluginOperateUtils {
private static String getPluginName(PluginContext pluginContext, PluginMarker pluginMarker) { private static String getPluginName(PluginContext pluginContext, PluginMarker pluginMarker) {
if (pluginContext != null) { if (pluginContext != null) {
return pluginContext.getName(); return pluginContext.getName();
} } else if (pluginMarker instanceof PluginMarkerAdapter) {
else if (pluginMarker instanceof PluginMarkerAdapter) {
return ((PluginMarkerAdapter) pluginMarker).getPluginName(); return ((PluginMarkerAdapter) pluginMarker).getPluginName();
} }
return pluginMarker == null ? StringUtils.EMPTY : pluginMarker.getPluginID(); return pluginMarker == null ? StringUtils.EMPTY : pluginMarker.getPluginID();

127
designer-base/src/main/java/com/fr/design/extra/exe/callback/AbstractBatchModifyStatusCallback.java

@ -0,0 +1,127 @@
package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginBatchModifyDetailPane;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.design.plugin.DesignerPluginContext;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.manage.control.PluginTask;
import com.fr.plugin.manage.control.PluginTaskResult;
import com.fr.plugin.manage.control.ProgressCallback;
import com.fr.stable.StringUtils;
import javax.swing.JOptionPane;
import java.util.HashMap;
import java.util.Map;
/**
* 带进度条的批量处理的callback
* <li> content与title是处理完成后弹出的面板的内容与标题子类需要在done之前设定好对应的信息
* <li> 进度条是以 当前完成任务数/总任务数 来计算的
*
* @author Destiny.Lin
* @since 11.0
* Created on 2023/6/6
*/
public abstract class AbstractBatchModifyStatusCallback implements ProgressCallback {
protected JSCallback jsCallback;
protected Map<String, String> resultMap = new HashMap<>();
protected String content = StringUtils.EMPTY;
protected String title = StringUtils.EMPTY;
public int pluginCount = 0;
public int allPluginCount = 0;
public int successCount = 0;
public int failedCount = 0;
public static final int HUNDRED_PERCENT = 100;
public static final String PERCENT = "%";
public static final String DEFAULT = "default";
public AbstractBatchModifyStatusCallback() {
}
public AbstractBatchModifyStatusCallback(JSCallback jsCallback, int size) {
this.jsCallback = jsCallback;
this.allPluginCount = size;
}
@Override
public void done(PluginTaskResult result) {
String pluginInfo = PluginOperateUtils.getSuccessInfo(result);
if (result.isSuccess()) {
successCount++;
String modifyMessage = updateMessage(pluginInfo);
FineLoggerFactory.getLogger().info(modifyMessage);
} else {
failedCount++;
resultMap.put(getPluginName(result), pluginInfo);
}
updateProgressAndCheckCompletion();
}
/**
* 获取插件名
*
* @param result 任务结果
* @return 插件名
*/
public String getPluginName(PluginTaskResult result) {
PluginTask pluginTask = result.getCurrentTask();
if (pluginTask != null) {
PluginMarker pluginMarker = pluginTask.getToMarker();
if (pluginMarker != null) {
return pluginMarker.getPluginID();
}
}
return DEFAULT;
}
/**
* 更新当前Map状态,进度条,如果全部都更新完了就回调
*/
public void updateProgressAndCheckCompletion() {
pluginCount++;
updateProgress(StringUtils.EMPTY, (double) pluginCount / allPluginCount);
if (pluginCount == allPluginCount) {
jsCallback.execute("success");
showMessageDialog();
}
}
/**
* 展示信息面板
*/
public void showMessageDialog() {
if (failedCount == 0) {
FineJOptionPane.showMessageDialog(DesignerPluginContext.getPluginDialog(),
content,
title,
JOptionPane.INFORMATION_MESSAGE);
} else {
PluginBatchModifyDetailPane detailPane = new PluginBatchModifyDetailPane(DesignerPluginContext.getPluginDialog());
for (String key : resultMap.keySet()) {
detailPane.updateDetailArea(resultMap.get(key));
}
detailPane.updateMessage(failedCount, successCount);
detailPane.updateTitle(title);
detailPane.show();
}
}
@Override
public void updateProgress(String description, double progress) {
jsCallback.execute(progress * HUNDRED_PERCENT + PERCENT);
}
/**
* 更新处理成功返回的日志信息
*
* @return 返回的日志信息
*/
abstract public String updateMessage(String pluginInfo);
}

43
designer-base/src/main/java/com/fr/design/extra/exe/callback/BatchModifyStatusCallback.java

@ -0,0 +1,43 @@
package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.i18n.Toolkit;
/**
* 批量启用/禁用插件的Callback
*
* @author Destiny.Lin
* @since 11.0
* Created on 2023/5/18
*/
public class BatchModifyStatusCallback extends AbstractBatchModifyStatusCallback {
private boolean active;
private boolean operatorFlag = false;
public BatchModifyStatusCallback(JSCallback jsCallback, int size) {
super(jsCallback, size);
}
@Override
public String updateMessage(String pluginInfo) {
return active ? pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Disabled_Duplicate") : pluginInfo + Toolkit.i18nText("Fine-Design_Plugin_Has_Been_Actived_Duplicate");
}
/**
* 更新启用/禁用信息
*
* @param active
*/
public void updateActiveStatus(boolean active) {
if (!operatorFlag) {
this.active = active;
this.operatorFlag = true;
this.title = active ? Toolkit.i18nText("Fine-Design_Basic_Plugin_Stop") : Toolkit.i18nText("Fine-Design_Basic_Plugin_Start");
this.content = active ? Toolkit.i18nText("Fine-Design_Basic_Plugin_Batch_Modify_Stop_Success") : Toolkit.i18nText("Fine-Design_Basic_Plugin_Batch_Modify_Start_Success");
}
}
}

77
designer-base/src/main/java/com/fr/design/extra/exe/callback/BatchUpdateOnlineCallback.java

@ -0,0 +1,77 @@
package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.manage.control.PluginTask;
import com.fr.plugin.manage.control.PluginTaskResult;
/**
* 批量更新的callback
*
* @author Destiny.Lin
* @since 11.0
* Created on 2023/6/6
*/
public class BatchUpdateOnlineCallback extends AbstractBatchModifyStatusCallback{
public static final BatchUpdateOnlineCallback NONE = new BatchUpdateOnlineCallback();
/**
* 可自动处理前置任务的callback用来处理实际更新逻辑
*/
private InnerUpdateCallback innerPreTaskCallback;
public BatchUpdateOnlineCallback() {
}
public BatchUpdateOnlineCallback(JSCallback jsCallback, int size) {
super(jsCallback, size);
this.title = Toolkit.i18nText("Fine-Design_Basic_Plugin_Update");
this.content = Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success");
}
/**
* 更新任务
*
* @param pluginTask 任务
* @param jsCallback callback
*/
public void createInnerPreTaskCallback(PluginTask pluginTask, JSCallback jsCallback) {
innerPreTaskCallback = new InnerUpdateCallback(pluginTask, jsCallback);
}
public InnerUpdateCallback getInnerPreTaskCallback() {
return innerPreTaskCallback;
}
@Override
public String updateMessage(String pluginInfo) {
return pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success");
}
/**
* 可自动处理前置任务的callback用来处理实际更新逻辑
*/
public class InnerUpdateCallback extends UpdateOnlineCallback {
public InnerUpdateCallback(PluginTask pluginTask, JSCallback jsCallback) {
super(pluginTask, jsCallback);
}
@Override
public void updateProgress(String description, double aProgress) {
//不进行处理
}
@Override
public void allDone(PluginTaskResult result) {
BatchUpdateOnlineCallback.this.done(result);
}
}
}

13
designer-base/src/main/java/com/fr/design/upm/UpmBridge.java

@ -40,6 +40,7 @@ import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.JSArray; import com.teamdev.jxbrowser.chromium.JSArray;
import com.teamdev.jxbrowser.chromium.JSFunction; import com.teamdev.jxbrowser.chromium.JSFunction;
import com.teamdev.jxbrowser.chromium.JSObject; import com.teamdev.jxbrowser.chromium.JSObject;
import com.teamdev.jxbrowser.chromium.JSValue;
import java.awt.Desktop; import java.awt.Desktop;
import javax.swing.JFileChooser; import javax.swing.JFileChooser;
@ -291,6 +292,18 @@ public class UpmBridge {
PluginOperateUtils.setPluginActive(pluginID, jsCallback); PluginOperateUtils.setPluginActive(pluginID, jsCallback);
} }
/**
* 批量修改选中的插件的活跃状态
*
* @param pluginIDs 要处理的插件ID
* @param callback 回调函数
*/
@JSBridge
public void setAllPluginActive(JSArray pluginIDs, final JSFunction callback) {
JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback));
PluginOperateUtils.setPluginActive(pluginIDs, jsCallback);
}
/** /**
* 选择文件对话框 * 选择文件对话框
* *

Loading…
Cancel
Save