Browse Source

REPORT-46584 【10.0.13冒烟】设计器卡死

feature/big-screen
lucian 4 years ago
parent
commit
e323ac4dc0
  1. 25
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

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

Loading…
Cancel
Save