@ -384,7 +384,8 @@ public class MultiTemplateTabPane extends JComponent {
* 关闭所有指定模板tab操作类型的模板
* @param operatorType
* /
public void closeAllByOperatorType ( String operatorType ) {
public void closeOtherByOperatorType ( String operatorType ) {
JTemplate < ? , ? > currentEditingTemplate = HistoryTemplateListCache . getInstance ( ) . getCurrentEditingTemplate ( ) ;
SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane ( false ) ;
if ( saveSomeTempaltePane . showSavePane ( ) ) {
List < JTemplate < ? , ? > > openedTemplate = HistoryTemplateListCache . getInstance ( ) . getHistoryList ( ) ;
@ -393,26 +394,24 @@ public class MultiTemplateTabPane extends JComponent {
for ( int i = 0 ; i < openedTemplate . size ( ) ; i + + ) {
templates [ i ] = openedTemplate . get ( i ) ;
}
closeTemplate ( templates , operatorType ) ;
closeTemplate ( templates , currentEditingTemplate , operatorType ) ;
if ( openedTemplate . size ( ) = = 0 ) {
DesignerContext . getDesignerFrame ( ) . addAndActivateJTemplate ( ) ;
} else {
DesignerContext . getDesignerFrame ( ) . activateJTemplate ( openedTemplate . get ( 0 ) ) ;
}
DesignerContext . getDesignerFrame ( ) . activateJTemplate ( currentEditingTemplate ) ;
MultiTemplateTabPane . getInstance ( ) . repaint ( ) ;
}
}
/ * *
* 关闭指定模板
* 关闭指定的非当前编辑 模板
* @param templates
* @param operatorType
* /
private static void closeTemplate ( JTemplate < ? , ? > [ ] templates , String operatorType ) {
private static void closeTemplate ( JTemplate < ? , ? > [ ] templates , JTemplate < ? , ? > currentEditingTemplate , String operatorType ) {
for ( int i = 0 ; i < templates . length ; i + + ) {
JTemplate < ? , ? > jTemplate = templates [ i ] ;
if ( ! ComparatorUtils . equals ( operatorType , jTemplate . getTemplateTabOperatorType ( ) ) ) {
boolean needClose = ComparatorUtils . equals ( operatorType , jTemplate . getTemplateTabOperatorType ( ) )
& & jTemplate ! = currentEditingTemplate ;
if ( ! needClose ) {
continue ;
}
MultiTemplateTabPane . getInstance ( ) . closeFormat ( jTemplate ) ;