Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2015-02-27 04:45:19 +0000
committerEike Stepper2015-02-27 19:13:46 +0000
commitbed99117889e877520dfea016c9d434208084582 (patch)
treef32fb4754a8119797be898ffa102b33e99f31405 /plugins/org.eclipse.emf.cdo.ui
parent4086386f0adefc75154c6b24ac21da81703d0ba2 (diff)
downloadcdo-bed99117889e877520dfea016c9d434208084582.tar.gz
cdo-bed99117889e877520dfea016c9d434208084582.tar.xz
cdo-bed99117889e877520dfea016c9d434208084582.zip
[458349] Consolidate UI
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=458349
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.ui')
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOPropertyAdapterFactory.java122
1 files changed, 66 insertions, 56 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOPropertyAdapterFactory.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOPropertyAdapterFactory.java
index 9d95a040df..d820c786e1 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOPropertyAdapterFactory.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOPropertyAdapterFactory.java
@@ -10,10 +10,12 @@
*/
package org.eclipse.emf.cdo.internal.ui;
+import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.edit.CDOItemProviderAdapter.CDOPropertyDescriptor;
import org.eclipse.emf.cdo.internal.ui.bundle.OM;
import org.eclipse.emf.cdo.internal.ui.editor.CDOEditor;
import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.emf.internal.cdo.object.ObjectProperties;
@@ -80,83 +82,87 @@ public class CDOPropertyAdapterFactory extends AbstractPropertyAdapterFactory
if (object instanceof EObject)
{
EObject eObject = (EObject)object;
-
- final Map<String, Object> emfProperties = new HashMap<String, Object>();
- DefaultPropertySource<EObject> result = new DefaultPropertySource<EObject>(eObject, ObjectProperties.INSTANCE)
+ CDOObject cdoObject = CDOUtil.getCDOObject(eObject, false);
+ if (cdoObject != null)
{
- @Override
- public Object getPropertyValue(Object id)
+ final Map<String, Object> emfProperties = new HashMap<String, Object>();
+ DefaultPropertySource<EObject> result = new DefaultPropertySource<EObject>(cdoObject,
+ ObjectProperties.INSTANCE)
{
- Object value = emfProperties.get(id);
- if (value != null)
+ @Override
+ public Object getPropertyValue(Object id)
{
- return value;
- }
-
- return super.getPropertyValue(id);
- }
- };
+ Object value = emfProperties.get(id);
+ if (value != null)
+ {
+ return value;
+ }
- ComposedAdapterFactory adapterFactory = null;
- AdapterFactoryLabelProvider labelProvider = null;
+ return super.getPropertyValue(id);
+ }
+ };
- try
- {
- adapterFactory = CDOEditor.createAdapterFactory(false);
+ ComposedAdapterFactory adapterFactory = null;
+ AdapterFactoryLabelProvider labelProvider = null;
- IItemPropertySource propertySource = (IItemPropertySource)adapterFactory.adapt(eObject,
- IItemPropertySource.class);
- if (propertySource != null)
+ try
{
- List<IItemPropertyDescriptor> propertyDescriptors = propertySource.getPropertyDescriptors(eObject);
- if (propertyDescriptors != null)
- {
- labelProvider = new AdapterFactoryLabelProvider(adapterFactory);
+ adapterFactory = CDOEditor.createAdapterFactory(false);
- for (IItemPropertyDescriptor propertyDescriptor : propertyDescriptors)
+ IItemPropertySource propertySource = (IItemPropertySource)adapterFactory.adapt(cdoObject,
+ IItemPropertySource.class);
+ if (propertySource != null)
+ {
+ List<IItemPropertyDescriptor> propertyDescriptors = propertySource.getPropertyDescriptors(cdoObject);
+ if (propertyDescriptors != null)
{
- if (propertyDescriptor instanceof CDOPropertyDescriptor)
+ labelProvider = new AdapterFactoryLabelProvider(adapterFactory);
+
+ for (IItemPropertyDescriptor propertyDescriptor : propertyDescriptors)
{
- continue;
- }
+ if (propertyDescriptor instanceof CDOPropertyDescriptor)
+ {
+ continue;
+ }
- String category = getTypeText(adapterFactory, eObject);
- String id = "___EMF___" + propertyDescriptor.getId(eObject);
- String displayName = propertyDescriptor.getDisplayName(eObject);
- String description = propertyDescriptor.getDescription(eObject);
+ String category = getTypeText(adapterFactory, cdoObject);
+ String id = "___EMF___" + propertyDescriptor.getId(cdoObject);
+ String displayName = propertyDescriptor.getDisplayName(cdoObject);
+ String description = propertyDescriptor.getDescription(cdoObject);
- PropertyDescriptor descriptor = result.addDescriptor(category, id, displayName, description);
+ PropertyDescriptor descriptor = result.addDescriptor(category, id, displayName, description);
- Object value = propertyDescriptor.getPropertyValue(eObject);
- emfProperties.put(id, value);
+ Object value = propertyDescriptor.getPropertyValue(cdoObject);
+ emfProperties.put(id, value);
- final String text = labelProvider.getText(value);
- descriptor.setLabelProvider(new LabelProvider()
- {
- @Override
- public String getText(Object element)
+ final String text = labelProvider.getText(value);
+ descriptor.setLabelProvider(new LabelProvider()
{
- return text;
- }
- });
+ @Override
+ public String getText(Object element)
+ {
+ return text;
+ }
+ });
+ }
}
}
}
- }
- finally
- {
- if (labelProvider != null)
+ finally
{
- labelProvider.dispose();
- }
+ if (labelProvider != null)
+ {
+ labelProvider.dispose();
+ }
- if (adapterFactory != null)
- {
- adapterFactory.dispose();
+ if (adapterFactory != null)
+ {
+ adapterFactory.dispose();
+ }
}
- }
- return result;
+ return result;
+ }
}
}
catch (LifecycleException ex)
@@ -189,7 +195,11 @@ public class CDOPropertyAdapterFactory extends AbstractPropertyAdapterFactory
if (object instanceof EObject)
{
- return OBJECT_ACTION_FILTER;
+ EObject eObject = (EObject)object;
+ if (CDOUtil.isCDOObject(eObject))
+ {
+ return OBJECT_ACTION_FILTER;
+ }
}
return super.createActionFilter(object);

Back to the top