From 38ab2d46119568edb00b81f63c9e66b2db395d68 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 21 Mar 2023 09:51:47 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-91743=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E5=85=B3=E9=97=AD=E6=A8=A1=E6=9D=BFA?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E5=BC=8F=E8=A7=A6=E5=8F=91=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=EF=BC=8C=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=A1=B5=E9=9D=A2=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E8=BF=98=E6=98=AF=E6=A8=A1=E6=9D=BFA=E7=9A=84?= =?UTF-8?q?=E5=86=85=E5=AE=B9=20=E5=90=8C=E6=AD=A510.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/file/MutilTempalteTabPane.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index 047420294a..08fb3a8689 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -766,8 +766,8 @@ public class MutilTempalteTabPane extends JComponent { // 如果关闭的模板是当前选中的模板,则重新激活当前 selectIndex 的模板; // selectIndex 没有变化,但是对应的模板已经变成了前一张模板 if (closeIconIndex == selectedIndex || isCloseCurrent) { - // 如果 closeIconIndex 是最后一个被渲染画出的,那么预览上一个,防止数组越界 - if (closeIconIndex >= maxPaintIndex) { + // 如果当前关闭的模板在最右侧,那么预览上一个,防止数组越界 + if (selectedIndex >= maxPaintIndex) { // selectIndex 不会 <0 因为如果关闭的是打开的最后一个模板,那么关闭之后 openedTemplate.isEmpty() = true selectedIndex--; } @@ -953,6 +953,10 @@ public class MutilTempalteTabPane extends JComponent { return; } } + //参考CloseCurrentTemplateAction,在closeFormat与closeSpecifiedTemplate之前要先设定isCloseCurrent,这样关闭之后才会自动切换tab + if (checkCurrentClose(template)) { + setIsCloseCurrent(true); + } closeFormat(template); closeSpecifiedTemplate(template); DesignerContext.getDesignerFrame().getContentFrame().repaint(); @@ -985,6 +989,12 @@ public class MutilTempalteTabPane extends JComponent { } + private boolean checkCurrentClose(JTemplate template) { + JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + //10.0无JTemplate.isValid + return currentTemplate != null && ComparatorUtils.equals(template.getPath(), currentTemplate.getPath()); + } + private class MultiTemplateTabMouseMotionListener implements MouseMotionListener { /**