| /******************************************************************************* |
| * Copyright (c) 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 Corporation - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.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.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.ui.examples.views.properties.tabbed.hockeyleague.HockeyleaguePackage; |
| import org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.HockeyleaguePlugin; |
| import org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.PlayerStats; |
| |
| /** |
| * This is the item provider adapter for a {@link org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.PlayerStats} object. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public class PlayerStatsItemProvider |
| 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 PlayerStatsItemProvider(AdapterFactory adapterFactory) { |
| super(adapterFactory); |
| } |
| |
| /** |
| * This returns the property descriptors for the adapted class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public List getPropertyDescriptors(Object object) { |
| if (itemPropertyDescriptors == null) { |
| super.getPropertyDescriptors(object); |
| |
| addYearPropertyDescriptor(object); |
| addTeamPropertyDescriptor(object); |
| addGamesPlayedInPropertyDescriptor(object); |
| addGoalsPropertyDescriptor(object); |
| addAssistsPropertyDescriptor(object); |
| addPointsPropertyDescriptor(object); |
| addPlusMinusPropertyDescriptor(object); |
| addPenaltyMinutesPropertyDescriptor(object); |
| addPowerPlayGoalsPropertyDescriptor(object); |
| addShortHandedGoalsPropertyDescriptor(object); |
| addGameWinningGoalsPropertyDescriptor(object); |
| addShotsPropertyDescriptor(object); |
| addShotPercentagePropertyDescriptor(object); |
| } |
| return itemPropertyDescriptors; |
| } |
| |
| /** |
| * This adds a property descriptor for the Year feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addYearPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_PlayerStats_year_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_PlayerStats_year_feature", "_UI_PlayerStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.PLAYER_STATS__YEAR, |
| true, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Team feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addTeamPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_PlayerStats_team_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_PlayerStats_team_feature", "_UI_PlayerStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.PLAYER_STATS__TEAM, |
| true, |
| null, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Games Played In feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addGamesPlayedInPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_PlayerStats_gamesPlayedIn_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_PlayerStats_gamesPlayedIn_feature", "_UI_PlayerStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.PLAYER_STATS__GAMES_PLAYED_IN, |
| true, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Goals feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addGoalsPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_PlayerStats_goals_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_PlayerStats_goals_feature", "_UI_PlayerStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.PLAYER_STATS__GOALS, |
| true, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Assists feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addAssistsPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_PlayerStats_assists_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_PlayerStats_assists_feature", "_UI_PlayerStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.PLAYER_STATS__ASSISTS, |
| true, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Points feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addPointsPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_PlayerStats_points_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_PlayerStats_points_feature", "_UI_PlayerStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.PLAYER_STATS__POINTS, |
| true, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Plus Minus feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addPlusMinusPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_PlayerStats_plusMinus_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_PlayerStats_plusMinus_feature", "_UI_PlayerStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.PLAYER_STATS__PLUS_MINUS, |
| true, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Penalty Minutes feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addPenaltyMinutesPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_PlayerStats_penaltyMinutes_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_PlayerStats_penaltyMinutes_feature", "_UI_PlayerStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.PLAYER_STATS__PENALTY_MINUTES, |
| true, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Power Play Goals feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addPowerPlayGoalsPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_PlayerStats_powerPlayGoals_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_PlayerStats_powerPlayGoals_feature", "_UI_PlayerStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.PLAYER_STATS__POWER_PLAY_GOALS, |
| true, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Short Handed Goals feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addShortHandedGoalsPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_PlayerStats_shortHandedGoals_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_PlayerStats_shortHandedGoals_feature", "_UI_PlayerStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.PLAYER_STATS__SHORT_HANDED_GOALS, |
| true, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Game Winning Goals feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addGameWinningGoalsPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_PlayerStats_gameWinningGoals_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_PlayerStats_gameWinningGoals_feature", "_UI_PlayerStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.PLAYER_STATS__GAME_WINNING_GOALS, |
| true, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Shots feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addShotsPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_PlayerStats_shots_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_PlayerStats_shots_feature", "_UI_PlayerStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.PLAYER_STATS__SHOTS, |
| true, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Shot Percentage feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addShotPercentagePropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_PlayerStats_shotPercentage_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_PlayerStats_shotPercentage_feature", "_UI_PlayerStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.PLAYER_STATS__SHOT_PERCENTAGE, |
| true, |
| ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This returns PlayerStats.gif. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Object getImage(Object object) { |
| return getResourceLocator().getImage("full/obj16/PlayerStats"); //$NON-NLS-1$ |
| } |
| |
| /** |
| * This returns the label text for the adapted class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getText(Object object) { |
| String label = ((PlayerStats)object).getYear(); |
| return label == null || label.length() == 0 ? |
| getString("_UI_PlayerStats_type") : //$NON-NLS-1$ |
| getString("_UI_PlayerStats_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 |
| */ |
| public void notifyChanged(Notification notification) { |
| updateChildren(notification); |
| |
| switch (notification.getFeatureID(PlayerStats.class)) { |
| case HockeyleaguePackage.PLAYER_STATS__YEAR: |
| case HockeyleaguePackage.PLAYER_STATS__GAMES_PLAYED_IN: |
| case HockeyleaguePackage.PLAYER_STATS__GOALS: |
| case HockeyleaguePackage.PLAYER_STATS__ASSISTS: |
| case HockeyleaguePackage.PLAYER_STATS__POINTS: |
| case HockeyleaguePackage.PLAYER_STATS__PLUS_MINUS: |
| case HockeyleaguePackage.PLAYER_STATS__PENALTY_MINUTES: |
| case HockeyleaguePackage.PLAYER_STATS__POWER_PLAY_GOALS: |
| case HockeyleaguePackage.PLAYER_STATS__SHORT_HANDED_GOALS: |
| case HockeyleaguePackage.PLAYER_STATS__GAME_WINNING_GOALS: |
| case HockeyleaguePackage.PLAYER_STATS__SHOTS: |
| case HockeyleaguePackage.PLAYER_STATS__SHOT_PERCENTAGE: |
| fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
| return; |
| } |
| super.notifyChanged(notification); |
| } |
| |
| /** |
| * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s |
| * describing all of the children that can be created under this object. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { |
| super.collectNewChildDescriptors(newChildDescriptors, object); |
| } |
| |
| /** |
| * Return the resource locator for this item provider's resources. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ResourceLocator getResourceLocator() { |
| return HockeyleaguePlugin.INSTANCE; |
| } |
| |
| } |