use of org.eclipse.wb.internal.rcp.databinding.ui.contentproviders.TreeInputElementUiContentProvider in project windowbuilder by eclipse.
the class TreeViewerInputBindingInfo method createContentProviders.
// //////////////////////////////////////////////////////////////////////////
//
// Editing
//
// //////////////////////////////////////////////////////////////////////////
@Override
public void createContentProviders(List<IUiContentProvider> providers, IPageListener listener, DatabindingsProvider provider) throws Exception {
// configure page
listener.setTitle(Messages.TreeViewerInputBindingInfo_title);
listener.setMessage(Messages.TreeViewerInputBindingInfo_errorMessage);
//
providers.add(new LabelUiContentProvider(Messages.TreeViewerInputBindingInfo_viewerLabel, m_viewerBindable.getPresentation().getTextForBinding()));
providers.add(new LabelUiContentProvider(Messages.TreeViewerInputBindingInfo_inputLabel, m_inputObservable.getPresentationText()));
//
TreeInputElementUiContentProvider inputEditor = new TreeInputElementUiContentProvider(this, listener, provider);
//
if (m_inputObservable instanceof DetailBeanObservableInfo) {
m_inputObservable.createContentProviders(providers, null, provider);
//
ChooseClassAndPropertiesUiContentProvider masterUIContentProvider = (ChooseClassAndPropertiesUiContentProvider) providers.get(providers.size() - 1);
//
ChooseClassConfiguration configuration = new ChooseClassConfiguration();
configuration.setDialogFieldLabel(Messages.TreeViewerInputBindingInfo_chooseLabel);
configuration.setValueScope("beans1");
configuration.setChooseInterfaces(true);
configuration.setEmptyClassErrorMessage(Messages.TreeViewerInputBindingInfo_chooseEmptyMessage);
configuration.setErrorMessagePrefix(Messages.TreeViewerInputBindingInfo_chooseErrorPrefix);
//
TreeDetailUiContentProvider detailUIContentProvider = new TreeDetailUiContentProvider(configuration, (DetailBeanObservableInfo) m_inputObservable);
providers.add(detailUIContentProvider);
//
new ChooseClassAndPropertiesRouter(masterUIContentProvider, detailUIContentProvider);
new ChooseClassRouter(detailUIContentProvider, new MultiTargetRunnable(detailUIContentProvider, inputEditor.getElementTypeUIProviders()));
}
//
providers.add(inputEditor);
//
super.createContentProviders(providers, listener, provider);
}
use of org.eclipse.wb.internal.rcp.databinding.ui.contentproviders.TreeInputElementUiContentProvider 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));
}
}
}
Aggregations