blob: e40d66a0063081722baedc9a59978c195888b1a2 [file] [log] [blame]
/**
* Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Florian Pirchner - Initial implementation
*/
package org.eclipse.osbp.ecview.semantic.uisemantics.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.ecore.EStructuralFeature;
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.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.osbp.ecview.semantic.uisemantics.UiSemanticsFactory;
import org.eclipse.osbp.ecview.semantic.uisemantics.UiSemanticsPackage;
import org.eclipse.osbp.ecview.semantic.uisemantics.UxImportSectionDeclaration;
import org.eclipse.osbp.ecview.uisemantics.provider.uisemanticsEditPlugin;
import org.eclipse.xtext.xtype.XtypePackage;
/**
* This is the item provider adapter for a {@link org.eclipse.osbp.ecview.semantic.uisemantics.UxImportSectionDeclaration} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class UxImportSectionDeclarationItemProvider extends ItemProviderAdapter {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public UxImportSectionDeclarationItemProvider(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);
addWildcardPropertyDescriptor(object);
addExtensionPropertyDescriptor(object);
addStaticPropertyDescriptor(object);
addImportedTypePropertyDescriptor(object);
addMemberNamePropertyDescriptor(object);
addImportedNamespacePropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
* This adds a property descriptor for the Wildcard feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addWildcardPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_XImportDeclaration_wildcard_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_XImportDeclaration_wildcard_feature", "_UI_XImportDeclaration_type"),
XtypePackage.Literals.XIMPORT_DECLARATION__WILDCARD,
true,
false,
false,
ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Extension feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addExtensionPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_XImportDeclaration_extension_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_XImportDeclaration_extension_feature", "_UI_XImportDeclaration_type"),
XtypePackage.Literals.XIMPORT_DECLARATION__EXTENSION,
true,
false,
false,
ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Static feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addStaticPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_XImportDeclaration_static_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_XImportDeclaration_static_feature", "_UI_XImportDeclaration_type"),
XtypePackage.Literals.XIMPORT_DECLARATION__STATIC,
true,
false,
false,
ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Imported Type feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addImportedTypePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_XImportDeclaration_importedType_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_XImportDeclaration_importedType_feature", "_UI_XImportDeclaration_type"),
XtypePackage.Literals.XIMPORT_DECLARATION__IMPORTED_TYPE,
true,
false,
true,
null,
null,
null));
}
/**
* This adds a property descriptor for the Member Name feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addMemberNamePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_XImportDeclaration_memberName_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_XImportDeclaration_memberName_feature", "_UI_XImportDeclaration_type"),
XtypePackage.Literals.XIMPORT_DECLARATION__MEMBER_NAME,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Imported Namespace feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addImportedNamespacePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_XImportDeclaration_importedNamespace_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_XImportDeclaration_importedNamespace_feature", "_UI_XImportDeclaration_type"),
XtypePackage.Literals.XIMPORT_DECLARATION__IMPORTED_NAMESPACE,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
if (childrenFeatures == null) {
super.getChildrenFeatures(object);
childrenFeatures.add(UiSemanticsPackage.Literals.UX_IMPORT_SECTION_DECLARATION__IMPORTED_EPACKAGE);
}
return childrenFeatures;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EStructuralFeature getChildFeature(Object object, Object child) {
// Check the type of the specified child object and return the proper feature to use for
// adding (see {@link AddCommand}) it as a child.
return super.getChildFeature(object, child);
}
/**
* This returns UxImportSectionDeclaration.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/UxImportSectionDeclaration"));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected boolean shouldComposeCreationImage() {
return true;
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
String label = ((UxImportSectionDeclaration)object).getMemberName();
return label == null || label.length() == 0 ?
getString("_UI_UxImportSectionDeclaration_type") :
getString("_UI_UxImportSectionDeclaration_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(UxImportSectionDeclaration.class)) {
case UiSemanticsPackage.UX_IMPORT_SECTION_DECLARATION__WILDCARD:
case UiSemanticsPackage.UX_IMPORT_SECTION_DECLARATION__EXTENSION:
case UiSemanticsPackage.UX_IMPORT_SECTION_DECLARATION__STATIC:
case UiSemanticsPackage.UX_IMPORT_SECTION_DECLARATION__MEMBER_NAME:
case UiSemanticsPackage.UX_IMPORT_SECTION_DECLARATION__IMPORTED_NAMESPACE:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
case UiSemanticsPackage.UX_IMPORT_SECTION_DECLARATION__IMPORTED_EPACKAGE:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
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);
newChildDescriptors.add
(createChildParameter
(UiSemanticsPackage.Literals.UX_IMPORT_SECTION_DECLARATION__IMPORTED_EPACKAGE,
UiSemanticsFactory.eINSTANCE.createUxEPackageImport()));
}
/**
* Return the resource locator for this item provider's resources.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ResourceLocator getResourceLocator() {
return uisemanticsEditPlugin.INSTANCE;
}
}