/** * Copyright (c) 2012-2016 Marsha Chechik, Alessio Di Sandro, Michalis Famelis, * Rick Salay. * 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: * Alessio Di Sandro - Implementation. */ package edu.toronto.cs.se.mmint.mid.editor.provider; import edu.toronto.cs.se.mmint.mid.editor.Editor; import edu.toronto.cs.se.mmint.mid.editor.EditorPackage; import edu.toronto.cs.se.mmint.mid.provider.ExtendibleElementItemProvider; import edu.toronto.cs.se.mmint.mid.provider.MIDEditPlugin; 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.IItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ViewerNotification; /** * This is the item provider adapter for a {@link edu.toronto.cs.se.mmint.mid.editor.Editor} object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class EditorItemProvider extends ExtendibleElementItemProvider { /** * This constructs an instance from a factory and a notifier. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EditorItemProvider(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); addModelUriPropertyDescriptor(object); addIdPropertyDescriptor(object); addWizardIdPropertyDescriptor(object); addFileExtensionsPropertyDescriptor(object); addWizardDialogClassPropertyDescriptor(object); } return itemPropertyDescriptors; } /** * This adds a property descriptor for the Model Uri feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addModelUriPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Editor_modelUri_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Editor_modelUri_feature", "_UI_Editor_type"), EditorPackage.Literals.EDITOR__MODEL_URI, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * 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_Editor_id_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Editor_id_feature", "_UI_Editor_type"), EditorPackage.Literals.EDITOR__ID, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Wizard Id feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addWizardIdPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Editor_wizardId_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Editor_wizardId_feature", "_UI_Editor_type"), EditorPackage.Literals.EDITOR__WIZARD_ID, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the File Extensions feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addFileExtensionsPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Editor_fileExtensions_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Editor_fileExtensions_feature", "_UI_Editor_type"), EditorPackage.Literals.EDITOR__FILE_EXTENSIONS, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Wizard Dialog Class feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addWizardDialogClassPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Editor_wizardDialogClass_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Editor_wizardDialogClass_feature", "_UI_Editor_type"), EditorPackage.Literals.EDITOR__WIZARD_DIALOG_CLASS, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This returns Editor.gif. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object getImage(Object object) { return overlayImage(object, getResourceLocator().getImage("full/obj16/Editor")); } /** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getText(Object object) { String label = ((Editor)object).getName(); return label == null || label.length() == 0 ? getString("_UI_Editor_type") : getString("_UI_Editor_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(Editor.class)) { case EditorPackage.EDITOR__MODEL_URI: case EditorPackage.EDITOR__ID: case EditorPackage.EDITOR__WIZARD_ID: case EditorPackage.EDITOR__FILE_EXTENSIONS: case EditorPackage.EDITOR__WIZARD_DIALOG_CLASS: 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 MIDEditPlugin.INSTANCE; } }