Search in sources :

Example 1 with InputElementUiContentProvider

use of org.eclipse.wb.internal.rcp.databinding.ui.contentproviders.InputElementUiContentProvider in project windowbuilder by eclipse.

the class ViewerInputBindingInfo method createContentProviders.

// //////////////////////////////////////////////////////////////////////////
// 
// Editing
// 
// //////////////////////////////////////////////////////////////////////////
@Override
public void createContentProviders(List<IUiContentProvider> providers, IPageListener listener, DatabindingsProvider provider) throws Exception {
    // configure page
    listener.setTitle(Messages.ViewerInputBindingInfo_title);
    listener.setMessage(Messages.ViewerInputBindingInfo_message);
    // 
    providers.add(new LabelUiContentProvider(Messages.ViewerInputBindingInfo_viewerLabel, m_viewerBindable.getPresentation().getTextForBinding()));
    providers.add(new LabelUiContentProvider(Messages.ViewerInputBindingInfo_inputLabel, m_inputObservable.getPresentationText()));
    m_labelProvider.createContentProviders(providers, provider, true);
    // element type editor
    ChooseClassAndPropertiesConfiguration configuration = new ChooseClassAndPropertiesConfiguration();
    configuration.setDialogFieldLabel(Messages.ViewerInputBindingInfo_elementClassLabel);
    configuration.setValueScope("beans");
    configuration.setChooseInterfaces(true);
    configuration.setEmptyClassErrorMessage(Messages.ViewerInputBindingInfo_elementClassEmptyMessage);
    configuration.setErrorMessagePrefix(Messages.ViewerInputBindingInfo_elementClassErrorPrefix);
    configuration.setPropertiesLabel(Messages.ViewerInputBindingInfo_elementClassPropertiesLabel);
    configuration.setPropertiesMultiChecked(true);
    configuration.setReorderMode(true);
    configuration.setShowSelectionButtons(false);
    configuration.setLoadedPropertiesCheckedStrategy(ChooseClassAndPropertiesConfiguration.LoadedPropertiesCheckedStrategy.None);
    configuration.setPropertiesErrorMessage(Messages.ViewerInputBindingInfo_elementClassPropertiesErrorMessage);
    // 
    if (m_inputObservable instanceof DetailBeanObservableInfo) {
        configuration.setDialogFieldEnabled(false);
        configuration.setValueScope("beans0");
        m_inputObservable.createContentProviders(providers, null, provider);
    }
    // 
    GlobalFactoryHelper.configureChooseElementForViewerInput(m_inputObservable, configuration);
    // 
    InputElementUiContentProvider inputUIContentProvider = new InputElementUiContentProvider(configuration, this);
    // 
    if (m_inputObservable instanceof DetailBeanObservableInfo) {
        new ChooseClassAndPropertiesRouter((ChooseClassAndPropertiesUiContentProvider) providers.get(providers.size() - 1), inputUIContentProvider);
    }
    // 
    providers.add(inputUIContentProvider);
    // 
    super.createContentProviders(providers, listener, provider);
}
Also used : ChooseClassAndPropertiesRouter(org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.ChooseClassAndPropertiesRouter) LabelUiContentProvider(org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.LabelUiContentProvider) InputElementUiContentProvider(org.eclipse.wb.internal.rcp.databinding.ui.contentproviders.InputElementUiContentProvider) ChooseClassAndPropertiesConfiguration(org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.ChooseClassAndPropertiesConfiguration) DetailBeanObservableInfo(org.eclipse.wb.internal.rcp.databinding.model.beans.observables.DetailBeanObservableInfo)

Example 2 with InputElementUiContentProvider

use of org.eclipse.wb.internal.rcp.databinding.ui.contentproviders.InputElementUiContentProvider in project windowbuilder by eclipse.

the class AbstractViewerInputBindingInfo method createContentProviders.

