Browse Source

Pull request #12294: REPORT-99073 插件管理整体优化-设计器内,批量禁用、启用插件没有效果

Merge in DESIGN/design from ~DESTINY.LIN/design:release/11.0 to release/11.0

* commit 'eb709d8024cc382020d5ccb379f116aa34d1852c':
  REPORT-99073 插件管理整体优化-设计器内,批量禁用、启用插件没有效果
release/11.0
parent
commit
1f8184254e
  1. 8
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 17
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  3. 41
      designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java
  4. 17
      designer-base/src/main/java/com/fr/design/login/config/DesignerLoginConfigManager.java
  5. 12
      designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java
  6. 7
      designer-base/src/main/java/com/fr/design/upm/UpmBridge.java
  7. 17
      designer-base/src/main/java/com/fr/design/upm/UpmBridgeV7.java

8
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -1021,6 +1021,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
designerLoginConfigManager.setUseOldVersionLogin(useOldVersionLogin);
}
public boolean isUseNewPluginFirst() {
return designerLoginConfigManager.isUseNewPluginFirst();
}
public void setUseNewPluginFirst(boolean useNewPluginFirst) {
designerLoginConfigManager.setUseNewPluginFirst(useNewPluginFirst);
}
/**
* 内置服务器是否使用时启动
*

17
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -811,8 +811,7 @@ public class PreferencePane extends BasicPane {
this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort()));
if (useOptimizedUPMCheckbox != null) {
useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM()
|| DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter());
useOptimizedUPMCheckbox.setSelected(checkOptimizedUPMUse());
}
if (useNewVersionLoginCheckbox != null) {
@ -856,6 +855,15 @@ public class PreferencePane extends BasicPane {
this.startupPageEnabledCheckBox.setSelected(designerEnvManager.isStartupPageEnabled());
}
private boolean checkOptimizedUPMUse() {
//如果是没手动配置过则默认开启
//isUseNewPluginFirst如果为true说明没手动配置过,直接开启
//走到这里说明checkBox不为空,机型肯定符合
return DesignerEnvManager.getEnvManager().isUseNewPluginFirst()
|| ServerPreferenceConfig.getInstance().isUseOptimizedUPM()
|| DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter();
}
private int chooseCase(int sign) {
switch (sign) {
case 0:
@ -913,7 +921,10 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setJoinProductImprove(this.joinProductImproveCheckBox.isSelected());
designerEnvManager.setEmbedServerLazyStartup(this.embedServerLazyStartupCheckBox.isSelected());
designerEnvManager.setImageCompress(this.imageCompressPanelCheckBox.isSelected());
designerEnvManager.setUseOptimizedUPM4Adapter(this.useOptimizedUPMCheckbox != null && this.useOptimizedUPMCheckbox.isSelected());
boolean optimizedUPMFlag = this.useOptimizedUPMCheckbox != null && this.useOptimizedUPMCheckbox.isSelected();
designerEnvManager.setUseOptimizedUPM4Adapter(optimizedUPMFlag);
//只有取消掉使用新插件管理器这个选项才需要把useNewPluginFirst置false(意味着用户手动配置了,如果勾选着的话,这个useNewPluginFirst为true就行了)
designerEnvManager.setUseNewPluginFirst(optimizedUPMFlag);
designerEnvManager.setCloudAnalyticsDelay(this.cloudAnalyticsDelayCheckBox.isSelected());
VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager();
vcsConfigManager.setSaveInterval(this.saveIntervalEditor.getValue());

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

@ -112,27 +112,7 @@ public class PluginOperateUtils {
}
/**
* 批量启用或禁用插件
*
* @param pluginIDs 要处理的插件信息
* @param jsCallback 回调函数
*/
public static void setPluginActive(JSArray pluginIDs, JSCallback jsCallback) {
SwingUtilities.invokeLater(new Runnable() {
@Override
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);
dealWithPluginActive(pluginMarker, modifyStatusCallback);
}
}
});
}
private static void dealWithPluginActive(PluginMarker pluginMarker, BatchModifyStatusCallback modifyStatusCallback) {
PluginContext plugin = PluginManager.getContext(pluginMarker);
@ -180,6 +160,27 @@ public class PluginOperateUtils {
});
}
/**
* 批量启用或禁用插件
*
* @param pluginIDs 要处理的插件信息
* @param jsCallback 回调函数
*/
public static void setPluginActive(List<String> pluginIDs, JSCallback jsCallback) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
int len = pluginIDs.size();
BatchModifyStatusCallback modifyStatusCallback = new BatchModifyStatusCallback(jsCallback, len);
for (String pluginInfo : pluginIDs) {
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
dealWithPluginActive(pluginMarker, modifyStatusCallback);
}
}
});
}
public static void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSCallback jsCallback) {
SwingUtilities.invokeLater(new Runnable() {

17
designer-base/src/main/java/com/fr/design/login/config/DesignerLoginConfigManager.java

@ -75,6 +75,13 @@ public class DesignerLoginConfigManager implements XMLReadable, XMLWriter {
*/
private boolean useOldVersionLogin = false;
/**
* 是否手动配置过新插件管理
* <li>11.0.18版本开始全部认为没有手动配置过,符合机型的都默认开启新插件管理,如果需要关闭需要再次手动配置</li>
* <li>如果手动配置过则置为false</li>
*/
private boolean useNewPluginFirst = true;
private DesignerLoginConfigManager() {
}
@ -103,6 +110,7 @@ public class DesignerLoginConfigManager implements XMLReadable, XMLWriter {
this.setLoginRemindBeforeJumpBBS(reader.getAttrAsBoolean("loginRemindBeforeJumpBBS", true));
this.setPluginRemindOnFirstLaunch(reader.getAttrAsBoolean("pluginRemindOnFirstLaunch", true));
this.setUseOldVersionLogin(reader.getAttrAsBoolean("useOldVersionLogin", false));
this.setUseNewPluginFirst(reader.getAttrAsBoolean("useNewPluginFirst", true));
}
}
@ -123,6 +131,7 @@ public class DesignerLoginConfigManager implements XMLReadable, XMLWriter {
writer.attr("loginRemindBeforeJumpBBS", loginRemindBeforeJumpBBS);
writer.attr("pluginRemindOnFirstLaunch", pluginRemindOnFirstLaunch);
writer.attr("useOldVersionLogin", useOldVersionLogin);
writer.attr("useNewPluginFirst", useNewPluginFirst);
writer.end();
}
@ -237,4 +246,12 @@ public class DesignerLoginConfigManager implements XMLReadable, XMLWriter {
public void setUseOldVersionLogin(boolean useOldVersionLogin) {
this.useOldVersionLogin = useOldVersionLogin;
}
public boolean isUseNewPluginFirst() {
return useNewPluginFirst;
}
public void setUseNewPluginFirst(boolean useNewPluginFirst) {
this.useNewPluginFirst = useNewPluginFirst;
}
}

12
designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java

@ -24,12 +24,18 @@ public class PMDialogAction implements OSBasedAction {
DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null);
return;
}
if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM()
|| SupportOSImpl.MACOS_NEW_PLUGIN_MANAGEMENT.support()
|| DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter()) {
if (checkUPMSupport()) {
UpmFinder.showUPMDialog();
} else {
WebViewDlgHelper.createPluginDialog();
}
}
private boolean checkUPMSupport() {
return ServerPreferenceConfig.getInstance().isUseOptimizedUPM()
|| SupportOSImpl.MACOS_NEW_PLUGIN_MANAGEMENT.support()
|| DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter()
//默认开启
|| DesignerEnvManager.getEnvManager().isUseNewPluginFirst();
}
}

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

