Search in sources :

Example 1 with BeansObservableFactoryInfo

use of org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.BeansObservableFactoryInfo in project windowbuilder by eclipse.

the class TreeViewerInputBindingInfo method setDefaultProviders.

@Override
public void setDefaultProviders(boolean asList, Class<?> elementType, boolean useViewerSupport) throws Exception {
    // create advisor
    TreeBeanAdvisorInfo advisor = GlobalFactoryHelper.createTreeBeanAdvisor(m_inputObservable);
    if (advisor == null) {
        advisor = new TreeBeanAdvisorInfo();
    }
    advisor.setElementType(elementType);
    // create factory
    BeansObservableFactoryInfo factory = GlobalFactoryHelper.createTreeObservableFactory(m_inputObservable, asList);
    if (factory == null) {
        factory = asList ? new BeansListObservableFactoryInfo() : new BeansSetObservableFactoryInfo();
    }
    factory.setElementType(elementType);
    // create content provider
    m_contentProvider = asList ? new ObservableListTreeContentProviderInfo(factory, advisor) : new ObservableSetTreeContentProviderInfo(factory, advisor);
    // create label provider
    KnownElementsObservableInfo allElementsObservable = new KnownElementsObservableInfo(m_contentProvider);
    TreeObservableLabelProviderInfo labelProvider = GlobalFactoryHelper.createTreeLabelProvider(m_inputObservable, allElementsObservable);
    if (labelProvider == null) {
        labelProvider = new TreeObservableLabelProviderInfo(allElementsObservable);
    }
    labelProvider.setElementType(elementType);
    m_labelProvider = labelProvider;
}
Also used : BeansSetObservableFactoryInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.BeansSetObservableFactoryInfo) TreeObservableLabelProviderInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.TreeObservableLabelProviderInfo) TreeBeanAdvisorInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.TreeBeanAdvisorInfo) BeansObservableFactoryInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.BeansObservableFactoryInfo) BeansListObservableFactoryInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.BeansListObservableFactoryInfo)

Example 2 with BeansObservableFactoryInfo

use of org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.BeansObservableFactoryInfo in project windowbuilder by eclipse.

the class ViewerInputParser method parseExpression.

