Browse Source

Pull request #3322: REPORT-46892 切换目录有插件版本不匹配目录配置页面显示问题 & REPORT-46584 设计器卡死

Merge in DESIGN/design from ~LUCIAN.CHEN/design:release/10.0 to release/10.0

* commit '380cf6ab675a00ca975ac90de0cd8e39cf525d9a':
  REPORT-46892 切换目录有插件版本不匹配目录配置页面显示问题
  REPORT-46584 【10.0.13冒烟】设计器卡死
  REPORT-46892 【冒烟】切换到本地目录有插件版本不匹配时,远程配置页面会消失的比较慢
feature/big-screen
Lucian.Chen 4 years ago
parent
commit
d8bac391fe
  1. 11
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 39
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  3. 15
      designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java

11
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -310,8 +310,15 @@ public class EnvChangeEntrance {
String content = PluginErrorRemindHandler.pluginErrorContent();
if (StringUtils.isNotEmpty(content)) {
PluginErrorRemindDialog dialog = new PluginErrorRemindDialog(DesignerContext.getDesignerFrame(), content);
dialog.setVisible(true);
// 该操作需要在当前awt操作之后执行,使用SwingUtilities.invokeLater将其置于awt操作对列末尾
// 若使用UIUtil.invokeLaterIfNeeded,会立即执行,影响其他UI操作
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
PluginErrorRemindDialog dialog = new PluginErrorRemindDialog(DesignerContext.getDesignerFrame(), content);
dialog.setVisible(true);
}
});
}
}

39
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -47,7 +47,6 @@ import com.fr.design.menu.MenuDef;
import com.fr.design.menu.NameSeparator;
import com.fr.design.menu.ShortCut;
import com.fr.design.preview.PagePreview;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.write.submit.DBManipulationInWidgetEventPane;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.event.EventDispatcher;
@ -80,6 +79,7 @@ import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.undo.UndoManager;
import java.util.ArrayList;
@ -340,17 +340,34 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public void refreshResource(FILE file) {
try {
this.template = JTemplateFactory.asIOFile(file, this.suffix());
setTarget(this.template);
// 先移除旧的。
removeCenterPane();
// 加入新的
addCenterPane();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
setTargetByFile(file);
return null;
}
@Override
public void done() {
try {
get();
// 先移除旧的。
removeCenterPane();
// 加入新的
addCenterPane();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}.execute();
}
private void setTargetByFile(FILE file) {
this.template = JTemplateFactory.asIOFile(file, this.suffix());
setTarget(this.template);
}
private void addCenterPane() {

15
designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java

@ -116,31 +116,22 @@ public class EnvChangeEntranceTest {
Workspace workspace = EasyMock.mock(Workspace.class);
EasyMock.expect(workspace.isLocal()).andReturn(false).once();
EasyMock.expect(workspace.isLocal()).andReturn(true).times(2);
EasyMock.expect(workspace.isLocal()).andReturn(true).once();
PowerMock.mockStatic(WorkContext.class);
EasyMock.expect(WorkContext.getCurrent()).andReturn(workspace).anyTimes();
PowerMock.mockStatic(PluginErrorRemindHandler.class);
EasyMock.expect(PluginErrorRemindHandler.pluginErrorContent()).andReturn("").once();
EasyMock.expect(PluginErrorRemindHandler.pluginErrorContent()).andReturn("111").once();
PluginErrorRemindDialog dialog = EasyMock.mock(PluginErrorRemindDialog.class);
PowerMock.expectNew(PluginErrorRemindDialog.class, EasyMock.anyObject(Frame.class), EasyMock.anyString()).andReturn(dialog).once();
dialog.setVisible(true);
EasyMock.expectLastCall();
EasyMock.replay(workspace, dialog);
EasyMock.replay(workspace);
PowerMock.replayAll();
EnvChangeEntrance entrance = EnvChangeEntrance.getInstance();
entrance.pluginErrorRemind();
entrance.pluginErrorRemind();
entrance.pluginErrorRemind();
EasyMock.verify(workspace, dialog);
EasyMock.verify(workspace);
PowerMock.verifyAll();
} catch (Exception e) {
Assert.fail();

Loading…
Cancel
Save