@ -306,7 +306,12 @@ public class UpmBridge {
@JSBridge
public void setAllPluginActive(JSArray pluginIDs, final JSFunction callback) {
JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback));
PluginOperateUtils.setPluginActive(pluginIDs, jsCallback);
List<String> list = new ArrayList<>();
int len = pluginIDs.length();
for (int i = 0; i < len; i++) {
list.add(pluginIDs.get(i).asString().getValue());
}
PluginOperateUtils.setPluginActive(list, jsCallback);
}
/**

17
designer-base/src/main/java/com/fr/design/upm/UpmBridgeV7.java

@ -28,7 +28,7 @@ import com.fr.stable.StringUtils;
import com.teamdev.jxbrowser.js.JsAccessible;
import com.teamdev.jxbrowser.js.JsFunction;
import com.teamdev.jxbrowser.js.JsObject;
import com.teamdev.jxbrowser.js.internal.JsArrayImpl;
import javax.swing.JFileChooser;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
@ -265,6 +265,21 @@ public class UpmBridgeV7 extends UpmBridge {
PluginOperateUtils.uninstallPlugin(pluginInfo, isForce, jsCallback);
}
/**
* 批量修改选中的插件的活跃状态
*
* @param pluginIDs 要处理的插件ID
* @param callback 回调函数
*/
@JSBridge
@JsAccessible
public void setAllPluginActive(JsObject pluginIDs, final JsFunction callback) {
JSCallback jsCallback = new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback));
List array = ((JsArrayImpl) pluginIDs).toList();
PluginOperateUtils.setPluginActive(array, jsCallback);
}
/**
* 从插件服务器上安装插件
*

Loading…
Cancel
Save