@Override
public AstObjectInfo parseExpression(AstEditor editor, String signature, MethodInvocation invocation, Expression[] arguments, IModelResolver resolver) throws Exception {
    if (signature.endsWith("setContentProvider(org.eclipse.jface.viewers.IContentProvider)")) {
        // prepare viewer
        WidgetBindableInfo viewerBindable = m_widgetsContainer.getBindableWidget(invocation.getExpression());
        if (viewerBindable == null) {
            AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_viewerNotFound, invocation.getExpression()), new Throwable());
            return null;
        }
        // prepare binding
        AbstractViewerInputBindingInfo viewerBinding = getViewerBindingInfo(viewerBindable);
        if (viewerBinding == null) {
            AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_modelViewerNotFound, invocation.getExpression()), new Throwable());
            return null;
        }
        // 
        if (viewerBinding instanceof TreeViewerInputBindingInfo) {
            // prepare content provider
            ObservableCollectionTreeContentProviderInfo contentProvider = (ObservableCollectionTreeContentProviderInfo) resolver.getModel(arguments[0]);
            if (contentProvider == null) {
                AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_contentProviderNotFound, arguments[0]), new Throwable());
                return null;
            }
            TreeViewerInputBindingInfo viewerInputBinding = (TreeViewerInputBindingInfo) viewerBinding;
            viewerInputBinding.setContentProvider(contentProvider);
        } else if (viewerBinding instanceof ViewerInputBindingInfo) {
            // prepare content provider
            ObservableCollectionContentProviderInfo contentProvider = (ObservableCollectionContentProviderInfo) resolver.getModel(arguments[0]);
            if (contentProvider == null) {
                AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_contentProviderNotFound, arguments[0]), new Throwable());
                return null;
            }
            ViewerInputBindingInfo viewerInputBinding = (ViewerInputBindingInfo) viewerBinding;
            viewerInputBinding.setContentProvider(contentProvider);
        } else {
            AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_contentProviderNotFound, arguments[0]), new Throwable());
            return null;
        }
    } else if (signature.endsWith("setLabelProvider(org.eclipse.jface.viewers.IBaseLabelProvider)")) {
        // prepare viewer
        WidgetBindableInfo viewerBindable = m_widgetsContainer.getBindableWidget(invocation.getExpression());
        if (viewerBindable == null) {
            AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_viewerNotFound, invocation.getExpression()), new Throwable());
            return null;
        }
        // prepare binding
        AbstractViewerInputBindingInfo viewerBinding = getViewerBindingInfo(viewerBindable);
        if (viewerBinding == null) {
            AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_modelViewerNotFound, invocation.getExpression()), new Throwable());
            return null;
        }
        // 
        if (viewerBinding instanceof ViewerInputBindingInfo) {
            // prepare label provider
            ObservableMapLabelProviderInfo labelProvider = (ObservableMapLabelProviderInfo) resolver.getModel(arguments[0]);
            if (labelProvider == null) {
                AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_labelProviderArgumentNotFound, arguments[0]), new Throwable());
                // 
                m_viewers.remove(viewerBindable);
                m_contextInfo.getBindings().remove(viewerBinding);
                // 
                return null;
            }
            // sets label provider
            ViewerInputBindingInfo viewerInputBinding = (ViewerInputBindingInfo) viewerBinding;
            viewerInputBinding.setLabelProvider(labelProvider);
        } else if (viewerBinding instanceof TreeViewerInputBindingInfo) {
            // prepare label provider
            AbstractLabelProviderInfo labelProvider = (AbstractLabelProviderInfo) resolver.getModel(arguments[0]);
            if (labelProvider == null) {
                AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_labelProviderArgumentNotFound, arguments[0]), new Throwable());
                // 
                m_viewers.remove(viewerBindable);
                m_contextInfo.getBindings().remove(viewerBinding);
                // 
                return null;
            }
            // sets label provider
            TreeViewerInputBindingInfo viewerInputBinding = (TreeViewerInputBindingInfo) viewerBinding;
            viewerInputBinding.setLabelProvider(labelProvider);
        } else {
            AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_labelProviderArgumentNotFound, arguments[0]), new Throwable());
            return null;
        }
    } else if (signature.endsWith("setInput(java.lang.Object)")) {
        // prepare viewer
        WidgetBindableInfo viewerBindable = m_widgetsContainer.getBindableWidget(invocation.getExpression());
        if (viewerBindable == null) {
            AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_viewerNotFound, invocation.getExpression()), new Throwable());
            return null;
        }
        // prepare binding
        AbstractViewerInputBindingInfo viewerBinding = m_viewers.get(viewerBindable);
        if (viewerBinding == null) {
            AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_viewerInputModelNotFound, invocation.getExpression()), new Throwable());
            return null;
        }
        // prepare input observable
        ObservableInfo inputObservable = (ObservableInfo) resolver.getModel(arguments[0]);
        if (inputObservable == null) {
            // 
            if (viewerBinding instanceof TreeViewerInputBindingInfo) {
                BeanBindableInfo bindableObject = m_beansContainer.getBindableObject(arguments[0]);
                if (bindableObject != null) {
                    TreeViewerInputBindingInfo treeViewerBinding = (TreeViewerInputBindingInfo) viewerBinding;
                    ObservableFactoryInfo factoryInfo = treeViewerBinding.getContentProvider().getFactoryInfo();
                    // 
                    if (factoryInfo instanceof BeansObservableFactoryInfo) {
                        BeansObservableFactoryInfo beansFactoryInfo = (BeansObservableFactoryInfo) factoryInfo;
                        String propertyName = beansFactoryInfo.getPropertyName();
                        PropertyBindableInfo propertyObject = propertyName == null ? null : bindableObject.resolvePropertyReference(propertyName);
                        // 
                        if (propertyObject != null) {
                            inputObservable = new BeanFieldInputObservableInfo(bindableObject, propertyObject);
                        }
                    }
                }
            }
            // 
            if (inputObservable == null) {
                AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_viewerInputArgumentNotFound, arguments[0]), new Throwable());
                // 
                m_viewers.remove(viewerBindable);
                m_contextInfo.getBindings().remove(viewerBinding);
                // 
                return null;
            }
        }
        // sets input observable
        viewerBinding.setInputObservable(inputObservable);
    } else if (VIEWER_SUPPORT_LIST_SIGNATURE.equals(signature) || VIEWER_SUPPORT_SET_SIGNATURE.equals(signature)) {
        // prepare viewer
        WidgetBindableInfo viewerBindable = m_widgetsContainer.getBindableWidget(arguments[0]);
        if (viewerBindable == null) {
            AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_viewerNotFound, arguments[0]), new Throwable());
            return null;
        }
        if (m_viewers.get(viewerBindable) != null) {
            AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_viewerDoubleInvocation, invocation, arguments[0]), new Throwable());
            return null;
        }
        // prepare input observable
        ObservableInfo inputObservable = (ObservableInfo) resolver.getModel(arguments[1]);
        if (inputObservable == null) {
            AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_viewerInputArgumentNotFound, arguments[1]), new Throwable());
            return null;
        }
        // prepare label provider properties
        Assert.instanceOf(MethodInvocation.class, arguments[2]);
        MethodInvocation labelPropertiesMethod = (MethodInvocation) arguments[2];
        String labelPropertiesSignature = CoreUtils.getMethodSignature(labelPropertiesMethod);
        Assert.isTrue(BEAN_PROPERTIES_VALUES.equals(labelPropertiesSignature) || POJO_PROPERTIES_VALUES.equals(labelPropertiesSignature));
        List<Expression> labelPropertiesArguments = DomGenerics.arguments(labelPropertiesMethod);
        // prepare element type
        Class<?> elementType = CoreUtils.evaluate(Class.class, editor, labelPropertiesArguments.get(0));
        // prepare properties
        String[] properties = CoreUtils.evaluate(String[].class, editor, labelPropertiesArguments.get(1));
        // create binding
        ViewerInputBindingInfo viewerBinding = new ViewerInputBindingInfo(viewerBindable);
        viewerBinding.setInputObservable(inputObservable);
        viewerBinding.setDefaultProviders(VIEWER_SUPPORT_LIST_SIGNATURE.equals(signature), elementType, true);
        viewerBinding.getLabelProvider().getMapsObservable().setProperties(properties);
        // add binding
        m_contextInfo.getBindings().add(viewerBinding);
        m_viewers.put(viewerBindable, viewerBinding);
    } else if (OBSERVABLE_VALUE_EDITING_SUPPORT.equals(signature)) {
        // prepare viewer
        WidgetBindableInfo viewerBindable = m_widgetsContainer.getBindableWidget(arguments[0]);
        if (viewerBindable == null) {
            AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_viewerNotFound, arguments[0]), new Throwable());
            return null;
        }
        // 
        AbstractViewerInputBindingInfo viewerBinding = m_viewers.get(viewerBindable);
        if (viewerBinding == null) {
            AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_viewerNotFound, arguments[0]), new Throwable());
            return null;
        }
        // prepare context
        DataBindingContextInfo bindingContextInfo = (DataBindingContextInfo) resolver.getModel(arguments[1]);
        if (bindingContextInfo != m_contextInfo) {
            AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_undefinedDataBindingContext, arguments[1]), new Throwable());
            return null;
        }
        // prepare CellEditor
        CellEditorInfo cellEditorInfo = (CellEditorInfo) resolver.getModel(arguments[2]);
        if (cellEditorInfo == null) {
            AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_cellEditorNotFound, arguments[2]), new Throwable());
            return null;
        }
        // prepare CellEditor property
        CellEditorValuePropertyCodeSupport cellEditorProperty = null;
        AstObjectInfo cellEditorPropertyInfo = resolver.getModel(arguments[3]);
        // 
        if (cellEditorPropertyInfo instanceof CellEditorValuePropertyCodeSupport) {
            cellEditorProperty = (CellEditorValuePropertyCodeSupport) cellEditorPropertyInfo;
        } else if (cellEditorPropertyInfo instanceof ValuePropertyCodeSupport) {
            ValuePropertyCodeSupport value = (ValuePropertyCodeSupport) cellEditorPropertyInfo;
            cellEditorProperty = new CellEditorValuePropertyCodeSupport(value);
        }
        // 
        if (cellEditorProperty == null) {
            AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_cellEditorPropertyNotFound, arguments[3]), new Throwable());
            return null;
        }
        // prepare element property
        ValuePropertyCodeSupport elementProperty = (ValuePropertyCodeSupport) resolver.getModel(arguments[4]);
        if (elementProperty == null) {
            AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_elementPropertyNotFound, arguments[4]), new Throwable());
            return null;
        }
        // 
        return new EditingSupportInfo(viewerBinding, cellEditorInfo, cellEditorProperty, elementProperty);
    } else if (VIEWER_COLUMN_SET_EDITING_SUPPORT.equals(signature)) {
        // prepare viewer column
        WidgetBindableInfo viewerColumnBindable = m_widgetsContainer.getBindableWidget(invocation.getExpression());
        if (viewerColumnBindable == null) {
            AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_viewerColumnNotFound, invocation.getExpression()), new Throwable());
            return null;
        }
        // prepare support
        EditingSupportInfo editingSupportInfo = (EditingSupportInfo) resolver.getModel(arguments[0]);
        if (editingSupportInfo == null) {
            AbstractParser.addError(editor, MessageFormat.format(Messages.ViewerInputParser_editingSupportNotFound, arguments[0]), new Throwable());
            return null;
        }
        // 
        editingSupportInfo.setViewerColumn(viewerColumnBindable);
    } else if (CELL_EDITOR_PROPERTIES_CONTROL.equals(signature)) {
        // CellEditor
        return new CellEditorControlPropertyCodeSupport();
    }
    return null;
}
Also used : MethodInvocation(org.eclipse.jdt.core.dom.MethodInvocation) BeanBindableInfo(org.eclipse.wb.internal.rcp.databinding.model.beans.bindables.BeanBindableInfo) AstObjectInfo(org.eclipse.wb.internal.core.databinding.model.AstObjectInfo) List(java.util.List) WidgetBindableInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.bindables.WidgetBindableInfo) ObservableInfo(org.eclipse.wb.internal.rcp.databinding.model.ObservableInfo) MapsBeanObservableInfo(org.eclipse.wb.internal.rcp.databinding.model.beans.observables.MapsBeanObservableInfo) DataBindingContextInfo(org.eclipse.wb.internal.rcp.databinding.model.context.DataBindingContextInfo) BeansObservableFactoryInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.BeansObservableFactoryInfo) PropertyBindableInfo(org.eclipse.wb.internal.rcp.databinding.model.beans.bindables.PropertyBindableInfo) BeansListObservableFactoryInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.BeansListObservableFactoryInfo) BeansObservableFactoryInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.BeansObservableFactoryInfo) BeansSetObservableFactoryInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.BeansSetObservableFactoryInfo) ValuePropertyCodeSupport(org.eclipse.wb.internal.rcp.databinding.model.beans.observables.properties.ValuePropertyCodeSupport)

