/** * <copyright> * </copyright> * * $Id$ */ package org.openscada.vi.model.VisualInterface.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.openscada.vi.model.VisualInterface.Text; import org.openscada.vi.model.VisualInterface.VisualInterfacePackage; /** * This is the item provider adapter for a {@link org.openscada.vi.model.VisualInterface.Text} object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class TextItemProvider extends FigureItemProvider implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { /** * This constructs an instance from a factory and a notifier. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TextItemProvider(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); addTextPropertyDescriptor(object); addLabelAlignmentPropertyDescriptor(object); addIconAlignmentPropertyDescriptor(object); addTextAlignmentPropertyDescriptor(object); addTextPlacementPropertyDescriptor(object); addFontNamePropertyDescriptor(object); addFontSizePropertyDescriptor(object); addFontBoldPropertyDescriptor(object); addFontItalicPropertyDescriptor(object); } return itemPropertyDescriptors; } /** * This adds a property descriptor for the Text feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addTextPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Text_text_feature"), //$NON-NLS-1$ getString("_UI_PropertyDescriptor_description", "_UI_Text_text_feature", "_UI_Text_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ VisualInterfacePackage.Literals.TEXT__TEXT, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, getString("_UI_textPropertyCategory"), //$NON-NLS-1$ null)); } /** * This adds a property descriptor for the Label Alignment feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addLabelAlignmentPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Text_labelAlignment_feature"), //$NON-NLS-1$ getString("_UI_PropertyDescriptor_description", "_UI_Text_labelAlignment_feature", "_UI_Text_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ VisualInterfacePackage.Literals.TEXT__LABEL_ALIGNMENT, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, getString("_UI_textPropertyCategory"), //$NON-NLS-1$ null)); } /** * This adds a property descriptor for the Text Alignment feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addTextAlignmentPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Text_textAlignment_feature"), //$NON-NLS-1$ getString("_UI_PropertyDescriptor_description", "_UI_Text_textAlignment_feature", "_UI_Text_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ VisualInterfacePackage.Literals.TEXT__TEXT_ALIGNMENT, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, getString("_UI_textPropertyCategory"), //$NON-NLS-1$ null)); } /** * This adds a property descriptor for the Text Placement feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addTextPlacementPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Text_textPlacement_feature"), //$NON-NLS-1$ getString("_UI_PropertyDescriptor_description", "_UI_Text_textPlacement_feature", "_UI_Text_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ VisualInterfacePackage.Literals.TEXT__TEXT_PLACEMENT, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, getString("_UI_textPropertyCategory"), //$NON-NLS-1$ null)); } /** * This adds a property descriptor for the Font Name feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addFontNamePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Text_fontName_feature"), //$NON-NLS-1$ getString("_UI_PropertyDescriptor_description", "_UI_Text_fontName_feature", "_UI_Text_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ VisualInterfacePackage.Literals.TEXT__FONT_NAME, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, getString("_UI_fontPropertyCategory"), //$NON-NLS-1$ null)); } /** * This adds a property descriptor for the Font Size feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addFontSizePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Text_fontSize_feature"), //$NON-NLS-1$ getString("_UI_PropertyDescriptor_description", "_UI_Text_fontSize_feature", "_UI_Text_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ VisualInterfacePackage.Literals.TEXT__FONT_SIZE, true, false, false, ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, getString("_UI_fontPropertyCategory"), //$NON-NLS-1$ null)); } /** * This adds a property descriptor for the Font Bold feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addFontBoldPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Text_fontBold_feature"), //$NON-NLS-1$ getString("_UI_PropertyDescriptor_description", "_UI_Text_fontBold_feature", "_UI_Text_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ VisualInterfacePackage.Literals.TEXT__FONT_BOLD, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, getString("_UI_fontPropertyCategory"), //$NON-NLS-1$ null)); } /** * This adds a property descriptor for the Font Italic feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addFontItalicPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Text_fontItalic_feature"), //$NON-NLS-1$ getString("_UI_PropertyDescriptor_description", "_UI_Text_fontItalic_feature", "_UI_Text_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ VisualInterfacePackage.Literals.TEXT__FONT_ITALIC, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, getString("_UI_fontPropertyCategory"), //$NON-NLS-1$ null)); } /** * This adds a property descriptor for the Icon Alignment feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addIconAlignmentPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Text_iconAlignment_feature"), //$NON-NLS-1$ getString("_UI_PropertyDescriptor_description", "_UI_Text_iconAlignment_feature", "_UI_Text_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ VisualInterfacePackage.Literals.TEXT__ICON_ALIGNMENT, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, getString("_UI_textPropertyCategory"), //$NON-NLS-1$ null)); } /** * This returns Text.gif. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object getImage(Object object) { return overlayImage(object, getResourceLocator().getImage("full/obj16/Text")); //$NON-NLS-1$ } /** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getText(Object object) { String label = ((Text)object).getText(); return label == null || label.length() == 0 ? getString("_UI_Text_type") : //$NON-NLS-1$ getString("_UI_Text_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 */ @Override public void notifyChanged(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(Text.class)) { case VisualInterfacePackage.TEXT__TEXT: case VisualInterfacePackage.TEXT__LABEL_ALIGNMENT: case VisualInterfacePackage.TEXT__ICON_ALIGNMENT: case VisualInterfacePackage.TEXT__TEXT_ALIGNMENT: case VisualInterfacePackage.TEXT__TEXT_PLACEMENT: case VisualInterfacePackage.TEXT__FONT_NAME: case VisualInterfacePackage.TEXT__FONT_SIZE: case VisualInterfacePackage.TEXT__FONT_BOLD: case VisualInterfacePackage.TEXT__FONT_ITALIC: 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); } }