diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 4007be8a31..a47a6095de 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/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> 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() { + + @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() {