diff options
author | Victor Roldan Betancort | 2009-05-25 11:17:31 +0000 |
---|---|---|
committer | Victor Roldan Betancort | 2009-05-25 11:17:31 +0000 |
commit | b4be7e91f1e9c9658d7fe6a2020ce5f8716207cb (patch) | |
tree | ced7c3fd8ebb93109fecd2035a6f1d31c40ccd3b /plugins/org.eclipse.emf.cdo.edit | |
parent | 9196816eecd1bbbd2511c5e5bfd49bc77ecf45e6 (diff) | |
download | cdo-b4be7e91f1e9c9658d7fe6a2020ce5f8716207cb.tar.gz cdo-b4be7e91f1e9c9658d7fe6a2020ce5f8716207cb.tar.xz cdo-b4be7e91f1e9c9658d7fe6a2020ce5f8716207cb.zip |
[258433] [UI] Provide user repository URI preferences page
https://bugs.eclipse.org/bugs/show_bug.cgi?id=258433
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.edit')
2 files changed, 80 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/edit/CDOItemProviderAdapter.java b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/edit/CDOItemProviderAdapter.java index e5caca7ebd..98500b3898 100644 --- a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/edit/CDOItemProviderAdapter.java +++ b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/edit/CDOItemProviderAdapter.java @@ -94,6 +94,7 @@ public class CDOItemProviderAdapter extends ItemProviderAdapter addWriteLockedDescriptor(object); addAdaptersDescriptor(object); addChangeSubscriptionPoliciesDescriptor(object); + addURIDescriptor(object); } return itemPropertyDescriptors; @@ -180,6 +181,14 @@ public class CDOItemProviderAdapter extends ItemProviderAdapter } /** + * @since 2.0 + */ + protected void addURIDescriptor(Object object) + { + itemPropertyDescriptors.add(new URIDescriptor()); + } + + /** * Base abstract to add CDO debug information to PropertiesView. Users wanting to add new information to the * Properties View can subclass this class instead of directly implementing {@link IItemPropertyDescriptor}. * @@ -903,4 +912,72 @@ public class CDOItemProviderAdapter extends ItemProviderAdapter }; } } + + /** + * Adds the URI of a {@link CDOObject} to the Properties View. + * + * @since 2.0 + * @author Victor Roldan Betancort + */ + public static class URIDescriptor extends CDOPropertyDescriptor implements IItemPropertyDescriptor + { + private static final String FEATURE_ID = Messages.getString("CDOItemProviderAdapter.31"); //$NON-NLS-1$ + + private static final String DISPLAY_NAME = Messages.getString("CDOItemProviderAdapter.32"); //$NON-NLS-1$ + + private static final String DESCRIPTION = Messages.getString("CDOItemProviderAdapter.33"); //$NON-NLS-1$ + + public URIDescriptor() + { + } + + public Object getPropertyValue(Object object) + { + if (object instanceof CDOObject) + { + return ((CDOObject)object).eResource().getURI().toString() + "#" + ((CDOObject)object).cdoID().toURIFragment(); //$NON-NLS-1$ + } + + return null; + } + + public String getDescription(Object object) + { + return DESCRIPTION; + } + + public String getDisplayName(Object object) + { + return DISPLAY_NAME; + } + + public Object getFeature(Object object) + { + return FEATURE_ID; + } + + public String getId(Object object) + { + return FEATURE_ID; + } + + @Override + public IItemLabelProvider getLabelProvider(Object object) + { + return new DefaultLabelProvider() + { + @Override + public String getText(Object object) + { + if (object instanceof String) + { + return (String)object; + } + + return null; + } + }; + } + } + } diff --git a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/internal/edit/messages/messages.properties b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/internal/edit/messages/messages.properties index 69ebcee341..13aa414be9 100644 --- a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/internal/edit/messages/messages.properties +++ b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/internal/edit/messages/messages.properties @@ -33,6 +33,9 @@ CDOItemProviderAdapter.28=ChangeSubscriptionPolicies CDOItemProviderAdapter.29=Change Subscription Policies CDOItemProviderAdapter.3=The CDOID uniquely identifies this object in the repository CDOItemProviderAdapter.30=The change subscription policies associated with the underlying view of this object +CDOItemProviderAdapter.31=URI +CDOItemProviderAdapter.32=URI +CDOItemProviderAdapter.33=URI for this CDOObject CDOItemProviderAdapter.4=Version CDOItemProviderAdapter.5=Version CDOItemProviderAdapter.6=The version of this object |