use of org.whole.lang.util.IEntityTransformer in project whole by wholeplatform.
the class EntityAssistCompositeContributionItem method createWrapActions.
protected List<IAction> createWrapActions(ILanguageKit lk, IEntity targetEntity) {
List<IAction> wrapActions = new ArrayList<IAction>();
Set<EntityDescriptor<?>> wrapTypes = new HashSet<EntityDescriptor<?>>();
IGEFEditorKit editorKit = (IGEFEditorKit) (targetEntity.wGetLanguageKit().equals(lk) ? ReflectionFactory.getEditorKit(targetEntity) : lk.getDefaultEditorKit());
for (Object[] wrapAction : editorKit.getActionFactory().wrapActions()) {
EntityDescriptor<?> ed = (EntityDescriptor<?>) wrapAction[1];
if (isWrappable(targetEntity, ed, (IEnablerPredicate) wrapAction[0])) {
String label = (String) wrapAction[2];
IEntityTransformer transformer = (IEntityTransformer) wrapAction[3];
wrapActions.add(contextProvider.getActionRegistry().getActionFactory().createPerformAction(label, WRAP_ICON_URI, QueriesEntityFactory.instance.createBooleanLiteral(true), getBehavior(ed, transformer)));
wrapTypes.add(ed);
}
}
for (EntityDescriptor<?> ed : lk.getEntityDescriptorEnum()) if (EntityUtils.isComposite(ed) && !wrapTypes.contains(ed) && isWrappable(targetEntity, ed, EnablerPredicateFactory.instance.assignableTo(ed.getEntityDescriptor(0)))) {
String label = StringUtils.camelCaseToSpacedWords(ed.getName());
wrapActions.add(contextProvider.getActionRegistry().getActionFactory().createPerformAction(label, WRAP_ICON_URI, QueriesEntityFactory.instance.createBooleanLiteral(true), getBehavior(ed, DefaultWrapInTransformer.instance)));
}
return wrapActions;
}
Aggregations