use of org.eclipse.wb.internal.rcp.databinding.emf.model.observables.designer.EmfTreeBeanAdvisorInfo in project windowbuilder by eclipse.
the class EmfObserveTypeContainer method parseExpression.
@Override
public AstObjectInfo parseExpression(AstEditor editor, String signature, ClassInstanceCreation creation, Expression[] arguments, IModelResolver resolver, IDatabindingsProvider provider) throws Exception {
ITypeBinding binding = AstNodeUtils.getTypeBinding(creation);
if (binding == null) {
return null;
}
//
if (AstNodeUtils.isSuccessorOf(binding, "org.eclipse.core.databinding.observable.masterdetail.IObservableFactory")) {
String className = AstNodeUtils.getFullyQualifiedName(binding, false);
//
if (AstNodeUtils.isSuccessorOf(binding, "org.eclipse.wb.rcp.databinding.EMFBeansListObservableFactory")) {
return createObserveFactory(editor, signature, arguments, className, false);
}
if (AstNodeUtils.isSuccessorOf(binding, "org.eclipse.wb.rcp.databinding.EMFEditBeansListObservableFactory")) {
return createObserveFactory(editor, signature, arguments, className, true);
}
}
//
if (AstNodeUtils.isSuccessorOf(binding, "org.eclipse.wb.rcp.databinding.EMFTreeBeanAdvisor")) {
Assert.isTrue(signature.endsWith("<init>(org.eclipse.emf.ecore.EStructuralFeature,org.eclipse.emf.ecore.EStructuralFeature,org.eclipse.emf.ecore.EStructuralFeature)"));
// create advisor
EmfTreeBeanAdvisorInfo advisorInfo = new EmfTreeBeanAdvisorInfo(m_propertiesSupport);
// prepare parent property
advisorInfo.setEMFParentProperty(getArgumentReference(editor, arguments[0]));
// prepare children property
advisorInfo.setEMFChildrenProperty(getArgumentReference(editor, arguments[1]));
// prepare hasChildren property
advisorInfo.setEMFHasChildrenProperty(getArgumentReference(editor, arguments[2]));
//
return advisorInfo;
}
//
if (AstNodeUtils.isSuccessorOf(binding, "org.eclipse.wb.rcp.databinding.EMFTreeObservableLabelProvider")) {
Assert.isTrue(signature.endsWith("<init>(org.eclipse.core.databinding.observable.set.IObservableSet,org.eclipse.emf.ecore.EStructuralFeature,org.eclipse.emf.ecore.EStructuralFeature)"));
// prepare allElements observable
KnownElementsObservableInfo allElementsObservable = (KnownElementsObservableInfo) resolver.getModel(arguments[0]);
if (allElementsObservable == null) {
AbstractParser.addError(editor, MessageFormat.format(Messages.EmfObserveTypeContainer_argumentNotFound, arguments[0]), new Throwable());
return null;
}
// create label provider
EmfTreeObservableLabelProviderInfo labelProvider = new EmfTreeObservableLabelProviderInfo(AstNodeUtils.getFullyQualifiedName(binding, false), allElementsObservable, m_propertiesSupport);
// prepare text property
labelProvider.setEMFTextProperty(getArgumentReference(editor, arguments[1]));
// prepare image property
labelProvider.setEMFImageProperty(getArgumentReference(editor, arguments[2]));
//
return labelProvider;
}
return null;
}
Aggregations