blob: 1d385e1a94eb4ec8a48ae706424b46d526c05607 [file] [log] [blame]
/**
* Copyright (c) 2008-2011 Chair for Applied Software Engineering,
* Technische Universitaet Muenchen.
* 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:
*/
package org.eclipse.emf.emfstore.bowling.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.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.emfstore.bowling.BowlingPackage;
import org.eclipse.emf.emfstore.bowling.Player;
/**
* This is the item provider adapter for a {@link org.eclipse.emf.emfstore.bowling.Player} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public class PlayerItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider,
ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public PlayerItemProvider(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);
addDateOfBirthPropertyDescriptor(object);
addHeightPropertyDescriptor(object);
addIsProfessionalPropertyDescriptor(object);
addEMailsPropertyDescriptor(object);
addNumberOfVictoriesPropertyDescriptor(object);
addPlayedTournamentTypesPropertyDescriptor(object);
addWinLossRatioPropertyDescriptor(object);
addGenderPropertyDescriptor(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_Player_name_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_Player_name_feature", "_UI_Player_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
BowlingPackage.Literals.PLAYER__NAME,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Date Of Birth feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected void addDateOfBirthPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Player_dateOfBirth_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_Player_dateOfBirth_feature", "_UI_Player_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
BowlingPackage.Literals.PLAYER__DATE_OF_BIRTH,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Height feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected void addHeightPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Player_height_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_Player_height_feature", "_UI_Player_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
BowlingPackage.Literals.PLAYER__HEIGHT,
true,
false,
false,
ItemPropertyDescriptor.REAL_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Is Professional feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected void addIsProfessionalPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Player_isProfessional_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_Player_isProfessional_feature", "_UI_Player_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
BowlingPackage.Literals.PLAYER__IS_PROFESSIONAL,
true,
false,
false,
ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the EMails feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected void addEMailsPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Player_eMails_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_Player_eMails_feature", "_UI_Player_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
BowlingPackage.Literals.PLAYER__EMAILS,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Number Of Victories feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected void addNumberOfVictoriesPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Player_numberOfVictories_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_Player_numberOfVictories_feature", //$NON-NLS-1$ //$NON-NLS-2$
"_UI_Player_type"), //$NON-NLS-1$
BowlingPackage.Literals.PLAYER__NUMBER_OF_VICTORIES,
true,
false,
false,
ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Played Tournament Types feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected void addPlayedTournamentTypesPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Player_playedTournamentTypes_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_Player_playedTournamentTypes_feature", //$NON-NLS-1$ //$NON-NLS-2$
"_UI_Player_type"), //$NON-NLS-1$
BowlingPackage.Literals.PLAYER__PLAYED_TOURNAMENT_TYPES,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Win Loss Ratio feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected void addWinLossRatioPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Player_winLossRatio_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_Player_winLossRatio_feature", "_UI_Player_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
BowlingPackage.Literals.PLAYER__WIN_LOSS_RATIO,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Gender feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected void addGenderPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Player_gender_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_Player_gender_feature", "_UI_Player_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
BowlingPackage.Literals.PLAYER__GENDER,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This returns Player.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/Player")); //$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) {
final String label = ((Player) object).getName();
return label == null || label.length() == 0 ? getString("_UI_Player_type") : //$NON-NLS-1$
getString("_UI_Player_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(Player.class)) {
case BowlingPackage.PLAYER__NAME:
case BowlingPackage.PLAYER__DATE_OF_BIRTH:
case BowlingPackage.PLAYER__HEIGHT:
case BowlingPackage.PLAYER__IS_PROFESSIONAL:
case BowlingPackage.PLAYER__EMAILS:
case BowlingPackage.PLAYER__NUMBER_OF_VICTORIES:
case BowlingPackage.PLAYER__PLAYED_TOURNAMENT_TYPES:
case BowlingPackage.PLAYER__WIN_LOSS_RATIO:
case BowlingPackage.PLAYER__GENDER:
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 BowlingEditPlugin.INSTANCE;
}
}