diff options
author | Francesco Guidieri | 2013-07-04 14:30:36 +0000 |
---|---|---|
committer | Francesco Guidieri | 2013-07-04 14:30:36 +0000 |
commit | 6eff5a52e3078e23bb6cc982adb9f6120110f679 (patch) | |
tree | ce9d26c1f0afde3c5a261661e053a36ffef81f22 /examples/org.eclipse.emf.examples.library.edit | |
download | org.eclipse.emf-parsley-6eff5a52e3078e23bb6cc982adb9f6120110f679.tar.gz org.eclipse.emf-parsley-6eff5a52e3078e23bb6cc982adb9f6120110f679.tar.xz org.eclipse.emf-parsley-6eff5a52e3078e23bb6cc982adb9f6120110f679.zip |
Initial contribution
Diffstat (limited to 'examples/org.eclipse.emf.examples.library.edit')
39 files changed, 3033 insertions, 0 deletions
diff --git a/examples/org.eclipse.emf.examples.library.edit/.classpath b/examples/org.eclipse.emf.examples.library.edit/.classpath new file mode 100644 index 000000000..304e86186 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/examples/org.eclipse.emf.examples.library.edit/.project b/examples/org.eclipse.emf.examples.library.edit/.project new file mode 100644 index 000000000..3b692448a --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/.project @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.emf.examples.library.edit</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.emf.cdo.releng.version.VersionBuilder</name> + <arguments> + <dictionary> + <key>ignore.missing.dependency.ranges</key> + <value>true</value> + </dictionary> + <dictionary> + <key>ignore.schema.builder</key> + <value>true</value> + </dictionary> + <dictionary> + <key>release.path</key> + <value>/org.eclipse.emf.java/release.xml</value> + </dictionary> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.emf.cdo.releng.version.VersionNature</nature> + </natures> +</projectDescription> diff --git a/examples/org.eclipse.emf.examples.library.edit/.settings/org.eclipse.jdt.core.prefs b/examples/org.eclipse.emf.examples.library.edit/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..d29b0f382 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +#Wed Nov 08 10:51:59 EST 2006 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/examples/org.eclipse.emf.examples.library.edit/.settings/org.eclipse.jdt.launching.prefs b/examples/org.eclipse.emf.examples.library.edit/.settings/org.eclipse.jdt.launching.prefs new file mode 100644 index 000000000..96809758d --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/.settings/org.eclipse.jdt.launching.prefs @@ -0,0 +1,3 @@ +#Wed Aug 12 21:10:17 CEST 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=ignore diff --git a/examples/org.eclipse.emf.examples.library.edit/META-INF/MANIFEST.MF b/examples/org.eclipse.emf.examples.library.edit/META-INF/MANIFEST.MF new file mode 100644 index 000000000..c75eb7d46 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.emf.examples.library.edit; singleton:=true +Bundle-Version: 2.5.0.qualifier +Bundle-ClassPath: . +Bundle-Activator: org.eclipse.emf.examples.extlibrary.provider.EXTLibraryEditPlugin$Implementation +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: org.eclipse.emf.examples.extlibrary.provider +Require-Bundle: org.eclipse.core.runtime;bundle-version="3.5.0", + org.eclipse.emf.examples.library;visibility:=reexport, + org.eclipse.emf.edit;bundle-version="2.7.0";visibility:=reexport +Eclipse-LazyStart: true +Bundle-ActivationPolicy: lazy diff --git a/examples/org.eclipse.emf.examples.library.edit/about.html b/examples/org.eclipse.emf.examples.library.edit/about.html new file mode 100644 index 000000000..1b8f94080 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>June 5, 2007</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p> + +</body> +</html>
\ No newline at end of file diff --git a/examples/org.eclipse.emf.examples.library.edit/build.properties b/examples/org.eclipse.emf.examples.library.edit/build.properties new file mode 100644 index 000000000..ca45351e6 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/build.properties @@ -0,0 +1,9 @@ +bin.includes = icons/,\ + .,\ + META-INF/,\ + plugin.xml,\ + plugin.properties,\ + about.html +source.. = src/ +output.. = bin/ +src.includes = about.html diff --git a/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_borrowers_Borrower.gif b/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_borrowers_Borrower.gif Binary files differnew file mode 100644 index 000000000..6b4e4321e --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_borrowers_Borrower.gif diff --git a/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_branches_Library.gif b/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_branches_Library.gif Binary files differnew file mode 100644 index 000000000..883ce93b4 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_branches_Library.gif diff --git a/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_employees_Employee.gif b/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_employees_Employee.gif Binary files differnew file mode 100644 index 000000000..5b7808087 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_employees_Employee.gif diff --git a/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_stock_Book.gif b/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_stock_Book.gif Binary files differnew file mode 100644 index 000000000..9073955a8 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_stock_Book.gif diff --git a/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_stock_BookOnTape.gif b/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_stock_BookOnTape.gif Binary files differnew file mode 100644 index 000000000..5d5000a7f --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_stock_BookOnTape.gif diff --git a/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_stock_VideoCassette.gif b/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_stock_VideoCassette.gif Binary files differnew file mode 100644 index 000000000..cca8aec82 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_stock_VideoCassette.gif diff --git a/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_writers_Writer.gif b/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_writers_Writer.gif Binary files differnew file mode 100644 index 000000000..564bdbd77 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/icons/full/ctool16/CreateLibrary_writers_Writer.gif diff --git a/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/Book.gif b/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/Book.gif Binary files differnew file mode 100644 index 000000000..c3370c7dd --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/Book.gif diff --git a/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/BookOnTape.gif b/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/BookOnTape.gif Binary files differnew file mode 100644 index 000000000..cb1755a71 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/BookOnTape.gif diff --git a/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/Borrower.gif b/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/Borrower.gif Binary files differnew file mode 100644 index 000000000..10d222998 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/Borrower.gif diff --git a/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/CirculatingItem.gif b/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/CirculatingItem.gif Binary files differnew file mode 100644 index 000000000..c3370c7dd --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/CirculatingItem.gif diff --git a/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/Employee.gif b/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/Employee.gif Binary files differnew file mode 100644 index 000000000..1e5345fb3 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/Employee.gif diff --git a/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/Library.gif b/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/Library.gif Binary files differnew file mode 100644 index 000000000..739ebbfa6 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/Library.gif diff --git a/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/Person.gif b/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/Person.gif Binary files differnew file mode 100644 index 000000000..ea58a657d --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/Person.gif diff --git a/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/VideoCassette.gif b/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/VideoCassette.gif Binary files differnew file mode 100644 index 000000000..9250fecbf --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/VideoCassette.gif diff --git a/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/Writer.gif b/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/Writer.gif Binary files differnew file mode 100644 index 000000000..ef56c1408 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/icons/full/obj16/Writer.gif diff --git a/examples/org.eclipse.emf.examples.library.edit/plugin.properties b/examples/org.eclipse.emf.examples.library.edit/plugin.properties new file mode 100644 index 000000000..e0c1c64d0 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/plugin.properties @@ -0,0 +1,79 @@ +# /** +# * Copyright (c) 2002-2008 IBM Corporation 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: +# * IBM - Initial API and implementation +# */ + +# NLS_MESSAGEFORMAT_VAR + +pluginName = EMF Extended Library Edit Example +providerName = Eclipse Modeling Project + +_UI_CreateChild_text = {0} +_UI_CreateChild_text2 = {1} {0} +_UI_CreateChild_text3 = {1} +_UI_CreateChild_tooltip = Create New {0} Under {1} Feature +_UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}. +_UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent. + +_UI_PropertyDescriptor_description = The {0} of the {1} + +_UI_Book_type = Book +_UI_Library_type = Library +_UI_Writer_type = Writer +_UI_Item_type = Item +_UI_Lendable_type = Lendable +_UI_CirculatingItem_type = Circulating Item +_UI_Periodical_type = Periodical +_UI_AudioVisualItem_type = Audio Visual Item +_UI_BookOnTape_type = Book On Tape +_UI_VideoCassette_type = Video Cassette +_UI_Borrower_type = Borrower +_UI_Person_type = Person +_UI_Employee_type = Employee +_UI_Addressable_type = Addressable +_UI_Unknown_type = Object + +_UI_Unknown_datatype= Value + +_UI_Book_title_feature = Title +_UI_Book_pages_feature = Pages +_UI_Book_category_feature = Category +_UI_Book_author_feature = Author +_UI_Library_name_feature = Name +_UI_Library_writers_feature = Writers +_UI_Library_employees_feature = Employees +_UI_Library_borrowers_feature = Borrowers +_UI_Library_stock_feature = Stock +_UI_Library_books_feature = Books +_UI_Library_branches_feature = Branches +_UI_Library_parentBranch_feature = Parent Branch +_UI_Library_people_feature = People +_UI_Writer_name_feature = Name +_UI_Writer_books_feature = Books +_UI_Item_publicationDate_feature = Publication Date +_UI_Lendable_copies_feature = Copies +_UI_Lendable_borrowers_feature = Borrowers +_UI_Periodical_title_feature = Title +_UI_Periodical_issuesPerYear_feature = Issues Per Year +_UI_AudioVisualItem_title_feature = Title +_UI_AudioVisualItem_minutesLength_feature = Minutes Length +_UI_AudioVisualItem_damaged_feature = Damaged +_UI_BookOnTape_reader_feature = Reader +_UI_BookOnTape_author_feature = Author +_UI_VideoCassette_cast_feature = Cast +_UI_Borrower_borrowed_feature = Borrowed +_UI_Person_firstName_feature = First Name +_UI_Person_lastName_feature = Last Name +_UI_Employee_manager_feature = Manager +_UI_Addressable_address_feature = Address +_UI_Unknown_feature = Unspecified + +_UI_BookCategory_Mystery_literal = Mystery +_UI_BookCategory_ScienceFiction_literal = ScienceFiction +_UI_BookCategory_Biography_literal = Biography diff --git a/examples/org.eclipse.emf.examples.library.edit/plugin.xml b/examples/org.eclipse.emf.examples.library.edit/plugin.xml new file mode 100644 index 000000000..1fdd258c0 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/plugin.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.0"?> + +<plugin> + + <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories"> + <factory + uri="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0" + class="org.eclipse.emf.examples.extlibrary.provider.EXTLibraryItemProviderAdapterFactory" + supportedTypes= + "org.eclipse.emf.edit.provider.IEditingDomainItemProvider + org.eclipse.emf.edit.provider.IStructuredItemContentProvider + org.eclipse.emf.edit.provider.ITreeItemContentProvider + org.eclipse.emf.edit.provider.IItemLabelProvider + org.eclipse.emf.edit.provider.IItemPropertySource"/> + </extension> + +</plugin> diff --git a/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/AudioVisualItemItemProvider.java b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/AudioVisualItemItemProvider.java new file mode 100644 index 000000000..e31420af3 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/AudioVisualItemItemProvider.java @@ -0,0 +1,199 @@ +/** + * Copyright (c) 2005-2006 IBM Corporation 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: + * IBM - Initial API and implementation + */ +package org.eclipse.emf.examples.extlibrary.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +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.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import org.eclipse.emf.examples.extlibrary.AudioVisualItem; +import org.eclipse.emf.examples.extlibrary.EXTLibraryPackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.emf.examples.extlibrary.AudioVisualItem} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ +public class AudioVisualItemItemProvider + extends CirculatingItemItemProvider + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource +{ + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public AudioVisualItemItemProvider(AdapterFactory adapterFactory) + { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) + { + if (itemPropertyDescriptors == null) + { + super.getPropertyDescriptors(object); + + addTitlePropertyDescriptor(object); + addMinutesLengthPropertyDescriptor(object); + addDamagedPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Title feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addTitlePropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_AudioVisualItem_title_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_AudioVisualItem_title_feature", "_UI_AudioVisualItem_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.AUDIO_VISUAL_ITEM__TITLE, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Minutes Length feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addMinutesLengthPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_AudioVisualItem_minutesLength_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_AudioVisualItem_minutesLength_feature", "_UI_AudioVisualItem_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.AUDIO_VISUAL_ITEM__MINUTES_LENGTH, + true, + false, + false, + ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Damaged feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addDamagedPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_AudioVisualItem_damaged_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_AudioVisualItem_damaged_feature", "_UI_AudioVisualItem_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.AUDIO_VISUAL_ITEM__DAMAGED, + true, + false, + false, + ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, + null, + null)); + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String getText(Object object) + { + String label = ((AudioVisualItem)object).getTitle(); + return label == null || label.length() == 0 ? + getString("_UI_AudioVisualItem_type") : //$NON-NLS-1$ + getString("_UI_AudioVisualItem_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}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void notifyChanged(Notification notification) + { + updateChildren(notification); + + switch (notification.getFeatureID(AudioVisualItem.class)) + { + case EXTLibraryPackage.AUDIO_VISUAL_ITEM__TITLE: + case EXTLibraryPackage.AUDIO_VISUAL_ITEM__MINUTES_LENGTH: + case EXTLibraryPackage.AUDIO_VISUAL_ITEM__DAMAGED: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) + { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/BookItemProvider.java b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/BookItemProvider.java new file mode 100644 index 000000000..e5962f3e6 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/BookItemProvider.java @@ -0,0 +1,235 @@ +/** + * Copyright (c) 2005-2006 IBM Corporation 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: + * IBM - Initial API and implementation + */ +package org.eclipse.emf.examples.extlibrary.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +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.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import org.eclipse.emf.examples.extlibrary.Book; +import org.eclipse.emf.examples.extlibrary.EXTLibraryPackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.emf.examples.extlibrary.Book} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ +public class BookItemProvider + extends CirculatingItemItemProvider + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource +{ + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public BookItemProvider(AdapterFactory adapterFactory) + { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) + { + if (itemPropertyDescriptors == null) + { + super.getPropertyDescriptors(object); + + addTitlePropertyDescriptor(object); + addPagesPropertyDescriptor(object); + addCategoryPropertyDescriptor(object); + addAuthorPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Title feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addTitlePropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Book_title_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Book_title_feature", "_UI_Book_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.BOOK__TITLE, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Pages feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addPagesPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Book_pages_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Book_pages_feature", "_UI_Book_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.BOOK__PAGES, + true, + false, + false, + ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Category feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addCategoryPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Book_category_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Book_category_feature", "_UI_Book_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.BOOK__CATEGORY, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Author feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addAuthorPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Book_author_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Book_author_feature", "_UI_Book_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.BOOK__AUTHOR, + true, + false, + false, + null, + null, + null)); + } + + /** + * This returns Book.gif. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object getImage(Object object) + { + return overlayImage(object, getResourceLocator().getImage("full/obj16/Book")); //$NON-NLS-1$ + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String getText(Object object) + { + String label = ((Book)object).getTitle(); + return label == null || label.length() == 0 ? + getString("_UI_Book_type") : //$NON-NLS-1$ + getString("_UI_Book_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}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void notifyChanged(Notification notification) + { + updateChildren(notification); + + switch (notification.getFeatureID(Book.class)) + { + case EXTLibraryPackage.BOOK__TITLE: + case EXTLibraryPackage.BOOK__PAGES: + case EXTLibraryPackage.BOOK__CATEGORY: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) + { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/BookOnTapeItemProvider.java b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/BookOnTapeItemProvider.java new file mode 100644 index 000000000..2f4a2824d --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/BookOnTapeItemProvider.java @@ -0,0 +1,176 @@ +/** + * Copyright (c) 2005-2006 IBM Corporation 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: + * IBM - Initial API and implementation + */ +package org.eclipse.emf.examples.extlibrary.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +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.ITreeItemContentProvider; + +import org.eclipse.emf.examples.extlibrary.BookOnTape; +import org.eclipse.emf.examples.extlibrary.EXTLibraryPackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.emf.examples.extlibrary.BookOnTape} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ +public class BookOnTapeItemProvider + extends AudioVisualItemItemProvider + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource +{ + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public BookOnTapeItemProvider(AdapterFactory adapterFactory) + { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) + { + if (itemPropertyDescriptors == null) + { + super.getPropertyDescriptors(object); + + addReaderPropertyDescriptor(object); + addAuthorPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Reader feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addReaderPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_BookOnTape_reader_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_BookOnTape_reader_feature", "_UI_BookOnTape_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.BOOK_ON_TAPE__READER, + true, + false, + false, + null, + null, + null)); + } + + /** + * This adds a property descriptor for the Author feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addAuthorPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_BookOnTape_author_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_BookOnTape_author_feature", "_UI_BookOnTape_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.BOOK_ON_TAPE__AUTHOR, + true, + false, + false, + null, + null, + null)); + } + + /** + * This returns BookOnTape.gif. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object getImage(Object object) + { + return overlayImage(object, getResourceLocator().getImage("full/obj16/BookOnTape")); //$NON-NLS-1$ + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String getText(Object object) + { + String label = ((BookOnTape)object).getTitle(); + return label == null || label.length() == 0 ? + getString("_UI_BookOnTape_type") : //$NON-NLS-1$ + getString("_UI_BookOnTape_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}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void notifyChanged(Notification notification) + { + updateChildren(notification); + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) + { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/BorrowerItemProvider.java b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/BorrowerItemProvider.java new file mode 100644 index 000000000..4eaad6e79 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/BorrowerItemProvider.java @@ -0,0 +1,152 @@ +/** + * Copyright (c) 2005-2006 IBM Corporation 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: + * IBM - Initial API and implementation + */ +package org.eclipse.emf.examples.extlibrary.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +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.ITreeItemContentProvider; + +import org.eclipse.emf.examples.extlibrary.Borrower; +import org.eclipse.emf.examples.extlibrary.EXTLibraryPackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.emf.examples.extlibrary.Borrower} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ +public class BorrowerItemProvider + extends PersonItemProvider + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource +{ + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public BorrowerItemProvider(AdapterFactory adapterFactory) + { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) + { + if (itemPropertyDescriptors == null) + { + super.getPropertyDescriptors(object); + + addBorrowedPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Borrowed feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addBorrowedPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Borrower_borrowed_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Borrower_borrowed_feature", "_UI_Borrower_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.BORROWER__BORROWED, + true, + false, + false, + null, + null, + null)); + } + + /** + * This returns Borrower.gif. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object getImage(Object object) + { + return overlayImage(object, getResourceLocator().getImage("full/obj16/Borrower")); //$NON-NLS-1$ + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String getText(Object object) + { + String label = ((Borrower)object).getLastName(); + return label == null || label.length() == 0 ? + getString("_UI_Borrower_type") : //$NON-NLS-1$ + getString("_UI_Borrower_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}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void notifyChanged(Notification notification) + { + updateChildren(notification); + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) + { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/CirculatingItemItemProvider.java b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/CirculatingItemItemProvider.java new file mode 100644 index 000000000..d607ac702 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/CirculatingItemItemProvider.java @@ -0,0 +1,187 @@ +/** + * Copyright (c) 2005-2006 IBM Corporation 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: + * IBM - Initial API and implementation + */ +package org.eclipse.emf.examples.extlibrary.provider; + + +import java.util.Collection; +import java.util.Date; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +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.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import org.eclipse.emf.examples.extlibrary.CirculatingItem; +import org.eclipse.emf.examples.extlibrary.EXTLibraryPackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.emf.examples.extlibrary.CirculatingItem} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ +public class CirculatingItemItemProvider + extends ItemItemProvider + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource +{ + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CirculatingItemItemProvider(AdapterFactory adapterFactory) + { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) + { + if (itemPropertyDescriptors == null) + { + super.getPropertyDescriptors(object); + + addCopiesPropertyDescriptor(object); + addBorrowersPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Copies feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addCopiesPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Lendable_copies_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Lendable_copies_feature", "_UI_Lendable_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.LENDABLE__COPIES, + true, + false, + false, + ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Borrowers feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addBorrowersPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Lendable_borrowers_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Lendable_borrowers_feature", "_UI_Lendable_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.LENDABLE__BORROWERS, + true, + false, + false, + null, + null, + null)); + } + + /** + * This returns CirculatingItem.gif. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object getImage(Object object) + { + return overlayImage(object, getResourceLocator().getImage("full/obj16/CirculatingItem")); //$NON-NLS-1$ + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String getText(Object object) + { + Date labelValue = ((CirculatingItem)object).getPublicationDate(); + String label = labelValue == null ? null : labelValue.toString(); + return label == null || label.length() == 0 ? + getString("_UI_CirculatingItem_type") : //$NON-NLS-1$ + getString("_UI_CirculatingItem_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}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void notifyChanged(Notification notification) + { + updateChildren(notification); + + switch (notification.getFeatureID(CirculatingItem.class)) + { + case EXTLibraryPackage.CIRCULATING_ITEM__COPIES: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) + { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/EXTLibraryEditPlugin.java b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/EXTLibraryEditPlugin.java new file mode 100644 index 000000000..55669ff0b --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/EXTLibraryEditPlugin.java @@ -0,0 +1,104 @@ +/** + * Copyright (c) 2005-2006 IBM Corporation 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: + * IBM - Initial API and implementation + */ +package org.eclipse.emf.examples.extlibrary.provider; + +import org.eclipse.emf.common.EMFPlugin; + +import org.eclipse.emf.common.util.ResourceLocator; + +/** + * This is the central singleton for the EXTLibrary edit plugin. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ +public final class EXTLibraryEditPlugin extends EMFPlugin +{ + /** + * Keep track of the singleton. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static final EXTLibraryEditPlugin INSTANCE = new EXTLibraryEditPlugin(); + + /** + * Keep track of the singleton. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static Implementation plugin; + + /** + * Create the instance. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EXTLibraryEditPlugin() + { + super + (new ResourceLocator [] + { + }); + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the singleton instance. + * @generated + */ + @Override + public ResourceLocator getPluginResourceLocator() + { + return plugin; + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the singleton instance. + * @generated + */ + public static Implementation getPlugin() + { + return plugin; + } + + /** + * The actual implementation of the Eclipse <b>Plugin</b>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static class Implementation extends EclipsePlugin + { + /** + * Creates an instance. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Implementation() + { + super(); + + // Remember the static instance. + // + plugin = this; + } + } + +} diff --git a/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/EXTLibraryItemProviderAdapterFactory.java b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/EXTLibraryItemProviderAdapterFactory.java new file mode 100644 index 000000000..b69e90a78 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/EXTLibraryItemProviderAdapterFactory.java @@ -0,0 +1,405 @@ +/** + * Copyright (c) 2005-2006 IBM Corporation 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: + * IBM - Initial API and implementation + */ +package org.eclipse.emf.examples.extlibrary.provider; + +import java.util.ArrayList; +import java.util.Collection; + +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.edit.provider.ChangeNotifier; +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.IDisposable; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +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.ITreeItemContentProvider; + +import org.eclipse.emf.examples.extlibrary.util.EXTLibraryAdapterFactory; + +/** + * 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. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ +public class EXTLibraryItemProviderAdapterFactory extends EXTLibraryAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable +{ + /** + * This keeps track of the root adapter factory that delegates to this adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected ComposedAdapterFactory parentAdapterFactory; + + /** + * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected IChangeNotifier changeNotifier = new ChangeNotifier(); + + /** + * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected Collection<Object> supportedTypes = new ArrayList<Object>(); + + /** + * This constructs an instance. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EXTLibraryItemProviderAdapterFactory() + { + supportedTypes.add(IEditingDomainItemProvider.class); + supportedTypes.add(IStructuredItemContentProvider.class); + supportedTypes.add(ITreeItemContentProvider.class); + supportedTypes.add(IItemLabelProvider.class); + supportedTypes.add(IItemPropertySource.class); + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.emf.examples.extlibrary.Book} instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected BookItemProvider bookItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.emf.examples.extlibrary.Book}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Adapter createBookAdapter() + { + if (bookItemProvider == null) + { + bookItemProvider = new BookItemProvider(this); + } + + return bookItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.emf.examples.extlibrary.Library} instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected LibraryItemProvider libraryItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.emf.examples.extlibrary.Library}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Adapter createLibraryAdapter() + { + if (libraryItemProvider == null) + { + libraryItemProvider = new LibraryItemProvider(this); + } + + return libraryItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.emf.examples.extlibrary.Writer} instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected WriterItemProvider writerItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.emf.examples.extlibrary.Writer}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Adapter createWriterAdapter() + { + if (writerItemProvider == null) + { + writerItemProvider = new WriterItemProvider(this); + } + + return writerItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.emf.examples.extlibrary.BookOnTape} instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected BookOnTapeItemProvider bookOnTapeItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.emf.examples.extlibrary.BookOnTape}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Adapter createBookOnTapeAdapter() + { + if (bookOnTapeItemProvider == null) + { + bookOnTapeItemProvider = new BookOnTapeItemProvider(this); + } + + return bookOnTapeItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.emf.examples.extlibrary.VideoCassette} instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected VideoCassetteItemProvider videoCassetteItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.emf.examples.extlibrary.VideoCassette}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Adapter createVideoCassetteAdapter() + { + if (videoCassetteItemProvider == null) + { + videoCassetteItemProvider = new VideoCassetteItemProvider(this); + } + + return videoCassetteItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.emf.examples.extlibrary.Borrower} instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected BorrowerItemProvider borrowerItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.emf.examples.extlibrary.Borrower}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Adapter createBorrowerAdapter() + { + if (borrowerItemProvider == null) + { + borrowerItemProvider = new BorrowerItemProvider(this); + } + + return borrowerItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.emf.examples.extlibrary.Person} instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected PersonItemProvider personItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.emf.examples.extlibrary.Person}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Adapter createPersonAdapter() + { + if (personItemProvider == null) + { + personItemProvider = new PersonItemProvider(this); + } + + return personItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.emf.examples.extlibrary.Employee} instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected EmployeeItemProvider employeeItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.emf.examples.extlibrary.Employee}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Adapter createEmployeeAdapter() + { + if (employeeItemProvider == null) + { + employeeItemProvider = new EmployeeItemProvider(this); + } + + return employeeItemProvider; + } + + /** + * This returns the root adapter factory that contains this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ComposeableAdapterFactory getRootAdapterFactory() + { + return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); + } + + /** + * This sets the composed adapter factory that contains this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) + { + this.parentAdapterFactory = parentAdapterFactory; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @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. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Adapter adapt(Notifier notifier, Object type) + { + return super.adapt(notifier, this); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @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; + } + + /** + * This adds a listener. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void addListener(INotifyChangedListener notifyChangedListener) + { + changeNotifier.addListener(notifyChangedListener); + } + + /** + * This removes a listener. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void removeListener(INotifyChangedListener notifyChangedListener) + { + changeNotifier.removeListener(notifyChangedListener); + } + + /** + * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @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. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void dispose() + { + if (bookItemProvider != null) bookItemProvider.dispose(); + if (libraryItemProvider != null) libraryItemProvider.dispose(); + if (writerItemProvider != null) writerItemProvider.dispose(); + if (bookOnTapeItemProvider != null) bookOnTapeItemProvider.dispose(); + if (videoCassetteItemProvider != null) videoCassetteItemProvider.dispose(); + if (borrowerItemProvider != null) borrowerItemProvider.dispose(); + if (personItemProvider != null) personItemProvider.dispose(); + if (employeeItemProvider != null) employeeItemProvider.dispose(); + } + +} diff --git a/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/EmployeeItemProvider.java b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/EmployeeItemProvider.java new file mode 100644 index 000000000..5c4e17a7b --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/EmployeeItemProvider.java @@ -0,0 +1,152 @@ +/** + * Copyright (c) 2005-2006 IBM Corporation 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: + * IBM - Initial API and implementation + */ +package org.eclipse.emf.examples.extlibrary.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +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.ITreeItemContentProvider; + +import org.eclipse.emf.examples.extlibrary.EXTLibraryPackage; +import org.eclipse.emf.examples.extlibrary.Employee; + +/** + * This is the item provider adapter for a {@link org.eclipse.emf.examples.extlibrary.Employee} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ +public class EmployeeItemProvider + extends PersonItemProvider + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource +{ + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EmployeeItemProvider(AdapterFactory adapterFactory) + { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) + { + if (itemPropertyDescriptors == null) + { + super.getPropertyDescriptors(object); + + addManagerPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Manager feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addManagerPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Employee_manager_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Employee_manager_feature", "_UI_Employee_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.EMPLOYEE__MANAGER, + true, + false, + false, + null, + null, + null)); + } + + /** + * This returns Employee.gif. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object getImage(Object object) + { + return overlayImage(object, getResourceLocator().getImage("full/obj16/Employee")); //$NON-NLS-1$ + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String getText(Object object) + { + String label = ((Employee)object).getLastName(); + return label == null || label.length() == 0 ? + getString("_UI_Employee_type") : //$NON-NLS-1$ + getString("_UI_Employee_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}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void notifyChanged(Notification notification) + { + updateChildren(notification); + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) + { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/ItemItemProvider.java b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/ItemItemProvider.java new file mode 100644 index 000000000..87fdf8543 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/ItemItemProvider.java @@ -0,0 +1,166 @@ +/** + * Copyright (c) 2005-2006 IBM Corporation 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: + * IBM - Initial API and implementation + */ +package org.eclipse.emf.examples.extlibrary.provider; + + +import java.util.Collection; +import java.util.Date; +import java.util.List; + +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.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +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.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import org.eclipse.emf.examples.extlibrary.EXTLibraryPackage; +import org.eclipse.emf.examples.extlibrary.Item; + +/** + * This is the item provider adapter for a {@link org.eclipse.emf.examples.extlibrary.Item} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ +public class ItemItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource +{ + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ItemItemProvider(AdapterFactory adapterFactory) + { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) + { + if (itemPropertyDescriptors == null) + { + super.getPropertyDescriptors(object); + + addPublicationDatePropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Publication Date feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addPublicationDatePropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Item_publicationDate_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Item_publicationDate_feature", "_UI_Item_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.ITEM__PUBLICATION_DATE, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String getText(Object object) + { + Date labelValue = ((Item)object).getPublicationDate(); + String label = labelValue == null ? null : labelValue.toString(); + return label == null || label.length() == 0 ? + getString("_UI_Item_type") : //$NON-NLS-1$ + getString("_UI_Item_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}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void notifyChanged(Notification notification) + { + updateChildren(notification); + + switch (notification.getFeatureID(Item.class)) + { + case EXTLibraryPackage.ITEM__PUBLICATION_DATE: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) + { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public ResourceLocator getResourceLocator() + { + return EXTLibraryEditPlugin.INSTANCE; + } + +} diff --git a/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/LibraryItemProvider.java b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/LibraryItemProvider.java new file mode 100644 index 000000000..0b3267e73 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/LibraryItemProvider.java @@ -0,0 +1,307 @@ +/** + * Copyright (c) 2005-2006 IBM Corporation 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: + * IBM - Initial API and implementation + */ +package org.eclipse.emf.examples.extlibrary.provider; + + +import java.util.Collection; +import java.util.List; + +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.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +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.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import org.eclipse.emf.examples.extlibrary.EXTLibraryFactory; +import org.eclipse.emf.examples.extlibrary.EXTLibraryPackage; +import org.eclipse.emf.examples.extlibrary.Library; + +/** + * This is the item provider adapter for a {@link org.eclipse.emf.examples.extlibrary.Library} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ +public class LibraryItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource +{ + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public LibraryItemProvider(AdapterFactory adapterFactory) + { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) + { + if (itemPropertyDescriptors == null) + { + super.getPropertyDescriptors(object); + + addAddressPropertyDescriptor(object); + addNamePropertyDescriptor(object); + addBooksPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Address feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addAddressPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Addressable_address_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Addressable_address_feature", "_UI_Addressable_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.ADDRESSABLE__ADDRESS, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Name feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addNamePropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Library_name_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Library_name_feature", "_UI_Library_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.LIBRARY__NAME, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Books feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addBooksPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Library_books_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Library_books_feature", "_UI_Library_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.LIBRARY__BOOKS, + false, + false, + false, + null, + 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}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) + { + if (childrenFeatures == null) + { + super.getChildrenFeatures(object); + childrenFeatures.add(EXTLibraryPackage.Literals.LIBRARY__WRITERS); + childrenFeatures.add(EXTLibraryPackage.Literals.LIBRARY__EMPLOYEES); + childrenFeatures.add(EXTLibraryPackage.Literals.LIBRARY__BORROWERS); + childrenFeatures.add(EXTLibraryPackage.Literals.LIBRARY__STOCK); + childrenFeatures.add(EXTLibraryPackage.Literals.LIBRARY__BRANCHES); + } + return childrenFeatures; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @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 Library.gif. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object getImage(Object object) + { + return overlayImage(object, getResourceLocator().getImage("full/obj16/Library")); //$NON-NLS-1$ + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String getText(Object object) + { + String label = ((Library)object).getName(); + return label == null || label.length() == 0 ? + getString("_UI_Library_type") : //$NON-NLS-1$ + getString("_UI_Library_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}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void notifyChanged(Notification notification) + { + updateChildren(notification); + + switch (notification.getFeatureID(Library.class)) + { + case EXTLibraryPackage.LIBRARY__ADDRESS: + case EXTLibraryPackage.LIBRARY__NAME: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + case EXTLibraryPackage.LIBRARY__WRITERS: + case EXTLibraryPackage.LIBRARY__EMPLOYEES: + case EXTLibraryPackage.LIBRARY__BORROWERS: + case EXTLibraryPackage.LIBRARY__STOCK: + case EXTLibraryPackage.LIBRARY__BRANCHES: + 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. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) + { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add + (createChildParameter + (EXTLibraryPackage.Literals.LIBRARY__WRITERS, + EXTLibraryFactory.eINSTANCE.createWriter())); + + newChildDescriptors.add + (createChildParameter + (EXTLibraryPackage.Literals.LIBRARY__EMPLOYEES, + EXTLibraryFactory.eINSTANCE.createEmployee())); + + newChildDescriptors.add + (createChildParameter + (EXTLibraryPackage.Literals.LIBRARY__BORROWERS, + EXTLibraryFactory.eINSTANCE.createBorrower())); + + newChildDescriptors.add + (createChildParameter + (EXTLibraryPackage.Literals.LIBRARY__STOCK, + EXTLibraryFactory.eINSTANCE.createBook())); + + newChildDescriptors.add + (createChildParameter + (EXTLibraryPackage.Literals.LIBRARY__STOCK, + EXTLibraryFactory.eINSTANCE.createBookOnTape())); + + newChildDescriptors.add + (createChildParameter + (EXTLibraryPackage.Literals.LIBRARY__STOCK, + EXTLibraryFactory.eINSTANCE.createVideoCassette())); + + newChildDescriptors.add + (createChildParameter + (EXTLibraryPackage.Literals.LIBRARY__BRANCHES, + EXTLibraryFactory.eINSTANCE.createLibrary())); + } + + /** + * Return the resource locator for this item provider's resources. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public ResourceLocator getResourceLocator() + { + return EXTLibraryEditPlugin.INSTANCE; + } + +} diff --git a/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/PeriodicalItemProvider.java b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/PeriodicalItemProvider.java new file mode 100644 index 000000000..065b27e46 --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/PeriodicalItemProvider.java @@ -0,0 +1,174 @@ +/** + * Copyright (c) 2005-2006 IBM Corporation 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: + * IBM - Initial API and implementation + */ +package org.eclipse.emf.examples.extlibrary.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +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.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import org.eclipse.emf.examples.extlibrary.EXTLibraryPackage; +import org.eclipse.emf.examples.extlibrary.Periodical; + +/** + * This is the item provider adapter for a {@link org.eclipse.emf.examples.extlibrary.Periodical} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ +public class PeriodicalItemProvider + extends ItemItemProvider + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource +{ + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public PeriodicalItemProvider(AdapterFactory adapterFactory) + { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) + { + if (itemPropertyDescriptors == null) + { + super.getPropertyDescriptors(object); + + addTitlePropertyDescriptor(object); + addIssuesPerYearPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Title feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addTitlePropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Periodical_title_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Periodical_title_feature", "_UI_Periodical_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.PERIODICAL__TITLE, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Issues Per Year feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addIssuesPerYearPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Periodical_issuesPerYear_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Periodical_issuesPerYear_feature", "_UI_Periodical_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.PERIODICAL__ISSUES_PER_YEAR, + true, + false, + false, + ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, + null, + null)); + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String getText(Object object) + { + String label = ((Periodical)object).getTitle(); + return label == null || label.length() == 0 ? + getString("_UI_Periodical_type") : //$NON-NLS-1$ + getString("_UI_Periodical_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}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void notifyChanged(Notification notification) + { + updateChildren(notification); + + switch (notification.getFeatureID(Periodical.class)) + { + case EXTLibraryPackage.PERIODICAL__TITLE: + case EXTLibraryPackage.PERIODICAL__ISSUES_PER_YEAR: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) + { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/PersonItemProvider.java b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/PersonItemProvider.java new file mode 100644 index 000000000..9bb8d8a2a --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/PersonItemProvider.java @@ -0,0 +1,226 @@ +/** + * Copyright (c) 2005-2006 IBM Corporation 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: + * IBM - Initial API and implementation + */ +package org.eclipse.emf.examples.extlibrary.provider; + + +import java.util.Collection; +import java.util.List; + +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.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +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.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import org.eclipse.emf.examples.extlibrary.EXTLibraryPackage; +import org.eclipse.emf.examples.extlibrary.Person; + +/** + * This is the item provider adapter for a {@link org.eclipse.emf.examples.extlibrary.Person} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ +public class PersonItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource +{ + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public PersonItemProvider(AdapterFactory adapterFactory) + { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) + { + if (itemPropertyDescriptors == null) + { + super.getPropertyDescriptors(object); + + addAddressPropertyDescriptor(object); + addFirstNamePropertyDescriptor(object); + addLastNamePropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Address feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addAddressPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Addressable_address_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Addressable_address_feature", "_UI_Addressable_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.ADDRESSABLE__ADDRESS, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the First Name feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addFirstNamePropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Person_firstName_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Person_firstName_feature", "_UI_Person_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.PERSON__FIRST_NAME, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Last Name feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addLastNamePropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Person_lastName_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Person_lastName_feature", "_UI_Person_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.PERSON__LAST_NAME, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This returns Person.gif. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object getImage(Object object) + { + return overlayImage(object, getResourceLocator().getImage("full/obj16/Person")); //$NON-NLS-1$ + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String getText(Object object) + { + String label = ((Person)object).getLastName(); + return label == null || label.length() == 0 ? + getString("_UI_Person_type") : //$NON-NLS-1$ + getString("_UI_Person_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}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void notifyChanged(Notification notification) + { + updateChildren(notification); + + switch (notification.getFeatureID(Person.class)) + { + case EXTLibraryPackage.PERSON__ADDRESS: + case EXTLibraryPackage.PERSON__FIRST_NAME: + case EXTLibraryPackage.PERSON__LAST_NAME: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) + { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public ResourceLocator getResourceLocator() + { + return EXTLibraryEditPlugin.INSTANCE; + } + +} diff --git a/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/VideoCassetteItemProvider.java b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/VideoCassetteItemProvider.java new file mode 100644 index 000000000..f58af887f --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/VideoCassetteItemProvider.java @@ -0,0 +1,152 @@ +/** + * Copyright (c) 2005-2006 IBM Corporation 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: + * IBM - Initial API and implementation + */ +package org.eclipse.emf.examples.extlibrary.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +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.ITreeItemContentProvider; + +import org.eclipse.emf.examples.extlibrary.EXTLibraryPackage; +import org.eclipse.emf.examples.extlibrary.VideoCassette; + +/** + * This is the item provider adapter for a {@link org.eclipse.emf.examples.extlibrary.VideoCassette} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ +public class VideoCassetteItemProvider + extends AudioVisualItemItemProvider + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource +{ + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public VideoCassetteItemProvider(AdapterFactory adapterFactory) + { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) + { + if (itemPropertyDescriptors == null) + { + super.getPropertyDescriptors(object); + + addCastPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Cast feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addCastPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_VideoCassette_cast_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_VideoCassette_cast_feature", "_UI_VideoCassette_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.VIDEO_CASSETTE__CAST, + true, + false, + false, + null, + null, + null)); + } + + /** + * This returns VideoCassette.gif. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object getImage(Object object) + { + return overlayImage(object, getResourceLocator().getImage("full/obj16/VideoCassette")); //$NON-NLS-1$ + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String getText(Object object) + { + String label = ((VideoCassette)object).getTitle(); + return label == null || label.length() == 0 ? + getString("_UI_VideoCassette_type") : //$NON-NLS-1$ + getString("_UI_VideoCassette_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}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void notifyChanged(Notification notification) + { + updateChildren(notification); + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) + { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/WriterItemProvider.java b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/WriterItemProvider.java new file mode 100644 index 000000000..1de4e032c --- /dev/null +++ b/examples/org.eclipse.emf.examples.library.edit/src/org/eclipse/emf/examples/extlibrary/provider/WriterItemProvider.java @@ -0,0 +1,185 @@ +/** + * Copyright (c) 2005-2006 IBM Corporation 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: + * IBM - Initial API and implementation + */ +package org.eclipse.emf.examples.extlibrary.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +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.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import org.eclipse.emf.examples.extlibrary.EXTLibraryPackage; +import org.eclipse.emf.examples.extlibrary.Writer; + +/** + * This is the item provider adapter for a {@link org.eclipse.emf.examples.extlibrary.Writer} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ +public class WriterItemProvider + extends PersonItemProvider + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource +{ + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public WriterItemProvider(AdapterFactory adapterFactory) + { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) + { + if (itemPropertyDescriptors == null) + { + super.getPropertyDescriptors(object); + + addNamePropertyDescriptor(object); + addBooksPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Name feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addNamePropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Writer_name_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Writer_name_feature", "_UI_Writer_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.WRITER__NAME, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Books feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addBooksPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Writer_books_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Writer_books_feature", "_UI_Writer_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + EXTLibraryPackage.Literals.WRITER__BOOKS, + true, + false, + false, + null, + null, + null)); + } + + /** + * This returns Writer.gif. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object getImage(Object object) + { + return overlayImage(object, getResourceLocator().getImage("full/obj16/Writer")); //$NON-NLS-1$ + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String getText(Object object) + { + String label = ((Writer)object).getName(); + return label == null || label.length() == 0 ? + getString("_UI_Writer_type") : //$NON-NLS-1$ + getString("_UI_Writer_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}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void notifyChanged(Notification notification) + { + updateChildren(notification); + + switch (notification.getFeatureID(Writer.class)) + { + case EXTLibraryPackage.WRITER__NAME: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) + { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} |