From 68c7086726a9a853a7aa0afd24d841fb83df3f24 Mon Sep 17 00:00:00 2001 From: Eike Stepper Date: Tue, 4 Jan 2011 20:00:09 +0000 Subject: [284307] Add support for streaming of large byte arrays / BLOB https://bugs.eclipse.org/bugs/show_bug.cgi?id=284307 --- .../org.eclipse.emf.cdo.edit/META-INF/MANIFEST.MF | 3 +- ...eAnnotation_details_EStringToStringMapEntry.gif | Bin 0 -> 350 bytes .../CreateModelElement_annotations_Annotation.gif | Bin 0 -> 585 bytes .../icons/full/obj16/Annotation.gif | Bin 0 -> 554 bytes plugins/org.eclipse.emf.cdo.edit/plugin.properties | 6 + .../org/eclipse/emf/cdo/edit/CDOEditPlugin.java | 94 +++++++ .../eresource/provider/EresourceEditPlugin.java | 93 ------- .../EresourceItemProviderAdapterFactory.java | 3 +- .../etypes/provider/AnnotationItemProvider.java | 187 ++++++++++++++ .../provider/EtypesItemProviderAdapterFactory.java | 275 +++++++++++++++++++++ .../etypes/provider/ModelElementItemProvider.java | 177 +++++++++++++ .../org.eclipse.emf.cdo/model/eresource.genmodel | 2 +- plugins/org.eclipse.emf.cdo/model/etypes.genmodel | 54 ++-- .../cdo/eresource/impl/EresourcePackageImpl.java | 32 +-- .../emf/cdo/etypes/impl/EtypesPackageImpl.java | 19 +- .../eclipse/emf/cdo/etypes/util/EtypesSwitch.java | 6 - .../emf/internal/cdo/object/CDOLegacyAdapter.java | 1 - 17 files changed, 787 insertions(+), 165 deletions(-) create mode 100644 plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateAnnotation_details_EStringToStringMapEntry.gif create mode 100644 plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateModelElement_annotations_Annotation.gif create mode 100644 plugins/org.eclipse.emf.cdo.edit/icons/full/obj16/Annotation.gif create mode 100644 plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/edit/CDOEditPlugin.java delete mode 100644 plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceEditPlugin.java create mode 100644 plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/etypes/provider/AnnotationItemProvider.java create mode 100644 plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/etypes/provider/EtypesItemProviderAdapterFactory.java create mode 100644 plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/etypes/provider/ModelElementItemProvider.java (limited to 'plugins') diff --git a/plugins/org.eclipse.emf.cdo.edit/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.edit/META-INF/MANIFEST.MF index 77eeac90ab..c0a283bc57 100644 --- a/plugins/org.eclipse.emf.cdo.edit/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.cdo.edit/META-INF/MANIFEST.MF @@ -6,7 +6,7 @@ Bundle-Name: %pluginName Bundle-Vendor: %providerName Bundle-Localization: plugin Bundle-ActivationPolicy: lazy -Bundle-Activator: org.eclipse.emf.cdo.eresource.provider.EresourceEditPlugin$Implementation +Bundle-Activator: org.eclipse.emf.cdo.edit.CDOEditPlugin$Implementation Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ClassPath: . Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)", @@ -16,4 +16,5 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)", org.eclipse.emf.cdo;bundle-version="[4.0.0,5.0.0)";visibility:=reexport Export-Package: org.eclipse.emf.cdo.edit;version="4.0.0", org.eclipse.emf.cdo.eresource.provider;version="4.0.0", + org.eclipse.emf.cdo.etypes.provider;version="4.0.0", org.eclipse.emf.cdo.internal.edit.messages;version="4.0.0";x-internal:=true diff --git a/plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateAnnotation_details_EStringToStringMapEntry.gif b/plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateAnnotation_details_EStringToStringMapEntry.gif new file mode 100644 index 0000000000..ecb89fffc7 Binary files /dev/null and b/plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateAnnotation_details_EStringToStringMapEntry.gif differ diff --git a/plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateModelElement_annotations_Annotation.gif b/plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateModelElement_annotations_Annotation.gif new file mode 100644 index 0000000000..588cca4118 Binary files /dev/null and b/plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateModelElement_annotations_Annotation.gif differ diff --git a/plugins/org.eclipse.emf.cdo.edit/icons/full/obj16/Annotation.gif b/plugins/org.eclipse.emf.cdo.edit/icons/full/obj16/Annotation.gif new file mode 100644 index 0000000000..0df81a30b2 Binary files /dev/null and b/plugins/org.eclipse.emf.cdo.edit/icons/full/obj16/Annotation.gif differ diff --git a/plugins/org.eclipse.emf.cdo.edit/plugin.properties b/plugins/org.eclipse.emf.cdo.edit/plugin.properties index ab735be95f..e48aafa356 100644 --- a/plugins/org.eclipse.emf.cdo.edit/plugin.properties +++ b/plugins/org.eclipse.emf.cdo.edit/plugin.properties @@ -42,3 +42,9 @@ _UI_CDOResourceNode_name_feature = Name _UI_CDOResourceNode_path_feature = Path _UI_CDOResourceFolder_contents_feature = Contents _UI_CDOResourceFolder_nodes_feature = Nodes +_UI_ModelElement_type = Model Element +_UI_Annotation_type = Annotation +_UI_ModelElement_annotations_feature = Annotations +_UI_Annotation_source_feature = Source +_UI_Annotation_details_feature = Details +_UI_Annotation_modelElement_feature = Model Element diff --git a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/edit/CDOEditPlugin.java b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/edit/CDOEditPlugin.java new file mode 100644 index 0000000000..b708e140be --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/edit/CDOEditPlugin.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.edit; + +import org.eclipse.emf.common.EMFPlugin; +import org.eclipse.emf.common.util.ResourceLocator; +import org.eclipse.emf.ecore.provider.EcoreEditPlugin; + +/** + * This is the central singleton for the Etypes edit plugin. + * + * @since 4.0 + * @generated + */ +public final class CDOEditPlugin extends EMFPlugin +{ + /** + * Keep track of the singleton. + * + * @generated + */ + public static final CDOEditPlugin INSTANCE = new CDOEditPlugin(); + + /** + * Keep track of the singleton. + * + * @generated + */ + private static Implementation plugin; + + /** + * Create the instance. + * + * @generated + */ + public CDOEditPlugin() + { + super(new ResourceLocator[] { EcoreEditPlugin.INSTANCE, }); + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * + * @return the singleton instance. + * @generated + */ + @Override + public ResourceLocator getPluginResourceLocator() + { + return plugin; + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * + * @return the singleton instance. + * @generated + */ + public static Implementation getPlugin() + { + return plugin; + } + + /** + * The actual implementation of the Eclipse Plugin. + * + * @generated + */ + public static class Implementation extends EclipsePlugin + { + /** + * Creates an instance. + * + * @generated + */ + public Implementation() + { + super(); + + // Remember the static instance. + // + plugin = this; + } + } + +} diff --git a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceEditPlugin.java b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceEditPlugin.java deleted file mode 100644 index 6b63a1296a..0000000000 --- a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceEditPlugin.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.cdo.eresource.provider; - -import org.eclipse.emf.common.EMFPlugin; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.ecore.provider.EcoreEditPlugin; - -/** - * This is the central singleton for the Eresource edit plugin. - * - * @generated - */ -public final class EresourceEditPlugin extends EMFPlugin -{ - /** - * Keep track of the singleton. - * - * @generated - */ - public static final EresourceEditPlugin INSTANCE = new EresourceEditPlugin(); - - /** - * Keep track of the singleton. - * - * @generated - */ - private static Implementation plugin; - - /** - * Create the instance. - * - * @generated - */ - public EresourceEditPlugin() - { - super(new ResourceLocator[] { EcoreEditPlugin.INSTANCE, }); - } - - /** - * Returns the singleton instance of the Eclipse plugin. - * - * @return the singleton instance. - * @generated - */ - @Override - public ResourceLocator getPluginResourceLocator() - { - return plugin; - } - - /** - * Returns the singleton instance of the Eclipse plugin. - * - * @return the singleton instance. - * @generated - */ - public static Implementation getPlugin() - { - return plugin; - } - - /** - * The actual implementation of the Eclipse Plugin. - * - * @generated - */ - public static class Implementation extends EclipsePlugin - { - /** - * Creates an instance. - * - * @generated - */ - public Implementation() - { - super(); - - // Remember the static instance. - // - plugin = this; - } - } - -} diff --git a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceItemProviderAdapterFactory.java b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceItemProviderAdapterFactory.java index bb62c92d03..5190675e83 100644 --- a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceItemProviderAdapterFactory.java +++ b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceItemProviderAdapterFactory.java @@ -10,6 +10,7 @@ */ package org.eclipse.emf.cdo.eresource.provider; +import org.eclipse.emf.cdo.edit.CDOEditPlugin; import org.eclipse.emf.cdo.eresource.EresourcePackage; import org.eclipse.emf.cdo.eresource.util.EresourceAdapterFactory; @@ -74,7 +75,7 @@ public class EresourceItemProviderAdapterFactory extends EresourceAdapterFactory * @generated */ protected ChildCreationExtenderManager childCreationExtenderManager = new ChildCreationExtenderManager( - EresourceEditPlugin.INSTANCE, EresourcePackage.eNS_URI); + CDOEditPlugin.INSTANCE, EresourcePackage.eNS_URI); /** * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. + * + * @since 4.0 + * @generated + */ +public class AnnotationItemProvider extends ModelElementItemProvider implements IEditingDomainItemProvider, + IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, + ITableItemLabelProvider, ITableItemColorProvider, ITableItemFontProvider, IItemColorProvider, IItemFontProvider +{ + /** + * This constructs an instance from a factory and a notifier. + * + * @generated + */ + public AnnotationItemProvider(AdapterFactory adapterFactory) + { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) + { + if (itemPropertyDescriptors == null) + { + super.getPropertyDescriptors(object); + + addSourcePropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Source feature. + * + * @generated + */ + protected void addSourcePropertyDescriptor(Object object) + { + itemPropertyDescriptors.add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Annotation_source_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Annotation_source_feature", "_UI_Annotation_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EtypesPackage.Literals.ANNOTATION__SOURCE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, null)); + } + + /** + * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an + * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or + * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. + * + * @generated + */ + @Override + public Collection getChildrenFeatures(Object object) + { + if (childrenFeatures == null) + { + super.getChildrenFeatures(object); + childrenFeatures.add(EtypesPackage.Literals.ANNOTATION__DETAILS); + } + return childrenFeatures; + } + + /** + * + * + * @generated + */ + @Override + protected EStructuralFeature getChildFeature(Object object, Object child) + { + // Check the type of the specified child object and return the proper feature to use for + // adding (see {@link AddCommand}) it as a child. + + return super.getChildFeature(object, child); + } + + /** + * This returns Annotation.gif. + * + * @generated + */ + @Override + public Object getImage(Object object) + { + return overlayImage(object, getResourceLocator().getImage("full/obj16/Annotation")); //$NON-NLS-1$ + } + + /** + * This returns the label text for the adapted class. + * + * @generated + */ + @Override + public String getText(Object object) + { + String label = ((Annotation)object).getSource(); + return label == null || label.length() == 0 ? getString("_UI_Annotation_type") : //$NON-NLS-1$ + getString("_UI_Annotation_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating a + * viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) + { + updateChildren(notification); + + switch (notification.getFeatureID(Annotation.class)) + { + case EtypesPackage.ANNOTATION__SOURCE: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + case EtypesPackage.ANNOTATION__DETAILS: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created under + * this object. + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) + { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add(createChildParameter(EtypesPackage.Literals.ANNOTATION__DETAILS, + EcoreFactory.eINSTANCE.create(EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY))); + } + +} diff --git a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/etypes/provider/EtypesItemProviderAdapterFactory.java b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/etypes/provider/EtypesItemProviderAdapterFactory.java new file mode 100644 index 0000000000..e8a3c03d93 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/etypes/provider/EtypesItemProviderAdapterFactory.java @@ -0,0 +1,275 @@ +/** + * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.etypes.provider; + +import org.eclipse.emf.cdo.edit.CDOEditPlugin; +import org.eclipse.emf.cdo.etypes.EtypesPackage; +import org.eclipse.emf.cdo.etypes.util.EtypesAdapterFactory; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.util.ResourceLocator; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.edit.provider.ChangeNotifier; +import org.eclipse.emf.edit.provider.ChildCreationExtenderManager; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.IChangeNotifier; +import org.eclipse.emf.edit.provider.IChildCreationExtender; +import org.eclipse.emf.edit.provider.IDisposable; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemColorProvider; +import org.eclipse.emf.edit.provider.IItemFontProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.INotifyChangedListener; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITableItemColorProvider; +import org.eclipse.emf.edit.provider.ITableItemFontProvider; +import org.eclipse.emf.edit.provider.ITableItemLabelProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * This is the factory that is used to provide the interfaces needed to support Viewers. The adapters generated by this + * factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}. The adapters + * also support Eclipse property sheets. Note that most of the adapters are shared among multiple instances. + * + * @since 4.0 + * @generated + */ +public class EtypesItemProviderAdapterFactory extends EtypesAdapterFactory implements ComposeableAdapterFactory, + IChangeNotifier, IDisposable, IChildCreationExtender +{ + /** + * This keeps track of the root adapter factory that delegates to this adapter factory. + * + * @generated + */ + protected ComposedAdapterFactory parentAdapterFactory; + + /** + * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. + * + * @generated + */ + protected IChangeNotifier changeNotifier = new ChangeNotifier(); + + /** + * This helps manage the child creation extenders. + * + * @generated + */ + protected ChildCreationExtenderManager childCreationExtenderManager = new ChildCreationExtenderManager( + CDOEditPlugin.INSTANCE, EtypesPackage.eNS_URI); + + /** + * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. + * + * @generated + */ + protected Collection supportedTypes = new ArrayList(); + + /** + * This constructs an instance. + * + * @generated + */ + public EtypesItemProviderAdapterFactory() + { + supportedTypes.add(IEditingDomainItemProvider.class); + supportedTypes.add(IStructuredItemContentProvider.class); + supportedTypes.add(ITreeItemContentProvider.class); + supportedTypes.add(IItemLabelProvider.class); + supportedTypes.add(IItemPropertySource.class); + supportedTypes.add(ITableItemLabelProvider.class); + supportedTypes.add(ITableItemColorProvider.class); + supportedTypes.add(ITableItemFontProvider.class); + supportedTypes.add(IItemColorProvider.class); + supportedTypes.add(IItemFontProvider.class); + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.emf.cdo.etypes.Annotation} instances. + * + * @generated + */ + protected AnnotationItemProvider annotationItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.emf.cdo.etypes.Annotation}. + * + * @generated + */ + @Override + public Adapter createAnnotationAdapter() + { + if (annotationItemProvider == null) + { + annotationItemProvider = new AnnotationItemProvider(this); + } + + return annotationItemProvider; + } + + /** + * This returns the root adapter factory that contains this factory. + * + * @generated + */ + public ComposeableAdapterFactory getRootAdapterFactory() + { + return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); + } + + /** + * This sets the composed adapter factory that contains this factory. + * + * @generated + */ + public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) + { + this.parentAdapterFactory = parentAdapterFactory; + } + + /** + * + * + * @generated + */ + @Override + public boolean isFactoryForType(Object type) + { + return supportedTypes.contains(type) || super.isFactoryForType(type); + } + + /** + * This implementation substitutes the factory itself as the key for the adapter. + * + * @generated + */ + @Override + public Adapter adapt(Notifier notifier, Object type) + { + return super.adapt(notifier, this); + } + + /** + * + * + * @generated + */ + @Override + public Object adapt(Object object, Object type) + { + if (isFactoryForType(type)) + { + Object adapter = super.adapt(object, type); + if (!(type instanceof Class) || ((Class)type).isInstance(adapter)) + { + return adapter; + } + } + + return null; + } + + /** + * + * + * @generated + */ + public List getChildCreationExtenders() + { + return childCreationExtenderManager.getChildCreationExtenders(); + } + + /** + * + * + * @generated + */ + public Collection getNewChildDescriptors(Object object, EditingDomain editingDomain) + { + return childCreationExtenderManager.getNewChildDescriptors(object, editingDomain); + } + + /** + * + * + * @generated + */ + public ResourceLocator getResourceLocator() + { + return childCreationExtenderManager; + } + + /** + * This adds a listener. + * + * @generated + */ + public void addListener(INotifyChangedListener notifyChangedListener) + { + changeNotifier.addListener(notifyChangedListener); + } + + /** + * This removes a listener. + * + * @generated + */ + public void removeListener(INotifyChangedListener notifyChangedListener) + { + changeNotifier.removeListener(notifyChangedListener); + } + + /** + * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. + * + * @generated + */ + public void fireNotifyChanged(Notification notification) + { + changeNotifier.fireNotifyChanged(notification); + + if (parentAdapterFactory != null) + { + parentAdapterFactory.fireNotifyChanged(notification); + } + } + + /** + * This disposes all of the item providers created by this factory. + * + * @generated + */ + public void dispose() + { + if (annotationItemProvider != null) + { + annotationItemProvider.dispose(); + } + } + +} diff --git a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/etypes/provider/ModelElementItemProvider.java b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/etypes/provider/ModelElementItemProvider.java new file mode 100644 index 0000000000..bdc97f81b3 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/etypes/provider/ModelElementItemProvider.java @@ -0,0 +1,177 @@ +/** + * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.etypes.provider; + +import org.eclipse.emf.cdo.etypes.EtypesFactory; +import org.eclipse.emf.cdo.etypes.EtypesPackage; +import org.eclipse.emf.cdo.etypes.ModelElement; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.ResourceLocator; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.provider.IChildCreationExtender; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemColorProvider; +import org.eclipse.emf.edit.provider.IItemFontProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITableItemColorProvider; +import org.eclipse.emf.edit.provider.ITableItemFontProvider; +import org.eclipse.emf.edit.provider.ITableItemLabelProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import java.util.Collection; +import java.util.List; + +/** + * This is the item provider adapter for a {@link org.eclipse.emf.cdo.etypes.ModelElement} object. + * + * @since 4.0 + * @generated + */ +public class ModelElementItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, + IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, + ITableItemLabelProvider, ITableItemColorProvider, ITableItemFontProvider, IItemColorProvider, IItemFontProvider +{ + /** + * This constructs an instance from a factory and a notifier. + * + * @generated + */ + public ModelElementItemProvider(AdapterFactory adapterFactory) + { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) + { + if (itemPropertyDescriptors == null) + { + super.getPropertyDescriptors(object); + + } + return itemPropertyDescriptors; + } + + /** + * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an + * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or + * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. + * + * @generated + */ + @Override + public Collection getChildrenFeatures(Object object) + { + if (childrenFeatures == null) + { + super.getChildrenFeatures(object); + childrenFeatures.add(EtypesPackage.Literals.MODEL_ELEMENT__ANNOTATIONS); + } + return childrenFeatures; + } + + /** + * + * + * @generated + */ + @Override + protected EStructuralFeature getChildFeature(Object object, Object child) + { + // Check the type of the specified child object and return the proper feature to use for + // adding (see {@link AddCommand}) it as a child. + + return super.getChildFeature(object, child); + } + + /** + * + * + * @generated + */ + @Override + public boolean hasChildren(Object object) + { + return hasChildren(object, true); + } + + /** + * This returns the label text for the adapted class. + * + * @generated + */ + @Override + public String getText(Object object) + { + return getString("_UI_ModelElement_type"); //$NON-NLS-1$ + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating a + * viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) + { + updateChildren(notification); + + switch (notification.getFeatureID(ModelElement.class)) + { + case EtypesPackage.MODEL_ELEMENT__ANNOTATIONS: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created under + * this object. + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) + { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add(createChildParameter(EtypesPackage.Literals.MODEL_ELEMENT__ANNOTATIONS, + EtypesFactory.eINSTANCE.createAnnotation())); + } + + /** + * Return the resource locator for this item provider's resources. + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() + { + return ((IChildCreationExtender)adapterFactory).getResourceLocator(); + } + +} diff --git a/plugins/org.eclipse.emf.cdo/model/eresource.genmodel b/plugins/org.eclipse.emf.cdo/model/eresource.genmodel index b92f660d9a..a952b14dba 100644 --- a/plugins/org.eclipse.emf.cdo/model/eresource.genmodel +++ b/plugins/org.eclipse.emf.cdo/model/eresource.genmodel @@ -3,7 +3,7 @@ xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="" modelDirectory="/org.eclipse.emf.cdo/src" editDirectory="/org.eclipse.emf.cdo.edit/src" - editorDirectory="" modelPluginID="org.eclipse.emf.cdo" modelName="Eresource" editPluginClass="org.eclipse.emf.cdo.eresource.provider.EresourceEditPlugin" + editorDirectory="" modelPluginID="org.eclipse.emf.cdo" modelName="Eresource" editPluginClass="org.eclipse.emf.cdo.edit.CDOEditPlugin" editorPluginClass="" updateClasspath="false" nonNLSMarkers="true" rootExtendsInterface="org.eclipse.emf.cdo.CDOObject" rootExtendsClass="org.eclipse.emf.internal.cdo.CDOObjectImpl" reflectiveDelegation="true" codeFormatting="true" testsDirectory="" importerID="org.eclipse.emf.importer.ecore" diff --git a/plugins/org.eclipse.emf.cdo/model/etypes.genmodel b/plugins/org.eclipse.emf.cdo/model/etypes.genmodel index d4e54e6c7c..e586d826fe 100644 --- a/plugins/org.eclipse.emf.cdo/model/etypes.genmodel +++ b/plugins/org.eclipse.emf.cdo/model/etypes.genmodel @@ -1,39 +1,31 @@ - + etypes.ecore CDO=org.eclipse.emf.cdo - - - - - - - - - - - - - - - - - - + + + + + + + - - - - - - - - - - - + + + + - diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java index ac5ad767cd..83923f99bc 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java @@ -116,9 +116,7 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka public static EresourcePackage init() { if (isInited) - { return (EresourcePackage)EPackage.Registry.INSTANCE.getEPackage(EresourcePackage.eNS_URI); - } // Obtain or create and register package EresourcePackageImpl theEresourcePackage = (EresourcePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof EresourcePackageImpl ? EPackage.Registry.INSTANCE @@ -365,9 +363,7 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka public void createPackageContents() { if (isCreated) - { return; - } isCreated = true; // Create classes and their features @@ -412,9 +408,7 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka public void initializePackageContents() { if (isInitialized) - { return; - } isInitialized = true; // Initialize package @@ -430,16 +424,16 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka // Set bounds for type parameters // Add supertypes to classes - cdoResourceFolderEClass.getESuperTypes().add(getCDOResourceNode()); - cdoResourceEClass.getESuperTypes().add(getCDOResourceNode()); + cdoResourceFolderEClass.getESuperTypes().add(this.getCDOResourceNode()); + cdoResourceEClass.getESuperTypes().add(this.getCDOResourceNode()); // Initialize classes and features; add operations and parameters initEClass(cdoResourceNodeEClass, CDOResourceNode.class, "CDOResourceNode", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEReference( getCDOResourceNode_Folder(), - getCDOResourceFolder(), - getCDOResourceFolder_Nodes(), + this.getCDOResourceFolder(), + this.getCDOResourceFolder_Nodes(), "folder", null, 0, 1, CDOResourceNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEAttribute( getCDOResourceNode_Name(), @@ -454,26 +448,26 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka "CDOResourceFolder", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEReference( getCDOResourceFolder_Nodes(), - getCDOResourceNode(), - getCDOResourceNode_Folder(), + this.getCDOResourceNode(), + this.getCDOResourceNode_Folder(), "nodes", null, 0, -1, CDOResourceFolder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - EOperation op = addEOperation(cdoResourceFolderEClass, getCDOResourceFolder(), + EOperation op = addEOperation(cdoResourceFolderEClass, this.getCDOResourceFolder(), "addResourceFolder", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ addEParameter(op, theEcorePackage.getEString(), "name", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ - op = addEOperation(cdoResourceFolderEClass, getCDOResource(), "addResource", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ + op = addEOperation(cdoResourceFolderEClass, this.getCDOResource(), "addResource", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ addEParameter(op, theEcorePackage.getEString(), "name", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ initEClass(cdoResourceEClass, CDOResource.class, "CDOResource", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEAttribute( getCDOResource_ResourceSet(), - getResourceSet(), + this.getResourceSet(), "resourceSet", null, 0, 1, CDOResource.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEAttribute( getCDOResource_URI(), - getURI(), + this.getURI(), "uRI", null, 0, 1, CDOResource.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEReference( getCDOResource_Contents(), @@ -494,11 +488,11 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka "trackingModification", null, 0, 1, CDOResource.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEAttribute( getCDOResource_Errors(), - getDiagnostic(), + this.getDiagnostic(), "errors", null, 0, -1, CDOResource.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEAttribute( getCDOResource_Warnings(), - getDiagnostic(), + this.getDiagnostic(), "warnings", null, 0, -1, CDOResource.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEAttribute( getCDOResource_TimeStamp(), @@ -528,7 +522,7 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka */ protected void createDBStoreAnnotations() { - String source = "http://www.eclipse.org/CDO/DBStore"; //$NON-NLS-1$ + String source = "http://www.eclipse.org/CDO/DBStore"; //$NON-NLS-1$ addAnnotation(getCDOResourceNode_Name(), source, new String[] { "columnType", "VARCHAR", //$NON-NLS-1$ //$NON-NLS-2$ "columnLength", "255" //$NON-NLS-1$ //$NON-NLS-2$ }); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/impl/EtypesPackageImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/impl/EtypesPackageImpl.java index d67637ef86..36fc61b7e3 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/impl/EtypesPackageImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/impl/EtypesPackageImpl.java @@ -102,9 +102,7 @@ public class EtypesPackageImpl extends EPackageImpl implements EtypesPackage public static EtypesPackage init() { if (isInited) - { return (EtypesPackage)EPackage.Registry.INSTANCE.getEPackage(EtypesPackage.eNS_URI); - } // Obtain or create and register package EtypesPackageImpl theEtypesPackage = (EtypesPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof EtypesPackageImpl ? EPackage.Registry.INSTANCE @@ -235,9 +233,7 @@ public class EtypesPackageImpl extends EPackageImpl implements EtypesPackage public void createPackageContents() { if (isCreated) - { return; - } isCreated = true; // Create classes and their features @@ -270,9 +266,7 @@ public class EtypesPackageImpl extends EPackageImpl implements EtypesPackage public void initializePackageContents() { if (isInitialized) - { return; - } isInitialized = true; // Initialize package @@ -288,18 +282,19 @@ public class EtypesPackageImpl extends EPackageImpl implements EtypesPackage // Set bounds for type parameters // Add supertypes to classes - annotationEClass.getESuperTypes().add(getModelElement()); + annotationEClass.getESuperTypes().add(this.getModelElement()); // Initialize classes and features; add operations and parameters initEClass(modelElementEClass, ModelElement.class, "ModelElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEReference( getModelElement_Annotations(), - getAnnotation(), - getAnnotation_ModelElement(), + this.getAnnotation(), + this.getAnnotation_ModelElement(), "annotations", null, 0, -1, ModelElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - EOperation op = addEOperation(modelElementEClass, getAnnotation(), "getAnnotation", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ + EOperation op = addEOperation(modelElementEClass, this.getAnnotation(), + "getAnnotation", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ addEParameter(op, theEcorePackage.getEString(), "source", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ initEClass(annotationEClass, Annotation.class, @@ -315,8 +310,8 @@ public class EtypesPackageImpl extends EPackageImpl implements EtypesPackage "details", null, 0, -1, Annotation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEReference( getAnnotation_ModelElement(), - getModelElement(), - getModelElement_Annotations(), + this.getModelElement(), + this.getModelElement_Annotations(), "modelElement", null, 0, 1, Annotation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ // Initialize data types diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/util/EtypesSwitch.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/util/EtypesSwitch.java index 21b093ee21..b0d4374573 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/util/EtypesSwitch.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/util/EtypesSwitch.java @@ -97,9 +97,7 @@ public class EtypesSwitch ModelElement modelElement = (ModelElement)theEObject; T result = caseModelElement(modelElement); if (result == null) - { result = defaultCase(theEObject); - } return result; } case EtypesPackage.ANNOTATION: @@ -107,13 +105,9 @@ public class EtypesSwitch Annotation annotation = (Annotation)theEObject; T result = caseAnnotation(annotation); if (result == null) - { result = caseModelElement(annotation); - } if (result == null) - { result = defaultCase(theEObject); - } return result; } default: diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyAdapter.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyAdapter.java index 60a1738e93..2bc24043de 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyAdapter.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyAdapter.java @@ -15,7 +15,6 @@ import org.eclipse.emf.cdo.CDONotification; import org.eclipse.emf.cdo.common.model.EMFUtil; import org.eclipse.emf.cdo.transaction.CDOTransaction; - import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.Notifier; -- cgit v1.2.3