diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java index 7716de32ef..cc5ef1f48a 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java @@ -27,10 +27,7 @@ import com.fr.stable.xml.XMLTools; import com.fr.stable.xml.XMLableReader; import java.io.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * Created by XiaXiang on 2017/5/15. @@ -226,12 +223,15 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear if (ComparatorUtils.equals(key, searchText)) { recentModelList = recentKVModelMap.get(searchText); List resultModelList = new ArrayList<>(recentModelList); - int size = resultModelList.size(); - for (AlphaCellModel model : resultModelList) { + Iterator modelIterator = resultModelList.iterator(); + while (modelIterator.hasNext()) { + AlphaCellModel model = modelIterator.next(); if (model.getType() == CellType.ACTION && !((ActionModel) model).getAction().isEnabled()) { resultModelList.remove(model); } + } + int size = resultModelList.size(); if (size > MAX_SIZE) { return resultModelList.subList(size - MAX_SIZE, size); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java index c3030ede50..e1f4fee713 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java @@ -17,6 +17,7 @@ import com.fr.json.JSONObject; import com.fr.stable.CodeUtils; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; /** @@ -68,10 +69,13 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor { } catch (JSONException e) { FRLogger.getLogger().error("recommend search error! :" + e.getMessage()); } - for (AlphaCellModel model : recommendModelList) { + Iterator modelIterator = recommendModelList.iterator(); + while (modelIterator.hasNext()) { + AlphaCellModel model = modelIterator.next(); if (model.getType() == CellType.ACTION && !((ActionModel) model).getAction().isEnabled()) { recommendModelList.remove(model); } + } if (recommendModelList.size() > 0) { modelList.add(new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Recommend"), false));