Example 3 with BeansObservableFactoryInfo

use of org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.BeansObservableFactoryInfo in project windowbuilder by eclipse.

the class TreeContentLabelProvidersUiContentProvider method saveToObject.

@Override
public void saveToObject() throws Exception {
    // prepare content provider
    ObservableCollectionTreeContentProviderInfo contentProvider = m_binding.getContentProvider();
    // prepare factory
    BeansObservableFactoryInfo factory = (BeansObservableFactoryInfo) contentProvider.getFactoryInfo();
    // prepare advisor
    TreeBeanAdvisorInfo advisor = (TreeBeanAdvisorInfo) contentProvider.getAdvisorInfo();
    // prepare label provider
    TreeObservableLabelProviderInfo labelProvider = (TreeObservableLabelProviderInfo) m_binding.getLabelProvider();
    // extract checked properties
    for (Object element : m_propertiesViewer.getCheckedElements()) {
        if (element instanceof TreePropertyWrapper) {
            TreePropertyWrapper wrapper = (TreePropertyWrapper) element;
            String propertyName = wrapper.descriptor.getName();
            String groupName = wrapper.parent.name;
            // check group
            if (PARENT_GROUP_NAME.equals(groupName)) {
                advisor.setParentProperty(propertyName);
            } else if (CHILDREN_GROUP_NAME.equals(groupName)) {
                advisor.setChildrenProperty(propertyName);
                factory.setPropertyName(propertyName);
            } else if (HAS_CHILDREN_GROUP_NAME.equals(groupName)) {
                advisor.setHasChildrenProperty(propertyName);
            } else if (TEXT_GROUP_NAME.equals(groupName)) {
                labelProvider.setTextProperty(propertyName);
            } else if (IMAGE_GROUP_NAME.equals(groupName)) {
                labelProvider.setImageProperty(propertyName);
            }
        }
    }
}
Also used : ObservableCollectionTreeContentProviderInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.ObservableCollectionTreeContentProviderInfo) TreeObservableLabelProviderInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.TreeObservableLabelProviderInfo) TreeBeanAdvisorInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.TreeBeanAdvisorInfo) BeansObservableFactoryInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.BeansObservableFactoryInfo)