// //////////////////////////////////////////////////////////////////////////
// 
// Editing
// 
// //////////////////////////////////////////////////////////////////////////
@Override
public void createContentProviders(List<IUiContentProvider> providers, IPageListener listener, DatabindingsProvider provider) throws Exception {
    if (m_isColumnViewer) {
        List<WidgetBindableInfo> viewerColumns = Lists.newArrayList();
        // prepare viewer columns
        WidgetBindableInfo viewerControlBindable = (WidgetBindableInfo) m_viewerBindable.getParent();
        for (IObserveInfo observe : viewerControlBindable.getChildren(ChildrenContext.ChildrenForMasterTable)) {
            WidgetBindableInfo widgetBindable = (WidgetBindableInfo) observe;
            // extract columns
            if (widgetBindable.getJavaInfo() instanceof ItemInfo) {
                for (IObserveInfo subObserve : widgetBindable.getChildren(ChildrenContext.ChildrenForMasterTable)) {
                    WidgetBindableInfo subWidgetBindable = (WidgetBindableInfo) subObserve;
                    // extract viewer columns
                    if (subWidgetBindable.getJavaInfo() instanceof ViewerColumnInfo) {
                        viewerColumns.add(subWidgetBindable);
                    }
                }
            }
        }
        // 
        if (!viewerColumns.isEmpty()) {
            // prepare element type provider
            VirtualEditingSupportInfo.IElementTypeProvider elementTypeProvider = null;
            for (IUiContentProvider contentProvider : providers) {
                // wrap Viewer editor
                if (contentProvider instanceof InputElementUiContentProvider) {
                    final InputElementUiContentProvider inputElementContentProvider = (InputElementUiContentProvider) contentProvider;
                    elementTypeProvider = new VirtualEditingSupportInfo.IElementTypeProvider() {

                        @Override
                        public Class<?> getElementType() throws Exception {
                            return inputElementContentProvider.getChoosenClass();
                        }
                    };
                    break;
                }
                // wrap TreeViewer editor
                if (contentProvider instanceof TreeInputElementUiContentProvider) {
                    final TreeInputElementUiContentProvider inputElementContentProvider = (TreeInputElementUiContentProvider) contentProvider;
                    elementTypeProvider = new VirtualEditingSupportInfo.IElementTypeProvider() {

                        @Override
                        public Class<?> getElementType() throws Exception {
                            return inputElementContentProvider.getCurrentElementType();
                        }
                    };
                    break;
                }
            }
            // prepare configuration
            ViewerColumnsConfiguration configuration = new ViewerColumnsConfiguration(this, elementTypeProvider, viewerColumns, m_editingSupports);
            // prepare provider
            providers.add(new ViewerColumnsUiContentProvider(configuration));
        }
    }
}
Also used : IObserveInfo(org.eclipse.wb.internal.core.databinding.model.IObserveInfo) ItemInfo(org.eclipse.wb.internal.swt.model.widgets.ItemInfo) IUiContentProvider(org.eclipse.wb.internal.core.databinding.ui.editor.IUiContentProvider) ViewerColumnsUiContentProvider(org.eclipse.wb.internal.rcp.databinding.ui.contentproviders.ViewerColumnsUiContentProvider) ViewerColumnInfo(org.eclipse.wb.internal.rcp.model.jface.viewers.ViewerColumnInfo) TreeInputElementUiContentProvider(org.eclipse.wb.internal.rcp.databinding.ui.contentproviders.TreeInputElementUiContentProvider) ViewerColumnsConfiguration(org.eclipse.wb.internal.rcp.databinding.ui.contentproviders.ViewerColumnsConfiguration) TreeInputElementUiContentProvider(org.eclipse.wb.internal.rcp.databinding.ui.contentproviders.TreeInputElementUiContentProvider) InputElementUiContentProvider(org.eclipse.wb.internal.rcp.databinding.ui.contentproviders.InputElementUiContentProvider) WidgetBindableInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.bindables.WidgetBindableInfo)

Aggregations

InputElementUiContentProvider (org.eclipse.wb.internal.rcp.databinding.ui.contentproviders.InputElementUiContentProvider)2 IObserveInfo (org.eclipse.wb.internal.core.databinding.model.IObserveInfo)1 IUiContentProvider (org.eclipse.wb.internal.core.databinding.ui.editor.IUiContentProvider)1 ChooseClassAndPropertiesConfiguration (org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.ChooseClassAndPropertiesConfiguration)1 ChooseClassAndPropertiesRouter (org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.ChooseClassAndPropertiesRouter)1 LabelUiContentProvider (org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.LabelUiContentProvider)1 DetailBeanObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.beans.observables.DetailBeanObservableInfo)1 WidgetBindableInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.bindables.WidgetBindableInfo)1 TreeInputElementUiContentProvider (org.eclipse.wb.internal.rcp.databinding.ui.contentproviders.TreeInputElementUiContentProvider)1 ViewerColumnsConfiguration (org.eclipse.wb.internal.rcp.databinding.ui.contentproviders.ViewerColumnsConfiguration)1 ViewerColumnsUiContentProvider (org.eclipse.wb.internal.rcp.databinding.ui.contentproviders.ViewerColumnsUiContentProvider)1 ViewerColumnInfo (org.eclipse.wb.internal.rcp.model.jface.viewers.ViewerColumnInfo)1 ItemInfo (org.eclipse.wb.internal.swt.model.widgets.ItemInfo)1