Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
<copyright> Copyright (c) 2002-2007 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 - Initial API and implementation </copyright> $Id: XSDModelGroupItemProvider.java,v 1.7 2007/03/22 02:06:24 davidms Exp $
 
 package org.eclipse.xsd.provider;
 
 
 import java.util.List;
 
 
This is the item provider adpater for a org.eclipse.xsd.XSDModelGroup object.
 
   extends XSDTermItemProvider
   implements 
 {
  
This constructs an instance from a factory and a notifier.
 
   public XSDModelGroupItemProvider(AdapterFactory adapterFactory)
   {
     super(adapterFactory);
   }

  
This returns the property descriptors for the adapted class.
 
   @Override
   {
     if ( == null)
     {
       super.getPropertyDescriptors(object);
 
       // This is for the compositor feature.
       //
         (new ItemPropertyDescriptor
            ..getString("_UI_Compositor_label"),
            ..getString("_UI_Compositor_description"),
            .getXSDModelGroup_Compositor(),
            true,
            .));
 
       // This is for the annotation feature.
       //
         (new ItemPropertyDescriptor
            ..getString("_UI_Annotation_label"),
            ..getString("_UI_AnnotationOfModelGroup_description"),
            .getXSDModelGroup_Annotation(), 
            false));
 
     }
     return ;
   }

  
  public Collection<? extends EStructuralFeaturegetChildrenFeatures(Object object)
  {
    if ( == null)
    {
      super.getChildrenFeatures(object);
    }
    return ;
  }

  
This returns XSDModelGroup.gif.
  public Object getImage(Object object)
  {
    XSDModelGroup xsdModelGroup = ((XSDModelGroup)object);
    if (. == xsdModelGroup.getCompositor())
    {
      return ..getImage("full/obj16/XSDModelGroupChoice");
    }
    else if (. == xsdModelGroup.getCompositor())
    {
      return ..getImage("full/obj16/XSDModelGroupAll");
    }
    else 
    {
      return ..getImage("full/obj16/XSDModelGroupSequence");
    }
  }
  public String getText(Object object)
  {
    XSDModelGroup xsdModelGroup = ((XSDModelGroup)object);
    return xsdModelGroup.getCompositor().getName();
  }

  
This handles notification by calling fireNotifyChanged.
  public void notifyChanged(Notification msg
  {
    XSDModelGroup xsdModelGroup = (XSDModelGroup)msg.getNotifier();
    if (msg.getFeature() == .getXSDModelGroup_Compositor() || 
          msg.getFeature() == .getXSDModelGroup_Contents() || 
          msg.getFeature() == .getXSDModelGroup_Annotation())
    {
      fireNotifyChanged(msg);
      XSDConcreteComponent container = xsdModelGroup.getContainer();
      if (container instanceof XSDParticle)
      {
          (new ENotificationImpl
            ((InternalEObject)container
             msg.getEventType(), 
             (EStructuralFeature)msg.getFeature(), 
             msg.getOldValue(), 
             msg.getNewValue(), 
             msg.getPosition()));
      }
      return;
    }
    super.notifyChanged(msg);
  }

  
This adds org.eclipse.emf.edit.command.CommandParameters describing the children that can be created under this object.
  protected void collectNewChildDescriptors(Collection<ObjectnewChildDescriptorsObject object)
  {
    super.collectNewChildDescriptors(newChildDescriptorsobject);
    XSDModelGroup mg = (XSDModelGroupobject;
    // annotation
    // element declaration under particle
    newChildDescriptors.add(createChildParameter(.getXSDModelGroup_Contents(), createParticle(edfalse)));
    // element declaration reference under particle
    // for choice and sequence model groups only...
    {
      // choice and sequence model groups under particles
      addModelGroupChildParameters(newChildDescriptors.getXSDModelGroup_Contents(), falsetrue);
      // model group definition reference under particle
      // element wildcard under particle
    }
  }
New to GrepCode? Check out our FAQ X