Example 4 with BeansObservableFactoryInfo

use of org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.BeansObservableFactoryInfo in project windowbuilder by eclipse.

the class TreeInputElementUiContentProvider method createDesignerElementTypeUIProvider.

private ChooseClassUiContentProvider createDesignerElementTypeUIProvider() throws Exception {
    ChooseClassConfiguration configuration = new ChooseClassConfiguration();
    configuration.setDialogFieldLabel(Messages.TreeInputElementUiContentProvider_chooseDesigner);
    configuration.setValueScope("beans");
    configuration.setChooseInterfaces(true);
    configuration.setEmptyClassErrorMessage(Messages.TreeInputElementUiContentProvider_chooseDesignerEmptyMessage);
    configuration.setErrorMessagePrefix(Messages.TreeInputElementUiContentProvider_chooseDesignerErrorPrefix);
    // 
    GlobalFactoryHelper.configureChooseElementForTreeViewerInput(m_binding.getInputObservable(), configuration);
    // 
    return new ChooseClassUiContentProvider(configuration) {

        @Override
        public void updateFromObject() throws Exception {
            Class<?> elementType = m_binding.getElementType();
            if (elementType != null) {
                setClassName(CoreUtils.getClassName(elementType));
            } else {
                calculateFinish();
            }
        }

        @Override
        protected void calculateFinish() {
            super.calculateFinish();
            if (getErrorMessage() == null) {
                // route choose class events to properties editor
                ExecutionUtils.runLog(new RunnableEx() {

                    @Override
                    public void run() throws Exception {
                        m_contentLabelProvidersEditor.setElementType(getChoosenClass());
                    }
                });
            }
        }

        @Override
        public void saveToObject() throws Exception {
            // store element type
            Class<?> elementType = getChoosenClass();
            // 
            ObservableCollectionTreeContentProviderInfo contentProvider = m_binding.getContentProvider();
            // to factory
            BeansObservableFactoryInfo factory = (BeansObservableFactoryInfo) contentProvider.getFactoryInfo();
            factory.setElementType(elementType);
            // to advisor
            TreeBeanAdvisorInfo advisor = (TreeBeanAdvisorInfo) contentProvider.getAdvisorInfo();
            advisor.setElementType(elementType);
            // to label provider
            TreeObservableLabelProviderInfo labelProvider = (TreeObservableLabelProviderInfo) m_binding.getLabelProvider();
            labelProvider.setElementType(elementType);
            // to input
            InputElementUiContentProvider.setElementTypeToInput(m_binding, elementType);
        }
    };
}
Also used : ObservableCollectionTreeContentProviderInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.ObservableCollectionTreeContentProviderInfo) TreeObservableLabelProviderInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.TreeObservableLabelProviderInfo) TreeBeanAdvisorInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.TreeBeanAdvisorInfo) RunnableEx(org.eclipse.wb.internal.core.utils.execution.RunnableEx) ChooseClassUiContentProvider(org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.ChooseClassUiContentProvider) BeansObservableFactoryInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.BeansObservableFactoryInfo) ChooseClassConfiguration(org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.ChooseClassConfiguration)

