use of org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.PropertiesSupport.PropertyInfo in project windowbuilder by eclipse.
the class GlobalObservableFactory method automaticWizardGetProperties.
@Override
public List<PropertyAdapter> automaticWizardGetProperties(IJavaProject javaProject, ClassLoader classLoader, Class<?> eObjectClass) throws Exception {
if (isEMFObject(classLoader, eObjectClass)) {
List<PropertyAdapter> properties = Lists.newArrayList();
List<VariableDeclarationFragment> fragments = Collections.emptyList();
PropertiesSupport propertiesSupport = new PropertiesSupport(javaProject, classLoader, fragments);
//
for (PropertyInfo emfPropertyInfo : propertiesSupport.getProperties(eObjectClass)) {
properties.add(new PropertyAdapter(emfPropertyInfo.name, emfPropertyInfo.type));
}
return properties;
}
return null;
}
use of org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.PropertiesSupport.PropertyInfo in project windowbuilder by eclipse.
the class GlobalObservableFactory method filterElementPropertiesForTreeViewerInput.
@Override
public void filterElementPropertiesForTreeViewerInput(ObservableInfo inputObservable, Class<?> elementType, List<PropertyDescriptor> descriptors) throws Exception {
if (inputObservable instanceof ListEmfObservableInfo || inputObservable instanceof DetailListEmfObservableInfo) {
descriptors.clear();
PropertiesSupport propertiesSupport = getPropertiesSupport(inputObservable);
for (PropertyInfo emfProperty : propertiesSupport.getProperties(elementType)) {
descriptors.add(createProperty(emfProperty.name, emfProperty.type));
}
}
}
use of org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.PropertiesSupport.PropertyInfo in project windowbuilder by eclipse.
the class DetailEmfObservableInfo method createContentProviders.
// //////////////////////////////////////////////////////////////////////////
//
// Editing
//
// //////////////////////////////////////////////////////////////////////////
@Override
public void createContentProviders(List<IUiContentProvider> providers, BindingUiContentProviderContext context, DatabindingsProvider provider) throws Exception {
m_masterObservable.createContentProviders(providers, context, provider);
//
ChooseClassAndPropertiesConfiguration configuration = new ChooseClassAndPropertiesConfiguration(getConfiguration());
configuration.setBaseClassName("org.eclipse.emf.ecore.EObject");
//
providers.add(new ObservableDetailUiContentProvider(configuration, this, provider) {
@Override
protected List<PropertyAdapter> getProperties(Class<?> choosenClass) throws Exception {
List<PropertyAdapter> properties = Lists.newArrayList();
for (PropertyInfo emfPropertyInfo : m_propertiesSupport.getProperties(choosenClass)) {
properties.add(new ChooseClassAndTreePropertiesUiContentProvider.ObservePropertyAdapter(null, new EPropertyBindableInfo(m_propertiesSupport, null, emfPropertyInfo.type, emfPropertyInfo.name, emfPropertyInfo.reference)));
}
return properties;
}
@Override
protected void setClassNameAndProperties(Class<?> beanClass, String beanClassName, List<String> properties) throws Exception {
if (beanClassName == null) {
setClassName(CoreUtils.getClassName(beanClass));
} else {
setClassName(beanClassName);
}
//
EObjectBindableInfo eObject = new EObjectBindableInfo(beanClass, null, m_propertiesSupport, null);
//
Object[] adapters = new Object[properties.size()];
for (int i = 0; i < adapters.length; i++) {
adapters[i] = convertPropertyToAdapter(eObject.resolvePropertyReference(properties.get(i)));
}
//
setCheckedAndExpand(adapters);
calculatePropertiesFinish();
}
@Override
protected ObservePropertyAdapter convertPropertyToAdapter(IObserveInfo observe) throws Exception {
if (observe instanceof EPropertyBindableInfo) {
EPropertyBindableInfo property = (EPropertyBindableInfo) observe;
ObservePropertyAdapter adapter = new ObservePropertyAdapter(convertPropertyToAdapter(property.getParent()), property);
adapter.addToParent();
return adapter;
}
return null;
}
});
}
use of org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.PropertiesSupport.PropertyInfo in project windowbuilder by eclipse.
the class DetailEmfObservableInfo method setDetailPropertyReference.
// //////////////////////////////////////////////////////////////////////////
//
// Constructor
//
// //////////////////////////////////////////////////////////////////////////
@Override
public void setDetailPropertyReference(Class<?> detailBeanClass, String detailPropertyReference) throws Exception {
m_detailPropertyReference = detailPropertyReference;
//
if (detailBeanClass == null) {
if (detailPropertyReference.startsWith("org.eclipse.emf.databinding.FeaturePath.fromList(")) {
detailPropertyReference = StringUtils.substringBetween(detailPropertyReference, "(", ")");
String[] references = StringUtils.split(detailPropertyReference, ", ");
detailPropertyReference = references[references.length - 1];
}
} else {
m_detailBeanClass = detailBeanClass;
}
// prepare EMF class info
Object[] result = m_propertiesSupport.getClassInfoForProperty(detailPropertyReference);
Assert.isNotNull(result);
// prepare detail class
if (detailBeanClass == null) {
ClassInfo classInfo = (ClassInfo) result[0];
m_detailBeanClass = classInfo.thisClass;
}
// prepare EMF property
PropertyInfo emfPropertyInfo = (PropertyInfo) result[1];
Assert.isNotNull(emfPropertyInfo.type);
m_detailPropertyType = emfPropertyInfo.type;
//
m_detailEMFPropertyName = "\"" + emfPropertyInfo.name + "\"";
}
use of org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.PropertiesSupport.PropertyInfo in project windowbuilder by eclipse.
the class MapsEmfObservableInfo method setEMFProperties.
public void setEMFProperties(List<String> referenceProperties) throws Exception {
Assert.isTrue(!CollectionUtils.isEmpty(referenceProperties));
// prepare EMF class info
Object[] firstResult = m_propertiesSupport.getClassInfoForProperty(referenceProperties.get(0));
Assert.isNotNull(firstResult);
//
m_emfProperties = Lists.newArrayList();
List<String> properties = Lists.newArrayList();
HierarchySupport hierarchySupport = new HierarchySupport(m_propertiesSupport, false);
// prepare EMF properties
for (String propertyReference : referenceProperties) {
Object[] result = m_propertiesSupport.getClassInfoForProperty(propertyReference);
Assert.isNotNull(result);
ClassInfo classInfo = (ClassInfo) result[0];
Assert.isNotNull(classInfo.thisClass);
hierarchySupport.addClass(classInfo);
//
for (PropertyInfo property : classInfo.properties) {
if (propertyReference.equals(property.reference)) {
m_emfProperties.add(property);
properties.add(property.name);
break;
}
}
}
// prepare element type
ClassInfo lastClassInfo = hierarchySupport.getLastClass();
setElementType(lastClassInfo.thisClass);
//
Assert.equals(referenceProperties.size(), m_emfProperties.size());
super.setProperties(properties.toArray(new String[properties.size()]));
}
Aggregations