use of org.eclipse.wb.internal.core.databinding.ui.editor.IUiContentProvider in project windowbuilder by eclipse.
the class JTableColumnContainerUiContentProvider method saveToObject.
@Override
@SuppressWarnings("unchecked")
protected void saveToObject(List<IUiContentProvider> providers) throws Exception {
List<ColumnBindingInfo> columns = Lists.newArrayList();
for (IUiContentProvider provider : providers) {
UIContentContainer<ColumnBindingInfo> container = (UIContentContainer<ColumnBindingInfo>) provider;
columns.add(container.getBinding());
}
m_binding.setColumns(columns, m_bindings);
}
use of org.eclipse.wb.internal.core.databinding.ui.editor.IUiContentProvider 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;
}
use of org.eclipse.wb.internal.core.databinding.ui.editor.IUiContentProvider in project windowbuilder by eclipse.
the class TreeInputElementUiContentProvider method createJFaceProviders.
/**
* Fill JFace page.
*/
private List<IUiContentProvider> createJFaceProviders() {
List<IUiContentProvider> providers = Lists.newArrayList();
//
if (m_binding.isDesignerMode()) {
// create fake objects
// create factory
ObservableFactoryInfo factory = new ObservableFactoryInfo("");
m_defaultObjects.add(factory);
factory.createContentProviders(providers, m_provider);
// create advisor
TreeStructureAdvisorInfo advisor = new TreeStructureAdvisorInfo("");
m_defaultObjects.add(advisor);
advisor.createContentProviders(providers, m_provider);
// content provider always exist
m_binding.getContentProvider().createContentProviders(providers, m_provider, false);
// create label provider
LabelProviderInfo labelProvider = new LabelProviderInfo("");
m_defaultObjects.add(labelProvider);
labelProvider.createContentProviders(providers, m_provider, false);
} else {
// add life objects
createDefaultProviders(providers, false);
}
//
final ObservableInfo inputObservable = m_binding.getInputObservable();
if (inputObservable instanceof ListBeanObservableInfo || inputObservable instanceof SetBeanObservableInfo || inputObservable instanceof BeanFieldInputObservableInfo) {
final ChooseClassUiContentProvider contentProviderJFaceEditor = (ChooseClassUiContentProvider) providers.get(0);
//
try {
String factoryValue = inputObservable.getBindableProperty().getReference() + ", " + ClassUtils.getShortClassName(inputObservable.getBindableObject().getObjectType()) + ".class)";
//
if (inputObservable instanceof ListBeanObservableInfo) {
factoryValue = "listFactory(" + factoryValue;
contentProviderJFaceEditor.getConfiguration().addDefaultStart(factoryValue);
contentProviderJFaceEditor.addClassToCombo(factoryValue);
} else if (inputObservable instanceof SetBeanObservableInfo) {
factoryValue = "setFactory(" + factoryValue;
contentProviderJFaceEditor.getConfiguration().addDefaultStart(factoryValue);
contentProviderJFaceEditor.addClassToCombo(factoryValue);
}
} catch (Throwable e) {
}
//
new ChooseClassRouter(contentProviderJFaceEditor, new Runnable() {
@Override
public void run() {
String className = contentProviderJFaceEditor.getClassName();
if (className.startsWith("listFactory") || className.startsWith("setFactory")) {
m_elementTypeJFaceUIProvider.setClassName(CoreUtils.getClassName(inputObservable.getBindableObject().getObjectType()));
}
}
});
}
//
m_labelProviderJFaceEditor = (ChooseClassUiContentProvider) providers.get(providers.size() - 1);
new ChooseClassRouter(m_labelProviderJFaceEditor, new Runnable() {
@Override
public void run() {
m_elementTypeJFaceUIProvider.calculateFinish();
}
});
//
providers.add(m_elementTypeJFaceUIProvider);
return providers;
}
use of org.eclipse.wb.internal.core.databinding.ui.editor.IUiContentProvider in project windowbuilder by eclipse.
the class ViewerColumnsUiContentProvider method configureEditingSupport.
// //////////////////////////////////////////////////////////////////////////
//
// Handle
//
// //////////////////////////////////////////////////////////////////////////
private void configureEditingSupport() {
try {
// prepare selection
IStructuredSelection selection = (IStructuredSelection) m_tableViewer.getSelection();
VirtualEditingSupportInfo editingSupport = (VirtualEditingSupportInfo) selection.getFirstElement();
// create providers
List<IUiContentProvider> providers = Lists.newArrayList();
editingSupport.createContentProviders(providers);
// open dialog
SimpleBindDialog dialog = new SimpleBindDialog(m_editButton.getShell(), Activator.getDefault(), providers, Messages.ViewerColumnsUiContentProvider_configureEditingSupportLabel, Messages.ViewerColumnsUiContentProvider_configureEditingSupportProperties, Messages.ViewerColumnsUiContentProvider_configureEditingSupportMessage);
if (dialog.open() == Window.OK) {
m_tableViewer.refresh();
}
} catch (Throwable e) {
DesignerPlugin.log(e);
}
}
use of org.eclipse.wb.internal.core.databinding.ui.editor.IUiContentProvider in project windowbuilder by eclipse.
the class DatabindingsProvider method getContentProviders.
// //////////////////////////////////////////////////////////////////////////
//
// UI editing
//
// //////////////////////////////////////////////////////////////////////////
@Override
public List<IUiContentProvider> getContentProviders(IBindingInfo ibinding, IPageListener listener) throws Exception {
AbstractBindingInfo binding = (AbstractBindingInfo) ibinding;
List<IUiContentProvider> providers = Lists.newArrayList();
binding.createContentProviders(providers, listener, this);
return providers;
}
Aggregations