use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class XsiModelTemplate method applyAttributes.
protected void applyAttributes(IEntity entity, int fromIndex) {
final int size = entity.wSize();
for (int i = fromIndex; i < size; i++) {
EntityDescriptor<?> context = entity.wGetEntityDescriptor();
FeatureDescriptor fd = entity.wGetFeatureDescriptor(i);
IEntity child = entity.wGet(i);
EntityDescriptor<?> ed = child.wGetEntityDescriptor();
String languageURI = ed.getLanguageKit().getURI();
// FIXME workaround for resolvers and other adapted entities
if (CommonsLanguageKit.URI.equals(ed.getLanguageKit().getURI())) {
ed = child.wGetParent().wGetEntityDescriptor();
languageURI = ed.getLanguageKit().getURI();
}
IMappingStrategy strategy = getXsiMappingStrategy(languageURI);
if (isAttributeMapping(strategy, context, ed, fd)) {
if (!EntityUtils.isResolver(child) || !fd.isOptional()) {
builder.Attribute_();
String attrName = getAttributeNCName(strategy, context, ed, fd);
// TODO add any attribute support
boolean needNamespacePrefix = strategy.isAttributesFormQualified() && !NamespaceUtils.isInternalNamespace(languageURI);
if (needNamespacePrefix) {
String prefix = getNamespacePrefix(child, languageURI);
builder.QualifiedName_();
builder.NameSpace(prefix);
builder.Name(attrName);
builder._QualifiedName();
} else
builder.Name(attrName);
builder.Value(toAttributeValue(child, strategy));
builder._Attribute();
}
}
}
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class AbstractUIBuilder method addMigrateItem.
@Override
public void addMigrateItem() {
FeatureDescriptor menu = ActionsFeatureDescriptorEnum.migrateMenuActions;
VisibilityExpression expression = new ActionsVisibleWhen(menu);
IContributionItem ici = new ActionsCompositeContributionItem(this, menu);
addActionsItem(MIGRATE_LABEL, expression, ici);
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class AbstractUIBuilder method addRefactorItem.
@Override
public void addRefactorItem() {
FeatureDescriptor menu = ActionsFeatureDescriptorEnum.refactorMenuActions;
VisibilityExpression expression = new ActionsVisibleWhen(menu);
IContributionItem ici = new ActionsCompositeContributionItem(this, menu);
addActionsItem(REFACTOR_LABEL, expression, ici);
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class AbstractUIBuilder method addAnalyzeItem.
@Override
public void addAnalyzeItem() {
FeatureDescriptor menu = ActionsFeatureDescriptorEnum.analyzeMenuActions;
VisibilityExpression expression = new ActionsVisibleWhen(menu);
IContributionItem ici = new ActionsCompositeContributionItem(this, menu);
addActionsItem(ANALYZE_LABEL, expression, ici);
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class CommonsDataTypePresentationParser method parseFeatureDescriptor.
public static FeatureDescriptor parseFeatureDescriptor(String value) {
int index = value.indexOf('#');
if (index > 0) {
String languageUri = value.substring(0, index);
ILanguageKit lk = /*= null;
if (ReflectionFactory.hasLanguageKit(languageUri)) {
for (ILanguageKit lk2 : ReflectionFactory.getLanguageKits(true))
if (lk2.getName().equalsIgnoreCase(languageUri)) {
lk = lk2;
break;
}
}
if (lk == null)
lk*/
ReflectionFactory.getLanguageKit(languageUri);
FeatureDescriptor fd = lk.getFeatureDescriptorEnum().valueOf(value.substring(index + 1));
if (fd != null)
return fd;
}
throw new WholeIllegalArgumentException(WholeMessages.no_data_type);
}
Aggregations