Example 5 with BeansObservableFactoryInfo

use of org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.BeansObservableFactoryInfo in project windowbuilder by eclipse.

the class TreeInputElementUiContentProvider method createDesignerProviders.

/**
 * Fill Designer page.
 */
private List<IUiContentProvider> createDesignerProviders() {
    List<IUiContentProvider> providers = Lists.newArrayList();
    providers.add(m_elementTypeDesignerUIProvider);
    // 
    if (m_binding.isDesignerMode()) {
        // add life objects
        createDefaultProviders(providers, true);
    } else {
        // create fake objects
        ObservableCollectionTreeContentProviderInfo contentProvider = m_binding.getContentProvider();
        // create factory
        boolean asList = contentProvider instanceof ObservableListTreeContentProviderInfo;
        BeansObservableFactoryInfo factory = null;
        try {
            factory = GlobalFactoryHelper.createTreeObservableFactory(m_binding.getInputObservable(), asList);
        } catch (Throwable e) {
            DesignerPlugin.log(e);
        }
        if (factory == null) {
            factory = asList ? new BeansListObservableFactoryInfo() : new BeansSetObservableFactoryInfo();
        }
        // 
        m_defaultObjects.add(factory);
        factory.createContentProviders(providers, m_provider);
        // create advisor
        TreeBeanAdvisorInfo advisor = null;
        try {
            advisor = GlobalFactoryHelper.createTreeBeanAdvisor(m_binding.getInputObservable());
        } catch (Throwable e) {
            DesignerPlugin.log(e);
        }
        if (advisor == null) {
            advisor = new TreeBeanAdvisorInfo();
        }
        m_defaultObjects.add(advisor);
        advisor.createContentProviders(providers, m_provider);
        // content provider always exist
        contentProvider.createContentProviders(providers, m_provider, true);
        // create label provider
        KnownElementsObservableInfo allElementsObservable = new KnownElementsObservableInfo(contentProvider);
        TreeObservableLabelProviderInfo labelProvider = null;
        try {
            labelProvider = GlobalFactoryHelper.createTreeLabelProvider(m_binding.getInputObservable(), allElementsObservable);
        } catch (Throwable e) {
            DesignerPlugin.log(e);
        }
        if (labelProvider == null) {
            labelProvider = new TreeObservableLabelProviderInfo(allElementsObservable);
        }
        m_defaultObjects.add(labelProvider);
        labelProvider.createContentProviders(providers, m_provider, true);
    }
    // content provider for properties: parent/children/has children/text/image
    m_contentLabelProvidersEditor = new TreeContentLabelProvidersUiContentProvider(m_binding);
    providers.add(m_contentLabelProvidersEditor);
    return providers;
}
Also used : ObservableCollectionTreeContentProviderInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.ObservableCollectionTreeContentProviderInfo) BeansSetObservableFactoryInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.BeansSetObservableFactoryInfo) TreeBeanAdvisorInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.TreeBeanAdvisorInfo) IUiContentProvider(org.eclipse.wb.internal.core.databinding.ui.editor.IUiContentProvider) BeansObservableFactoryInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.BeansObservableFactoryInfo) BeansListObservableFactoryInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.BeansListObservableFactoryInfo) TreeObservableLabelProviderInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.TreeObservableLabelProviderInfo) KnownElementsObservableInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.KnownElementsObservableInfo) ObservableListTreeContentProviderInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.ObservableListTreeContentProviderInfo)

