| /******************************************************************************* |
| * 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.GoalieStats; |
| import org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.HockeyleaguePackage; |
| import org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.HockeyleaguePlugin; |
| |
| /** |
| * This is the item provider adapter for a {@link org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.GoalieStats} object. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public class GoalieStatsItemProvider |
| 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 GoalieStatsItemProvider(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); |
| addMinutesPlayedInPropertyDescriptor(object); |
| addGoalsAgainstAveragePropertyDescriptor(object); |
| addWinsPropertyDescriptor(object); |
| addLossesPropertyDescriptor(object); |
| addTiesPropertyDescriptor(object); |
| addEmptyNetGoalsPropertyDescriptor(object); |
| addShutoutsPropertyDescriptor(object); |
| addGoalsAgainstPropertyDescriptor(object); |
| addSavesPropertyDescriptor(object); |
| addPenaltyMinutesPropertyDescriptor(object); |
| addGoalsPropertyDescriptor(object); |
| addAssistsPropertyDescriptor(object); |
| addPointsPropertyDescriptor(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_GoalieStats_year_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_GoalieStats_year_feature", "_UI_GoalieStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.GOALIE_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_GoalieStats_team_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_GoalieStats_team_feature", "_UI_GoalieStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.GOALIE_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_GoalieStats_gamesPlayedIn_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_GoalieStats_gamesPlayedIn_feature", "_UI_GoalieStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.GOALIE_STATS__GAMES_PLAYED_IN, |
| true, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Minutes Played In feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addMinutesPlayedInPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_GoalieStats_minutesPlayedIn_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_GoalieStats_minutesPlayedIn_feature", "_UI_GoalieStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.GOALIE_STATS__MINUTES_PLAYED_IN, |
| true, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Goals Against Average feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addGoalsAgainstAveragePropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_GoalieStats_goalsAgainstAverage_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_GoalieStats_goalsAgainstAverage_feature", "_UI_GoalieStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.GOALIE_STATS__GOALS_AGAINST_AVERAGE, |
| true, |
| ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Wins feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addWinsPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_GoalieStats_wins_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_GoalieStats_wins_feature", "_UI_GoalieStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.GOALIE_STATS__WINS, |
| true, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Losses feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addLossesPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_GoalieStats_losses_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_GoalieStats_losses_feature", "_UI_GoalieStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.GOALIE_STATS__LOSSES, |
| true, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Ties feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addTiesPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_GoalieStats_ties_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_GoalieStats_ties_feature", "_UI_GoalieStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.GOALIE_STATS__TIES, |
| true, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Empty Net Goals feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addEmptyNetGoalsPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_GoalieStats_emptyNetGoals_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_GoalieStats_emptyNetGoals_feature", "_UI_GoalieStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.GOALIE_STATS__EMPTY_NET_GOALS, |
| true, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Shutouts feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addShutoutsPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_GoalieStats_shutouts_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_GoalieStats_shutouts_feature", "_UI_GoalieStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.GOALIE_STATS__SHUTOUTS, |
| true, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Goals Against feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addGoalsAgainstPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_GoalieStats_goalsAgainst_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_GoalieStats_goalsAgainst_feature", "_UI_GoalieStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.GOALIE_STATS__GOALS_AGAINST, |
| true, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Saves feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addSavesPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_GoalieStats_saves_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_GoalieStats_saves_feature", "_UI_GoalieStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.GOALIE_STATS__SAVES, |
| 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_GoalieStats_penaltyMinutes_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_GoalieStats_penaltyMinutes_feature", "_UI_GoalieStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.GOALIE_STATS__PENALTY_MINUTES, |
| 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_GoalieStats_goals_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_GoalieStats_goals_feature", "_UI_GoalieStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.GOALIE_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_GoalieStats_assists_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_GoalieStats_assists_feature", "_UI_GoalieStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.GOALIE_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_GoalieStats_points_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_GoalieStats_points_feature", "_UI_GoalieStats_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| HockeyleaguePackage.Literals.GOALIE_STATS__POINTS, |
| true, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This returns GoalieStats.gif. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Object getImage(Object object) { |
| return getResourceLocator().getImage("full/obj16/GoalieStats"); //$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 = ((GoalieStats)object).getYear(); |
| return label == null || label.length() == 0 ? |
| getString("_UI_GoalieStats_type") : //$NON-NLS-1$ |
| getString("_UI_GoalieStats_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(GoalieStats.class)) { |
| case HockeyleaguePackage.GOALIE_STATS__YEAR: |
| case HockeyleaguePackage.GOALIE_STATS__GAMES_PLAYED_IN: |
| case HockeyleaguePackage.GOALIE_STATS__MINUTES_PLAYED_IN: |
| case HockeyleaguePackage.GOALIE_STATS__GOALS_AGAINST_AVERAGE: |
| case HockeyleaguePackage.GOALIE_STATS__WINS: |
| case HockeyleaguePackage.GOALIE_STATS__LOSSES: |
| case HockeyleaguePackage.GOALIE_STATS__TIES: |
| case HockeyleaguePackage.GOALIE_STATS__EMPTY_NET_GOALS: |
| case HockeyleaguePackage.GOALIE_STATS__SHUTOUTS: |
| case HockeyleaguePackage.GOALIE_STATS__GOALS_AGAINST: |
| case HockeyleaguePackage.GOALIE_STATS__SAVES: |
| case HockeyleaguePackage.GOALIE_STATS__PENALTY_MINUTES: |
| case HockeyleaguePackage.GOALIE_STATS__GOALS: |
| case HockeyleaguePackage.GOALIE_STATS__ASSISTS: |
| case HockeyleaguePackage.GOALIE_STATS__POINTS: |
| 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; |
| } |
| |
| } |