Browse Source

9.0同步到10.0

master
XiaXiang 7 years ago
parent
commit
6d2fa1acff
  1. 10
      designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java
  2. 16
      designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java

10
designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.alphafine.search.manager.impl; package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.CellModelHelper; import com.fr.design.mainframe.alphafine.cell.CellModelHelper;
import com.fr.design.mainframe.alphafine.cell.model.ActionModel; import com.fr.design.mainframe.alphafine.cell.model.ActionModel;
@ -181,12 +182,17 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
for (ScoreDoc scoreDoc : scores) { for (ScoreDoc scoreDoc : scores) {
Document document = searcher.doc(scoreDoc.doc); Document document = searcher.doc(scoreDoc.doc);
AlphaCellModel model = CellModelHelper.getModelFromJson(new JSONObject(document.get("cellModel"))); AlphaCellModel model = CellModelHelper.getModelFromJson(new JSONObject(document.get("cellModel")));
if (model.getType() == CellType.ACTION && !UpdateActionManager.getUpdateActionManager().isEnable(((ActionModel) model).getAction())) { if (model.getType() == CellType.ACTION) {
continue; UpdateAction action = UpdateActionManager.getUpdateActionManager().getActionByName(model.getName());
if (action != null) {
((ActionModel) model).setAction(action);
recentModelList.add(model);
}
} else { } else {
recentModelList.add(model); recentModelList.add(model);
} }
} }
} catch (Exception e) { } catch (Exception e) {
FRLoggerFactory.getLogger().error("local search error: " + e.getMessage()); FRLoggerFactory.getLogger().error("local search error: " + e.getMessage());

16
designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java

@ -27,12 +27,18 @@ public class UpdateActionManager {
this.updateActions = updateActions; this.updateActions = updateActions;
} }
public boolean isEnable(UpdateAction updateAction) { /**
* 根据action name获取action对象
*
* @param name
* @return
*/
public UpdateAction getActionByName(String name) {
for (UpdateActionModel action : updateActions) { for (UpdateActionModel action : updateActions) {
if (ComparatorUtils.equals(updateAction.getName(), action.getActionName()) && action.getAction().isEnabled()) { if (ComparatorUtils.equals(name, action.getActionName()) && action.getAction().isEnabled()) {
return true; return action.getAction();
} }
} }
return false; return null;
} }
} }
Loading…
Cancel
Save