| package org.eclipse.stem.core.sequencer.provider; |
| |
| /******************************************************************************* |
| * Copyright (c) 2006, 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 Corporation - initial API and implementation |
| *******************************************************************************/ |
| |
| |
| 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.common.util.URI; |
| 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.stem.core.common.provider.CoreEditPlugin; |
| import org.eclipse.stem.core.common.provider.IdentifiableItemProvider; |
| import org.eclipse.stem.core.sequencer.Sequencer; |
| import org.eclipse.stem.core.sequencer.SequencerPackage; |
| |
| /** |
| * This is the item provider adapter for a {@link org.eclipse.stem.core.sequencer.Sequencer} object. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public class SequencerItemProvider |
| extends IdentifiableItemProvider |
| implements |
| IEditingDomainItemProvider, |
| IStructuredItemContentProvider, |
| ITreeItemContentProvider, |
| IItemLabelProvider, |
| IItemPropertySource { |
| /** |
| * This constructs an instance from a factory and a notifier. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public SequencerItemProvider(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); |
| |
| addStartTimePropertyDescriptor(object); |
| addEndTimePropertyDescriptor(object); |
| addCurrentTimePropertyDescriptor(object); |
| addNextTimePropertyDescriptor(object); |
| addTimeDeltaPropertyDescriptor(object); |
| addDurationPropertyDescriptor(object); |
| addTimeToStopPropertyDescriptor(object); |
| addWorkCompletePropertyDescriptor(object); |
| addWorkIncrementPropertyDescriptor(object); |
| addCyclePropertyDescriptor(object); |
| } |
| return itemPropertyDescriptors; |
| } |
| |
| /** |
| * This adds a property descriptor for the Start Time feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addStartTimePropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_Sequencer_startTime_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_Sequencer_startTime_feature", "_UI_Sequencer_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| SequencerPackage.Literals.SEQUENCER__START_TIME, |
| true, |
| false, |
| false, |
| null, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the End Time feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addEndTimePropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_Sequencer_endTime_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_Sequencer_endTime_feature", "_UI_Sequencer_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| SequencerPackage.Literals.SEQUENCER__END_TIME, |
| true, |
| false, |
| false, |
| null, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Current Time feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addCurrentTimePropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_Sequencer_currentTime_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_Sequencer_currentTime_feature", "_UI_Sequencer_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| SequencerPackage.Literals.SEQUENCER__CURRENT_TIME, |
| false, |
| false, |
| false, |
| null, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Next Time feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addNextTimePropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_Sequencer_nextTime_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_Sequencer_nextTime_feature", "_UI_Sequencer_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| SequencerPackage.Literals.SEQUENCER__NEXT_TIME, |
| false, |
| false, |
| false, |
| null, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Time Delta feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addTimeDeltaPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_Sequencer_timeDelta_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_Sequencer_timeDelta_feature", "_UI_Sequencer_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| SequencerPackage.Literals.SEQUENCER__TIME_DELTA, |
| false, |
| false, |
| false, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Duration feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addDurationPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_Sequencer_duration_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_Sequencer_duration_feature", "_UI_Sequencer_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| SequencerPackage.Literals.SEQUENCER__DURATION, |
| false, |
| false, |
| false, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Time To Stop feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addTimeToStopPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_Sequencer_timeToStop_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_Sequencer_timeToStop_feature", "_UI_Sequencer_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| SequencerPackage.Literals.SEQUENCER__TIME_TO_STOP, |
| false, |
| false, |
| false, |
| ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Work Complete feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addWorkCompletePropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_Sequencer_workComplete_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_Sequencer_workComplete_feature", "_UI_Sequencer_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| SequencerPackage.Literals.SEQUENCER__WORK_COMPLETE, |
| false, |
| false, |
| false, |
| ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Work Increment feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addWorkIncrementPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_Sequencer_workIncrement_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_Sequencer_workIncrement_feature", "_UI_Sequencer_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| SequencerPackage.Literals.SEQUENCER__WORK_INCREMENT, |
| false, |
| false, |
| false, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Cycle feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addCyclePropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_Sequencer_cycle_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_Sequencer_cycle_feature", "_UI_Sequencer_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| SequencerPackage.Literals.SEQUENCER__CYCLE, |
| false, |
| false, |
| false, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This returns the label text for the adapted class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated NOT |
| */ |
| @Override |
| public String getText(Object object) { |
| return super.getText(object); |
| } |
| |
| /** |
| * This returns the label text for the adapted class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String getTextGen(Object object) { |
| URI labelValue = ((Sequencer)object).getURI(); |
| String label = labelValue == null ? null : labelValue.toString(); |
| return label == null || label.length() == 0 ? |
| getString("_UI_Sequencer_type") : //$NON-NLS-1$ |
| getString("_UI_Sequencer_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ |
| } |
| |
| /** |
| * This returns Sequencer.gif. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated NOT |
| */ |
| @Override |
| public Object getImage(Object object) { |
| return overlayImage(object, getResourceLocator().getImage("full/customobj16/Sequencer")); |
| } |
| |
| /** |
| * 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(Sequencer.class)) { |
| case SequencerPackage.SEQUENCER__START_TIME: |
| case SequencerPackage.SEQUENCER__END_TIME: |
| case SequencerPackage.SEQUENCER__CURRENT_TIME: |
| case SequencerPackage.SEQUENCER__TIME_DELTA: |
| case SequencerPackage.SEQUENCER__DURATION: |
| case SequencerPackage.SEQUENCER__TIME_TO_STOP: |
| case SequencerPackage.SEQUENCER__WORK_COMPLETE: |
| case SequencerPackage.SEQUENCER__WORK_INCREMENT: |
| case SequencerPackage.SEQUENCER__CYCLE: |
| 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 CoreEditPlugin.INSTANCE; |
| } |
| |
| } |