| /** |
| * Copyright (c) 2013 Ericsson |
| * |
| * 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 |
| * |
| * Description: |
| * |
| * Contributors: |
| * Miles Parker, Tasktop Technologies - Initial API and implementation |
| * |
| */ |
| package org.eclipse.mylyn.reviews.example.emftasks.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.mylyn.reviews.example.emftasks.EmfTasksPackage; |
| import org.eclipse.mylyn.reviews.example.emftasks.SimpleTask; |
| |
| /** |
| * This is the item provider adapter for a {@link org.eclipse.mylyn.reviews.example.emftasks.SimpleTask} object. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public class SimpleTaskItemProvider |
| 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 SimpleTaskItemProvider(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); |
| |
| addIdPropertyDescriptor(object); |
| addSummaryPropertyDescriptor(object); |
| addDescriptionPropertyDescriptor(object); |
| addStatusPropertyDescriptor(object); |
| addPriorityPropertyDescriptor(object); |
| addDueDatePropertyDescriptor(object); |
| addCompletionDatePropertyDescriptor(object); |
| addCreationDatePropertyDescriptor(object); |
| addModificationDatePropertyDescriptor(object); |
| addCollaboratorsPropertyDescriptor(object); |
| addRelatedUrlPropertyDescriptor(object); |
| addRankingPropertyDescriptor(object); |
| addCategoryPropertyDescriptor(object); |
| } |
| return itemPropertyDescriptors; |
| } |
| |
| /** |
| * This adds a property descriptor for the Id feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addIdPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_SimpleTask_id_feature"), |
| getString("_UI_PropertyDescriptor_description", "_UI_SimpleTask_id_feature", "_UI_SimpleTask_type"), |
| EmfTasksPackage.Literals.SIMPLE_TASK__ID, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Summary feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addSummaryPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_SimpleTask_summary_feature"), |
| getString("_UI_PropertyDescriptor_description", "_UI_SimpleTask_summary_feature", "_UI_SimpleTask_type"), |
| EmfTasksPackage.Literals.SIMPLE_TASK__SUMMARY, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Description feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addDescriptionPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_SimpleTask_description_feature"), |
| getString("_UI_PropertyDescriptor_description", "_UI_SimpleTask_description_feature", "_UI_SimpleTask_type"), |
| EmfTasksPackage.Literals.SIMPLE_TASK__DESCRIPTION, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Status feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addStatusPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_SimpleTask_status_feature"), |
| getString("_UI_PropertyDescriptor_description", "_UI_SimpleTask_status_feature", "_UI_SimpleTask_type"), |
| EmfTasksPackage.Literals.SIMPLE_TASK__STATUS, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Priority feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addPriorityPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_SimpleTask_priority_feature"), |
| getString("_UI_PropertyDescriptor_description", "_UI_SimpleTask_priority_feature", "_UI_SimpleTask_type"), |
| EmfTasksPackage.Literals.SIMPLE_TASK__PRIORITY, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Due Date feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addDueDatePropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_SimpleTask_dueDate_feature"), |
| getString("_UI_PropertyDescriptor_description", "_UI_SimpleTask_dueDate_feature", "_UI_SimpleTask_type"), |
| EmfTasksPackage.Literals.SIMPLE_TASK__DUE_DATE, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Completion Date feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addCompletionDatePropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_SimpleTask_completionDate_feature"), |
| getString("_UI_PropertyDescriptor_description", "_UI_SimpleTask_completionDate_feature", "_UI_SimpleTask_type"), |
| EmfTasksPackage.Literals.SIMPLE_TASK__COMPLETION_DATE, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Creation Date feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addCreationDatePropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_SimpleTask_creationDate_feature"), |
| getString("_UI_PropertyDescriptor_description", "_UI_SimpleTask_creationDate_feature", "_UI_SimpleTask_type"), |
| EmfTasksPackage.Literals.SIMPLE_TASK__CREATION_DATE, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Modification Date feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addModificationDatePropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_SimpleTask_modificationDate_feature"), |
| getString("_UI_PropertyDescriptor_description", "_UI_SimpleTask_modificationDate_feature", "_UI_SimpleTask_type"), |
| EmfTasksPackage.Literals.SIMPLE_TASK__MODIFICATION_DATE, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Collaborators feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addCollaboratorsPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_SimpleTask_collaborators_feature"), |
| getString("_UI_PropertyDescriptor_description", "_UI_SimpleTask_collaborators_feature", "_UI_SimpleTask_type"), |
| EmfTasksPackage.Literals.SIMPLE_TASK__COLLABORATORS, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Related Url feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addRelatedUrlPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_SimpleTask_relatedUrl_feature"), |
| getString("_UI_PropertyDescriptor_description", "_UI_SimpleTask_relatedUrl_feature", "_UI_SimpleTask_type"), |
| EmfTasksPackage.Literals.SIMPLE_TASK__RELATED_URL, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Ranking feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addRankingPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_SimpleTask_ranking_feature"), |
| getString("_UI_PropertyDescriptor_description", "_UI_SimpleTask_ranking_feature", "_UI_SimpleTask_type"), |
| EmfTasksPackage.Literals.SIMPLE_TASK__RANKING, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.REAL_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_SimpleTask_category_feature"), |
| getString("_UI_PropertyDescriptor_description", "_UI_SimpleTask_category_feature", "_UI_SimpleTask_type"), |
| EmfTasksPackage.Literals.SIMPLE_TASK__CATEGORY, |
| true, |
| false, |
| true, |
| null, |
| null, |
| null)); |
| } |
| |
| /** |
| * This returns SimpleTask.gif. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object getImage(Object object) { |
| return overlayImage(object, getResourceLocator().getImage("full/obj16/SimpleTask")); |
| } |
| |
| /** |
| * This returns the label text for the adapted class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String getText(Object object) { |
| String label = ((SimpleTask)object).getSummary(); |
| return label == null || label.length() == 0 ? |
| getString("_UI_SimpleTask_type") : |
| getString("_UI_SimpleTask_type") + " " + label; |
| } |
| |
| /** |
| * 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(SimpleTask.class)) { |
| case EmfTasksPackage.SIMPLE_TASK__ID: |
| case EmfTasksPackage.SIMPLE_TASK__SUMMARY: |
| case EmfTasksPackage.SIMPLE_TASK__DESCRIPTION: |
| case EmfTasksPackage.SIMPLE_TASK__STATUS: |
| case EmfTasksPackage.SIMPLE_TASK__PRIORITY: |
| case EmfTasksPackage.SIMPLE_TASK__DUE_DATE: |
| case EmfTasksPackage.SIMPLE_TASK__COMPLETION_DATE: |
| case EmfTasksPackage.SIMPLE_TASK__CREATION_DATE: |
| case EmfTasksPackage.SIMPLE_TASK__MODIFICATION_DATE: |
| case EmfTasksPackage.SIMPLE_TASK__COLLABORATORS: |
| case EmfTasksPackage.SIMPLE_TASK__RELATED_URL: |
| case EmfTasksPackage.SIMPLE_TASK__RANKING: |
| 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 EmfTasksEditPlugin.INSTANCE; |
| } |
| |
| } |