Browse Source

Pull request #3321: REPORT-46585 切换工作目录时 先移除后添加插件监听

Merge in DESIGN/design from ~HADES/design:release/10.0 to release/10.0

* commit 'fc501390c274dc90f2ce0d21fe8972e2b49e1a99':
  REPORT-46585 fix 单个插件监听逻辑保持与之前一致
  REPORT-46585 切换工作目录时 先移除后添加插件监听
feature/big-screen
Hades 4 years ago
parent
commit
c460415b6b
  1. 38
      designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java

38
designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java

@ -39,6 +39,23 @@ public class PluginClassRefreshManager {
}
};
private final PluginEventListener beforeAllPluginActive = new PluginEventListener() {
@Override
public void on(PluginEvent event) {
PluginListenerRegistration.getInstance().stopListen(pluginAfterRunEventListener);
}
};
private final PluginEventListener afterAllPluginsActive = new PluginEventListener() {
@Override
public void on(PluginEvent event) {
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, pluginAfterRunEventListener);
if (DesignerLaunchStatus.getStatus() != DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE) {
HistoryTemplateListCache.getInstance().reloadAllEditingTemplate();
}
}
};
public static PluginClassRefreshManager getInstance() {
return INSTANCE;
@ -50,29 +67,20 @@ public class PluginClassRefreshManager {
}
private PluginClassRefreshManager() {
PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, new PluginEventListener() {
@Override
public void on(PluginEvent event) {
removePluginListener();
}
});
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, new PluginEventListener() {
@Override
public void on(PluginEvent event) {
addPluginListener();
if (DesignerLaunchStatus.getStatus() != DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE) {
HistoryTemplateListCache.getInstance().reloadAllEditingTemplate();
}
}
});
PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, beforeAllPluginActive);
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, afterAllPluginsActive);
}
public void removePluginListener() {
PluginListenerRegistration.getInstance().stopListen(this.pluginAfterRunEventListener);
PluginListenerRegistration.getInstance().stopListen(this.beforeAllPluginActive);
PluginListenerRegistration.getInstance().stopListen(this.afterAllPluginsActive);
}
public void addPluginListener() {
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginAfterRunEventListener);
PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, beforeAllPluginActive);
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, afterAllPluginsActive);
}
}

Loading…
Cancel
Save