@ -24,7 +24,6 @@ import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils ;
import com.fr.stable.StringUtils ;
import com.fr.third.org.apache.commons.io.FilenameUtils ;
import com.fr.third.org.apache.commons.io.FilenameUtils ;
import javax.swing.SwingWorker ;
import java.util.ArrayList ;
import java.util.ArrayList ;
import java.util.Collections ;
import java.util.Collections ;
import java.util.HashMap ;
import java.util.HashMap ;
@ -44,7 +43,6 @@ public class HistoryTemplateListCache implements CallbackEvent {
private static final int DEAD_LINE = DesignerEnvManager . getEnvManager ( ) . getCachingTemplateLimit ( ) ;
private static final int DEAD_LINE = DesignerEnvManager . getEnvManager ( ) . getCachingTemplateLimit ( ) ;
private List < JTemplate < ? , ? > > historyList ;
private List < JTemplate < ? , ? > > historyList ;
private JTemplate < ? , ? > editingTemplate ;
private JTemplate < ? , ? > editingTemplate ;
private SwingWorker < Boolean , Void > stashWorker ;
public static HistoryTemplateListCache getInstance ( ) {
public static HistoryTemplateListCache getInstance ( ) {
return Holder . INSTANCE ;
return Holder . INSTANCE ;
@ -342,14 +340,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
* @see HistoryTemplateListCache # load ( )
* @see HistoryTemplateListCache # load ( )
* /
* /
public void stash ( ) {
public void stash ( ) {
stashWorker = new SwingWorker < Boolean , Void > ( ) {
_stash ( ) ;
@Override
protected Boolean doInBackground ( ) throws Exception {
_stash ( ) ;
return true ;
}
} ;
stashWorker . execute ( ) ;
}
}
private void _stash ( ) {
private void _stash ( ) {
@ -370,16 +361,6 @@ public class HistoryTemplateListCache implements CallbackEvent {
FineLoggerFactory . getLogger ( ) . info ( "Env Change Template Stashed." ) ;
FineLoggerFactory . getLogger ( ) . info ( "Env Change Template Stashed." ) ;
}
}
private boolean checkStash ( ) {
try {
return stashWorker . get ( ) ;
} catch ( Exception e ) {
FineLoggerFactory . getLogger ( ) . debug ( e . getMessage ( ) , e ) ;
return false ;
}
}
/ * *
/ * *
* 切换环境前将正在编辑的模板暂存起来后 , 在新环境重新读取一遍
* 切换环境前将正在编辑的模板暂存起来后 , 在新环境重新读取一遍
* < p >
* < p >
@ -388,9 +369,6 @@ public class HistoryTemplateListCache implements CallbackEvent {
* @see HistoryTemplateListCache # stash ( )
* @see HistoryTemplateListCache # stash ( )
* /
* /
public void load ( ) {
public void load ( ) {
if ( ! checkStash ( ) ) {
return ;
}
FineLoggerFactory . getLogger ( ) . info ( "Env Change Template Loading..." ) ;
FineLoggerFactory . getLogger ( ) . info ( "Env Change Template Loading..." ) ;
if ( stashFILEMap ! = null & & stashFILEMap . size ( ) ! = 0 ) {
if ( stashFILEMap ! = null & & stashFILEMap . size ( ) ! = 0 ) {
int size = historyList . size ( ) ;
int size = historyList . size ( ) ;