/******************************************************************************* * Copyright (c) 2006-2012 * Software Technology Group, Dresden University of Technology * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026 * * 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: * Software Technology Group - TU Dresden, Germany; * DevBoost GmbH - Berlin, Germany * - initial API and implementation ******************************************************************************/ /** * Copyright (c) 2006-2011 * Software Technology Group, Dresden University of Technology * * 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: * Software Technology Group - TU Dresden, Germany * - initial API and implementation */ package org.reuseware.coconut.reuseextension.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.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.ItemProviderAdapter; import org.eclipse.emf.edit.provider.ViewerNotification; import org.reuseware.coconut.reuseextension.ReuseextensionPackage; import org.reuseware.coconut.reuseextension.SyntaxDerivationRule; /** * This is the item provider adapter for a {@link org.reuseware.coconut.reuseextension.SyntaxDerivationRule} object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class SyntaxDerivationRuleItemProvider 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 SyntaxDerivationRuleItemProvider(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); addHeightExpressionPropertyDescriptor(object); addIconExpressionPropertyDescriptor(object); addVisibleExpressionPropertyDescriptor(object); addWidthExpressionPropertyDescriptor(object); } return itemPropertyDescriptors; } /** * This adds a property descriptor for the Height Expression feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addHeightExpressionPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_SyntaxDerivationRule_heightExpression_feature"), getString("_UI_PropertyDescriptor_description", "_UI_SyntaxDerivationRule_heightExpression_feature", "_UI_SyntaxDerivationRule_type"), ReuseextensionPackage.Literals.SYNTAX_DERIVATION_RULE__HEIGHT_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Icon Expression feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addIconExpressionPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_SyntaxDerivationRule_iconExpression_feature"), getString("_UI_PropertyDescriptor_description", "_UI_SyntaxDerivationRule_iconExpression_feature", "_UI_SyntaxDerivationRule_type"), ReuseextensionPackage.Literals.SYNTAX_DERIVATION_RULE__ICON_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Visible Expression feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addVisibleExpressionPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_SyntaxDerivationRule_visibleExpression_feature"), getString("_UI_PropertyDescriptor_description", "_UI_SyntaxDerivationRule_visibleExpression_feature", "_UI_SyntaxDerivationRule_type"), ReuseextensionPackage.Literals.SYNTAX_DERIVATION_RULE__VISIBLE_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Width Expression feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addWidthExpressionPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_SyntaxDerivationRule_widthExpression_feature"), getString("_UI_PropertyDescriptor_description", "_UI_SyntaxDerivationRule_widthExpression_feature", "_UI_SyntaxDerivationRule_type"), ReuseextensionPackage.Literals.SYNTAX_DERIVATION_RULE__WIDTH_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getText(Object object) { String label = ((SyntaxDerivationRule)object).getHeightExpression(); return label == null || label.length() == 0 ? getString("_UI_SyntaxDerivationRule_type") : getString("_UI_SyntaxDerivationRule_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(SyntaxDerivationRule.class)) { case ReuseextensionPackage.SYNTAX_DERIVATION_RULE__HEIGHT_EXPRESSION: case ReuseextensionPackage.SYNTAX_DERIVATION_RULE__ICON_EXPRESSION: case ReuseextensionPackage.SYNTAX_DERIVATION_RULE__VISIBLE_EXPRESSION: case ReuseextensionPackage.SYNTAX_DERIVATION_RULE__WIDTH_EXPRESSION: 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 ReuseextensionEditPlugin.INSTANCE; } }