Aggregations

BeansObservableFactoryInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.BeansObservableFactoryInfo)5 TreeBeanAdvisorInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.TreeBeanAdvisorInfo)4 TreeObservableLabelProviderInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.TreeObservableLabelProviderInfo)4 ObservableCollectionTreeContentProviderInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.input.ObservableCollectionTreeContentProviderInfo)3 BeansListObservableFactoryInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.BeansListObservableFactoryInfo)3 BeansSetObservableFactoryInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.input.designer.BeansSetObservableFactoryInfo)3 List (java.util.List)1 MethodInvocation (org.eclipse.jdt.core.dom.MethodInvocation)1 AstObjectInfo (org.eclipse.wb.internal.core.databinding.model.AstObjectInfo)1 IUiContentProvider (org.eclipse.wb.internal.core.databinding.ui.editor.IUiContentProvider)1 ChooseClassConfiguration (org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.ChooseClassConfiguration)1 ChooseClassUiContentProvider (org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.ChooseClassUiContentProvider)1 RunnableEx (org.eclipse.wb.internal.core.utils.execution.RunnableEx)1 ObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.ObservableInfo)1 BeanBindableInfo (org.eclipse.wb.internal.rcp.databinding.model.beans.bindables.BeanBindableInfo)1 PropertyBindableInfo (org.eclipse.wb.internal.rcp.databinding.model.beans.bindables.PropertyBindableInfo)1 MapsBeanObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.beans.observables.MapsBeanObservableInfo)1 ValuePropertyCodeSupport (org.eclipse.wb.internal.rcp.databinding.model.beans.observables.properties.ValuePropertyCodeSupport)1 DataBindingContextInfo (org.eclipse.wb.internal.rcp.databinding.model.context.DataBindingContextInfo)1 WidgetBindableInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.bindables.WidgetBindableInfo)1