Search in sources :

Example 1 with ListEmfObservableInfo

use of org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo in project windowbuilder by eclipse.

the class EmfObserveTypeContainer method createList.

AstObjectInfo createList(AstEditor editor, Expression[] arguments, int startIndex) throws Exception {
    // prepare object
    EObjectBindableInfo eObject = getEObject(arguments[startIndex]);
    if (eObject == null) {
        AbstractParser.addError(editor, MessageFormat.format(Messages.EmfObserveTypeContainer_argumentNotFound, arguments[startIndex]), new Throwable());
        return null;
    }
    // prepare property
    EPropertyBindableInfo eProperty = getEProperty(eObject, arguments[startIndex + 1]);
    // create observable
    ObservableInfo observable = new ListEmfObservableInfo(eObject, eProperty);
    observable.setCodeSupport(new EmfObservableListCodeSupport());
    // 
    return observable;
}
Also used : EObjectBindableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EObjectBindableInfo) MapsEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.MapsEmfObservableInfo) DetailValueEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailValueEmfObservableInfo) ObservableInfo(org.eclipse.wb.internal.rcp.databinding.model.ObservableInfo) ListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo) DetailListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailListEmfObservableInfo) KnownElementsObservableInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.KnownElementsObservableInfo) ValueEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ValueEmfObservableInfo) ListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo) DetailListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailListEmfObservableInfo) EmfObservableListCodeSupport(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.EmfObservableListCodeSupport) EPropertyBindableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EPropertyBindableInfo)

Example 2 with ListEmfObservableInfo

use of org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo 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));
        }
    }
}
Also used : ListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo) DetailListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailListEmfObservableInfo) DetailListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailListEmfObservableInfo) PropertiesSupport(org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.PropertiesSupport) PropertyInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.PropertiesSupport.PropertyInfo)

Example 3 with ListEmfObservableInfo

use of org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo in project windowbuilder by eclipse.

the class GlobalObservableFactory method createObserveMaps.

@Override
public MapsBeanObservableInfo createObserveMaps(ObservableInfo inputObservable, ObservableInfo domainObservable, Class<?> elementType, boolean[] useViewerSupport) throws Exception {
    if (inputObservable instanceof ListEmfObservableInfo || inputObservable instanceof DetailListEmfObservableInfo) {
        useViewerSupport[0] = false;
        MapsEmfObservableInfo observeMaps = new MapsEmfObservableInfo(domainObservable, getPropertiesSupport(inputObservable));
        observeMaps.setElementType(elementType);
        return observeMaps;
    }
    return null;
}
Also used : ListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo) DetailListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailListEmfObservableInfo) MapsEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.MapsEmfObservableInfo) DetailListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailListEmfObservableInfo)

Example 4 with ListEmfObservableInfo

use of org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo in project windowbuilder by eclipse.

the class GlobalObservableFactory method configureChooseElementForViewerInput.

// //////////////////////////////////////////////////////////////////////////
// 
// IGlobalObservableFactory: UI
// 
// //////////////////////////////////////////////////////////////////////////
@Override
public void configureChooseElementForViewerInput(ObservableInfo inputObservable, ChooseClassAndPropertiesConfiguration configuration) throws Exception {
    if (inputObservable instanceof ListEmfObservableInfo || inputObservable instanceof DetailListEmfObservableInfo) {
        final PropertiesSupport propertiesSupport = getPropertiesSupport(inputObservable);
        configuration.setBaseClassName("org.eclipse.emf.ecore.EObject");
        configuration.addPropertiesFilter(new IPropertiesFilter() {

            @Override
            public List<PropertyAdapter> filterProperties(Class<?> choosenClass, List<PropertyAdapter> properties) throws Exception {
                properties = Lists.newArrayList();
                for (PropertyInfo emfPropertyInfo : propertiesSupport.getProperties(choosenClass)) {
                    properties.add(new ChooseClassAndTreePropertiesUiContentProvider.ObservePropertyAdapter(null, new EPropertyBindableInfo(propertiesSupport, null, emfPropertyInfo.type, emfPropertyInfo.name, "\"" + emfPropertyInfo.name + "\"")));
                }
                return properties;
            }
        });
    }
}
Also used : ListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo) DetailListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailListEmfObservableInfo) PropertiesSupport(org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.PropertiesSupport) DetailListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailListEmfObservableInfo) List(java.util.List) IPropertiesFilter(org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.ChooseClassAndPropertiesConfiguration.IPropertiesFilter) PropertyAdapter(org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.PropertyAdapter) EPropertyBindableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EPropertyBindableInfo) PropertyInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.PropertiesSupport.PropertyInfo)

Example 5 with ListEmfObservableInfo

use of org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo in project windowbuilder by eclipse.

the class GlobalObservableFactory method createDetailObservable.

