diff --git a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java index b506dd81c3..1283c1ec82 100644 --- a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java @@ -1171,6 +1171,10 @@ public class MultiTemplateTabPane extends JComponent { return; } } + //参考CloseCurrentTemplateAction,在closeFormat与closeSpecifiedTemplate之前要先设定isCloseCurrent,这样关闭之后才会自动切换tab + if (checkCurrentClose(template)) { + setIsCloseCurrent(true); + } closeFormat(template); closeSpecifiedTemplate(template); DesignerContext.getDesignerFrame().getContentFrame().repaint(); @@ -1204,6 +1208,11 @@ public class MultiTemplateTabPane extends JComponent { } + private boolean checkCurrentClose(JTemplate template) { + JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + return currentTemplate != null && ComparatorUtils.equals(template.getPath(), currentTemplate.getPath()); + } + private class MultiTemplateTabMouseMotionListener implements MouseMotionListener { /** * 鼠标拖拽