// //////////////////////////////////////////////////////////////////////////
// 
// IGlobalObservableFactory: Observable
// 
// //////////////////////////////////////////////////////////////////////////
@Override
public ObservableInfo createDetailObservable(SingleSelectionObservableInfo masterObservable, BindableInfo object, Type type) throws Exception {
    if (masterObservable.isViewer()) {
        // prepare input
        ObservableInfo inputObservable = null;
        BindableInfo property = object.resolvePropertyReference("setInput");
        for (AbstractBindingInfo binding : object.getBindings()) {
            if (binding.getTargetProperty() == property) {
                AbstractViewerInputBindingInfo viewerBinding = (AbstractViewerInputBindingInfo) binding;
                inputObservable = viewerBinding.getInputObservable();
                break;
            }
        }
        // create detail observable
        if (inputObservable instanceof ListEmfObservableInfo) {
            PropertiesSupport propertiesSupport = getPropertiesSupport(inputObservable);
            boolean version_2_5 = propertiesSupport.isEMFProperties();
            ObservableInfo observable = null;
            // 
            if (type == Type.OnlyValue) {
                observable = new DetailValueEmfObservableInfo(masterObservable, propertiesSupport);
                // 
                if (version_2_5) {
                    observable.setCodeSupport(new EmfValuePropertyDetailCodeSupport());
                } else {
                    observable.setCodeSupport(new EmfObservableDetailValueCodeSupport());
                }
            } else if (type == Type.OnlyList) {
                observable = new DetailListEmfObservableInfo(masterObservable, propertiesSupport);
                // 
                if (version_2_5) {
                    observable.setCodeSupport(new EmfListPropertyDetailCodeSupport());
                } else {
                    observable.setCodeSupport(new EmfObservableDetailListCodeSupport());
                }
            }
            return observable;
        }
    }
    return null;
}
Also used : AbstractBindingInfo(org.eclipse.wb.internal.rcp.databinding.model.AbstractBindingInfo) MapsEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.MapsEmfObservableInfo) DetailValueEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailValueEmfObservableInfo) SingleSelectionObservableInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.observables.SingleSelectionObservableInfo) ObservableInfo(org.eclipse.wb.internal.rcp.databinding.model.ObservableInfo) ListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo) DetailListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailListEmfObservableInfo) KnownElementsObservableInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.KnownElementsObservableInfo) DetailEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailEmfObservableInfo) MapsBeanObservableInfo(org.eclipse.wb.internal.rcp.databinding.model.beans.observables.MapsBeanObservableInfo) EmfListPropertyDetailCodeSupport(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.properties.EmfListPropertyDetailCodeSupport) ListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo) DetailListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailListEmfObservableInfo) PropertiesSupport(org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.PropertiesSupport) EmfObservableDetailListCodeSupport(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.EmfObservableDetailListCodeSupport) AbstractViewerInputBindingInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.AbstractViewerInputBindingInfo) EPropertyBindableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EPropertyBindableInfo) BindableInfo(org.eclipse.wb.internal.rcp.databinding.model.BindableInfo) EObjectBindableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EObjectBindableInfo) DetailListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailListEmfObservableInfo) EmfValuePropertyDetailCodeSupport(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.properties.EmfValuePropertyDetailCodeSupport) EmfObservableDetailValueCodeSupport(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.EmfObservableDetailValueCodeSupport) DetailValueEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailValueEmfObservableInfo)

Aggregations

DetailListEmfObservableInfo (org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailListEmfObservableInfo)5 ListEmfObservableInfo (org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo)5 EPropertyBindableInfo (org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EPropertyBindableInfo)3 PropertiesSupport (org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.PropertiesSupport)3 MapsEmfObservableInfo (org.eclipse.wb.internal.rcp.databinding.emf.model.observables.MapsEmfObservableInfo)3 EObjectBindableInfo (org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EObjectBindableInfo)2 PropertyInfo (org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.PropertiesSupport.PropertyInfo)2 DetailValueEmfObservableInfo (org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailValueEmfObservableInfo)2 ObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.ObservableInfo)2 KnownElementsObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.input.KnownElementsObservableInfo)2 List (java.util.List)1 IPropertiesFilter (org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.ChooseClassAndPropertiesConfiguration.IPropertiesFilter)1 PropertyAdapter (org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.PropertyAdapter)1 DetailEmfObservableInfo (org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailEmfObservableInfo)1 EmfObservableDetailListCodeSupport (org.eclipse.wb.internal.rcp.databinding.emf.model.observables.EmfObservableDetailListCodeSupport)1 EmfObservableDetailValueCodeSupport (org.eclipse.wb.internal.rcp.databinding.emf.model.observables.EmfObservableDetailValueCodeSupport)1 EmfObservableListCodeSupport (org.eclipse.wb.internal.rcp.databinding.emf.model.observables.EmfObservableListCodeSupport)1 ValueEmfObservableInfo (org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ValueEmfObservableInfo)1 EmfListPropertyDetailCodeSupport (org.eclipse.wb.internal.rcp.databinding.emf.model.observables.properties.EmfListPropertyDetailCodeSupport)1 EmfValuePropertyDetailCodeSupport (org.eclipse.wb.internal.rcp.databinding.emf.model.observables.properties.EmfValuePropertyDetailCodeSupport)1