org.eclipse.emf.edit_2.7.2.v20120130-0943

16:43:37.749 INFO  jd.cli.Main - Decompiling org.eclipse.emf.edit_2.7.2.v20120130-0943.jar
package org.eclipse.emf.edit;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory.Descriptor;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory.Descriptor.Registry;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory.Descriptor.Registry.Impl;

class EMFEditPlugin$1
  extends ComposedAdapterFactory.Descriptor.Registry.Impl
{
  private static final long serialVersionUID = 1L;
  
  EMFEditPlugin$1(ComposedAdapterFactory.Descriptor.Registry $anonymous0)
  {
    super($anonymous0);
  }
  
  public ComposedAdapterFactory.Descriptor delegatedGetDescriptor(Collection<?> types)
  {
    List<Object> stringTypes = new ArrayList(types.size());
    for (Object key : types) {
      if ((key instanceof EPackage)) {
        stringTypes.add(((EPackage)key).getNsURI());
      } else if ((key instanceof Package)) {
        stringTypes.add(((Package)key).getName());
      } else if ((key instanceof Class)) {
        stringTypes.add(((Class)key).getName());
      } else {
        return null;
      }
    }
    ComposedAdapterFactory.Descriptor descriptor = (ComposedAdapterFactory.Descriptor)get(stringTypes);
    if (descriptor != null)
    {
      put(types, descriptor);
      return descriptor;
    }
    return super.delegatedGetDescriptor(types);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.EMFEditPlugin.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.edit;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.ecore.plugin.RegistryReader.PluginClassDescriptor;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory.Descriptor;

class EMFEditPlugin$2$1PluginAdapterFactoryDescriptor
  extends RegistryReader.PluginClassDescriptor
  implements ComposedAdapterFactory.Descriptor
{
  public EMFEditPlugin$2$1PluginAdapterFactoryDescriptor(EMFEditPlugin.2 param2, IConfigurationElement element, String attributeName)
  {
    super(element, attributeName);
  }
  
  public AdapterFactory createAdapterFactory()
  {
    return (AdapterFactory)createInstance();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.EMFEditPlugin.2.1PluginAdapterFactoryDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.edit;

import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.ecore.plugin.RegistryReader;
import org.eclipse.emf.ecore.plugin.RegistryReader.PluginClassDescriptor;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory.Descriptor;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory.Descriptor.Registry.Impl;

class EMFEditPlugin$2
  extends RegistryReader
{
  EMFEditPlugin$2(IExtensionRegistry $anonymous0, String $anonymous1, String $anonymous2)
  {
    super($anonymous0, $anonymous1, $anonymous2);
  }
  
  protected boolean readElement(IConfigurationElement element, boolean add)
  {
    if (element.getName().equals("factory"))
    {
      String packageURI = element.getAttribute("uri");
      String className = element.getAttribute("class");
      String supportedTypes = element.getAttribute("supportedTypes");
      if (packageURI == null) {
        logMissingAttribute(element, "uri");
      } else if (className == null) {
        logMissingAttribute(element, "class");
      } else if (supportedTypes == null) {
        logMissingAttribute(element, "supportedTypes");
      }
      for (StringTokenizer stringTokenizer = new StringTokenizer(supportedTypes); stringTokenizer.hasMoreTokens();)
      {
        String supportedType = stringTokenizer.nextToken();
        List<Object> key = new ArrayList();
        key.add(packageURI);
        key.add(supportedType);
        if (add) {
          EMFEditPlugin.access$1().put(key, new RegistryReader.PluginClassDescriptor(element, "class")
          {
            public AdapterFactory createAdapterFactory()
            {
              return (AdapterFactory)createInstance();
            }
          });
        } else {
          EMFEditPlugin.access$1().remove(key);
        }
      }
      return true;
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.EMFEditPlugin.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.edit;

import java.util.Collection;
import org.eclipse.emf.edit.provider.IChildCreationExtender.Descriptor;
import org.eclipse.emf.edit.provider.IChildCreationExtender.Descriptor.Registry;
import org.eclipse.emf.edit.provider.IChildCreationExtender.Descriptor.Registry.Impl;

class EMFEditPlugin$3
  extends IChildCreationExtender.Descriptor.Registry.Impl
{
  private static final long serialVersionUID = 1L;
  
  EMFEditPlugin$3(IChildCreationExtender.Descriptor.Registry $anonymous0)
  {
    super($anonymous0);
  }
  
  public Collection<IChildCreationExtender.Descriptor> delegatedGetDescriptors(String namespace)
  {
    Collection<IChildCreationExtender.Descriptor> descriptors = (Collection)get(namespace);
    return descriptors != null ? descriptors : super.delegatedGetDescriptors(namespace);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.EMFEditPlugin.3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.edit;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IContributor;
import org.eclipse.emf.ecore.plugin.RegistryReader.PluginClassDescriptor;
import org.eclipse.emf.edit.provider.IChildCreationExtender;
import org.eclipse.emf.edit.provider.IChildCreationExtender.Descriptor;

class EMFEditPlugin$4$1PluginChildCreationExtenderDescriptor
  extends RegistryReader.PluginClassDescriptor
  implements IChildCreationExtender.Descriptor
{
  protected String contributor;
  
  public EMFEditPlugin$4$1PluginChildCreationExtenderDescriptor(EMFEditPlugin.4 param4, IConfigurationElement element, String attributeName)
  {
    super(element, attributeName);
    contributor = element.getContributor().getName();
  }
  
  public IChildCreationExtender createChildCreationExtender()
  {
    return (IChildCreationExtender)createInstance();
  }
  
  public boolean matches(IConfigurationElement element)
  {
    return element.getContributor().getName().equals(contributor);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.EMFEditPlugin.4.1PluginChildCreationExtenderDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.edit;

import java.util.ArrayList;
import java.util.Collection;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IContributor;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.emf.ecore.plugin.RegistryReader;
import org.eclipse.emf.ecore.plugin.RegistryReader.PluginClassDescriptor;
import org.eclipse.emf.edit.provider.IChildCreationExtender;
import org.eclipse.emf.edit.provider.IChildCreationExtender.Descriptor;
import org.eclipse.emf.edit.provider.IChildCreationExtender.Descriptor.Registry.Impl;

class EMFEditPlugin$4
  extends RegistryReader
{
  EMFEditPlugin$4(IExtensionRegistry $anonymous0, String $anonymous1, String $anonymous2)
  {
    super($anonymous0, $anonymous1, $anonymous2);
  }
  
  protected boolean readElement(IConfigurationElement element, boolean add)
  {
    if (element.getName().equals("extender"))
    {
      String packageURI = element.getAttribute("uri");
      String className = element.getAttribute("class");
      if (packageURI == null) {
        logMissingAttribute(element, "uri");
      } else if (className == null) {
        logMissingAttribute(element, "class");
      }
      Collection<IChildCreationExtender.Descriptor> collection = (Collection)EMFEditPlugin.access$2().get(packageURI);
      if (add)
      {
        if (collection == null) {
          EMFEditPlugin.access$2().put(packageURI, collection = new ArrayList());
        }
        collection.add(new RegistryReader.PluginClassDescriptor(element, "class")
        {
          protected String contributor;
          
          public IChildCreationExtender createChildCreationExtender()
          {
            return (IChildCreationExtender)createInstance();
          }
          
          public boolean matches(IConfigurationElement element)
          {
            return element.getContributor().getName().equals(contributor);
          }
        });
      }
      else if (collection != null)
      {
        for (IChildCreationExtender.Descriptor descriptor : collection) {
          if (((descriptor instanceof 1PluginChildCreationExtenderDescriptor)) && (((1PluginChildCreationExtenderDescriptor)descriptor).matches(element)))
          {
            collection.remove(descriptor);
            break;
          }
        }
      }
      return true;
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.EMFEditPlugin.4
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.edit;

import org.eclipse.emf.common.EMFPlugin.EclipsePlugin;

public class EMFEditPlugin$Implementation
  extends EMFPlugin.EclipsePlugin
{
  public EMFEditPlugin$Implementation()
  {
    EMFEditPlugin.access$0(this);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.EMFEditPlugin.Implementation
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.edit;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.StringTokenizer;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IContributor;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.EMFPlugin.EclipsePlugin;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.plugin.RegistryReader;
import org.eclipse.emf.ecore.plugin.RegistryReader.PluginClassDescriptor;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory.Descriptor;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory.Descriptor.Registry;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory.Descriptor.Registry.Impl;
import org.eclipse.emf.edit.provider.IChildCreationExtender;
import org.eclipse.emf.edit.provider.IChildCreationExtender.Descriptor;
import org.eclipse.emf.edit.provider.IChildCreationExtender.Descriptor.Registry;
import org.eclipse.emf.edit.provider.IChildCreationExtender.Descriptor.Registry.Impl;

public final class EMFEditPlugin
  extends EMFPlugin
{
  public static final EMFEditPlugin INSTANCE = new EMFEditPlugin();
  private static Implementation plugin;
  private static ComposedAdapterFactory.Descriptor.Registry.Impl composedAdapterFactoryDescriptorRegistry;
  private static IChildCreationExtender.Descriptor.Registry.Impl childCreationExtenderDescriptorRegistry;
  
  private EMFEditPlugin()
  {
    super(new ResourceLocator[0]);
  }
  
  public ResourceLocator getPluginResourceLocator()
  {
    return plugin;
  }
  
  public static ComposedAdapterFactory.Descriptor.Registry getComposedAdapterFactoryDescriptorRegistry()
  {
    if (composedAdapterFactoryDescriptorRegistry == null)
    {
      composedAdapterFactoryDescriptorRegistry = 
        new ComposedAdapterFactory.Descriptor.Registry.Impl(null)
        {
          private static final long serialVersionUID = 1L;
          
          public ComposedAdapterFactory.Descriptor delegatedGetDescriptor(Collection<?> types)
          {
            List<Object> stringTypes = new ArrayList(types.size());
            for (Object key : types) {
              if ((key instanceof EPackage)) {
                stringTypes.add(((EPackage)key).getNsURI());
              } else if ((key instanceof Package)) {
                stringTypes.add(((Package)key).getName());
              } else if ((key instanceof Class)) {
                stringTypes.add(((Class)key).getName());
              } else {
                return null;
              }
            }
            ComposedAdapterFactory.Descriptor descriptor = (ComposedAdapterFactory.Descriptor)get(stringTypes);
            if (descriptor != null)
            {
              put(types, descriptor);
              return descriptor;
            }
            return super.delegatedGetDescriptor(types);
          }
        };
        if ((INSTANCE.getPluginResourceLocator() instanceof EMFPlugin.EclipsePlugin))
        {
          RegistryReader registryReader = 
            new RegistryReader(Platform.getExtensionRegistry(), INSTANCE.getSymbolicName(), "itemProviderAdapterFactories")
            {
              protected boolean readElement(IConfigurationElement element, boolean add)
              {
                if (element.getName().equals("factory"))
                {
                  String packageURI = element.getAttribute("uri");
                  String className = element.getAttribute("class");
                  String supportedTypes = element.getAttribute("supportedTypes");
                  if (packageURI == null) {
                    logMissingAttribute(element, "uri");
                  } else if (className == null) {
                    logMissingAttribute(element, "class");
                  } else if (supportedTypes == null) {
                    logMissingAttribute(element, "supportedTypes");
                  }
                  for (StringTokenizer stringTokenizer = new StringTokenizer(supportedTypes); stringTokenizer.hasMoreTokens();)
                  {
                    String supportedType = stringTokenizer.nextToken();
                    List<Object> key = new ArrayList();
                    key.add(packageURI);
                    key.add(supportedType);
                    if (add) {
                      EMFEditPlugin.composedAdapterFactoryDescriptorRegistry.put(key, new RegistryReader.PluginClassDescriptor(element, "class")
                      {
                        public AdapterFactory createAdapterFactory()
                        {
                          return (AdapterFactory)createInstance();
                        }
                      });
                    } else {
                      EMFEditPlugin.composedAdapterFactoryDescriptorRegistry.remove(key);
                    }
                  }
                  return true;
                }
                return false;
              }
            };
            registryReader.readRegistry();
          }
        }
        return composedAdapterFactoryDescriptorRegistry;
      }
      
      public static IChildCreationExtender.Descriptor.Registry getChildCreationExtenderDescriptorRegistry()
      {
        if (childCreationExtenderDescriptorRegistry == null)
        {
          childCreationExtenderDescriptorRegistry = 
            new IChildCreationExtender.Descriptor.Registry.Impl(null)
            {
              private static final long serialVersionUID = 1L;
              
              public Collection<IChildCreationExtender.Descriptor> delegatedGetDescriptors(String namespace)
              {
                Collection<IChildCreationExtender.Descriptor> descriptors = (Collection)get(namespace);
                return descriptors != null ? descriptors : super.delegatedGetDescriptors(namespace);
              }
            };
            if ((INSTANCE.getPluginResourceLocator() instanceof EMFPlugin.EclipsePlugin))
            {
              RegistryReader registryReader = 
                new RegistryReader(Platform.getExtensionRegistry(), INSTANCE.getSymbolicName(), "childCreationExtenders")
                {
                  protected boolean readElement(IConfigurationElement element, boolean add)
                  {
                    if (element.getName().equals("extender"))
                    {
                      String packageURI = element.getAttribute("uri");
                      String className = element.getAttribute("class");
                      if (packageURI == null) {
                        logMissingAttribute(element, "uri");
                      } else if (className == null) {
                        logMissingAttribute(element, "class");
                      }
                      Collection<IChildCreationExtender.Descriptor> collection = (Collection)EMFEditPlugin.childCreationExtenderDescriptorRegistry.get(packageURI);
                      if (add)
                      {
                        if (collection == null) {
                          EMFEditPlugin.childCreationExtenderDescriptorRegistry.put(packageURI, collection = new ArrayList());
                        }
                        collection.add(new RegistryReader.PluginClassDescriptor(element, "class")
                        {
                          protected String contributor;
                          
                          public IChildCreationExtender createChildCreationExtender()
                          {
                            return (IChildCreationExtender)createInstance();
                          }
                          
                          public boolean matches(IConfigurationElement element)
                          {
                            return element.getContributor().getName().equals(contributor);
                          }
                        });
                      }
                      else if (collection != null)
                      {
                        for (IChildCreationExtender.Descriptor descriptor : collection) {
                          if (((descriptor instanceof 1PluginChildCreationExtenderDescriptor)) && (((1PluginChildCreationExtenderDescriptor)descriptor).matches(element)))
                          {
                            collection.remove(descriptor);
                            break;
                          }
                        }
                      }
                      return true;
                    }
                    return false;
                  }
                };
                registryReader.readRegistry();
              }
            }
            return childCreationExtenderDescriptorRegistry;
          }
          
          public static Implementation getPlugin()
          {
            return plugin;
          }
          
          public static class Implementation
            extends EMFPlugin.EclipsePlugin
          {
            public Implementation()
            {
              EMFEditPlugin.plugin = this;
            }
          }
        }

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.EMFEditPlugin
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.edit.command;

import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map.Entry;
import org.eclipse.emf.common.command.AbstractCommand;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.domain.EditingDomain;

public abstract class AbstractOverrideableCommand
  extends AbstractCommand
  implements OverrideableCommand
{
  protected EditingDomain domain;
  protected Command overrideCommand;
  
  protected AbstractOverrideableCommand(EditingDomain domain)
  {
    this(domain, null, null);
  }
  
  protected AbstractOverrideableCommand(EditingDomain domain, String label)
  {
    this(domain, label, null);
  }
  
  protected AbstractOverrideableCommand(EditingDomain domain, String label, String description)
  {
    super(label, description);
    
    this.domain = domain;
  }
  
  public EditingDomain getDomain()
  {
    return domain;
  }
  
  public Command getOverride()
  {
    return overrideCommand;
  }
  
  public void setOverride(Command overrideCommand)
  {
    this.overrideCommand = overrideCommand;
  }
  
  public final boolean canExecute()
  {
    if ((domain != null) && (!isPrepared))
    {
      Command newOverrideCommand = domain.createOverrideCommand(this);
      setOverride(newOverrideCommand);
    }
    boolean result = 
      overrideCommand != null ? 
      overrideCommand.canExecute() : 
      doCanExecute();
    
    return result;
  }
  
  public boolean doCanExecute()
  {
    return super.canExecute();
  }
  
  public final void execute()
  {
    if (overrideCommand != null) {
      overrideCommand.execute();
    } else {
      doExecute();
    }
  }
  
  public abstract void doExecute();
  
  public final boolean canUndo()
  {
    boolean result = 
      overrideCommand != null ? 
      overrideCommand.canUndo() : 
      doCanUndo();
    
    return result;
  }
  
  public boolean doCanUndo()
  {
    return super.canUndo();
  }
  
  public final void undo()
  {
    if (overrideCommand != null) {
      overrideCommand.undo();
    } else {
      doUndo();
    }
  }
  
  public abstract void doUndo();
  
  public final void redo()
  {
    if (overrideCommand != null) {
      overrideCommand.redo();
    } else {
      doRedo();
    }
  }
  
  public abstract void doRedo();
  
  public final Collection<?> getResult()
  {
    return 
      overrideCommand != null ? 
      overrideCommand.getResult() : 
      doGetResult();
  }
  
  public Collection<?> doGetResult()
  {
    return super.getResult();
  }
  
  public final Collection<?> getAffectedObjects()
  {
    return 
      overrideCommand != null ? 
      overrideCommand.getAffectedObjects() : 
      doGetAffectedObjects();
  }
  
  public Collection<?> doGetAffectedObjects()
  {
    return super.getAffectedObjects();
  }
  
  public final String getLabel()
  {
    return 
      overrideCommand != null ? 
      overrideCommand.getLabel() : 
      doGetLabel();
  }
  
  public String doGetLabel()
  {
    return super.getLabel();
  }
  
  public final String getDescription()
  {
    return 
      overrideCommand != null ? 
      overrideCommand.getDescription() : 
      doGetDescription();
  }
  
  public String doGetDescription()
  {
    return super.getDescription();
  }
  
  public final void dispose()
  {
    if (overrideCommand != null) {
      overrideCommand.dispose();
    } else {
      doDispose();
    }
  }
  
  public void doDispose()
  {
    super.dispose();
  }
  
  public final Collection<?> getChildrenToCopy()
  {
    Collection<?> result = 
      (overrideCommand instanceof ChildrenToCopyProvider) ? 
      ((ChildrenToCopyProvider)overrideCommand).getChildrenToCopy() : 
      doGetChildrenToCopy();
    
    return result;
  }
  
  public Collection<?> doGetChildrenToCopy()
  {
    return Collections.EMPTY_LIST;
  }
  
  public static EList<Object> getOwnerList(EObject owner, EStructuralFeature feature)
  {
    return 
      (owner.eClass().getEAllStructuralFeatures().contains(feature)) && (feature.isMany()) ? 
      (EList)owner.eGet(feature) : 
      null;
  }
  
  protected void updateEMap(EObject owner, EStructuralFeature feature)
  {
    if ((owner != null) && 
      (feature != null) && 
      ("key".equals(feature.getName())) && 
      (feature.getEContainingClass().getInstanceClass() == Map.Entry.class))
    {
      EObject container = owner.eContainer();
      if (container != null)
      {
        EStructuralFeature containmentFeature = owner.eContainmentFeature();
        
        List<Object> list = (List)container.eGet(containmentFeature);
        list.set(list.indexOf(owner), owner);
      }
    }
  }
  
  public String toString()
  {
    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (domain: " + domain + ")");
    result.append(" (overrideCommand: " + overrideCommand + ")");
    return result.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.command.AbstractOverrideableCommand
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.edit.command;

import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.util.ExtendedMetaData;
import org.eclipse.emf.ecore.util.FeatureMap.Entry;
import org.eclipse.emf.ecore.util.FeatureMapUtil;
import org.eclipse.emf.ecore.util.FeatureMapUtil.Validator;
import org.eclipse.emf.ecore.xml.type.XMLTypePackage.Literals;
import org.eclipse.emf.edit.EMFEditPlugin;
import org.eclipse.emf.edit.domain.EditingDomain;

public class AddCommand
  extends AbstractOverrideableCommand
{
  public static Command create(EditingDomain domain, Object owner, Object feature, Object value)
  {
    return create(domain, owner, feature, Collections.singleton(value), -1);
  }
  
  public static Command create(EditingDomain domain, Object owner, Object feature, Object value, int index)
  {
    return create(domain, owner, feature, Collections.singleton(value), index);
  }
  
  public static Command create(EditingDomain domain, Object owner, Object feature, Collection<?> collection)
  {
    return domain.createCommand(AddCommand.class, new CommandParameter(owner, feature, collection, -1));
  }
  
  public static Command create(EditingDomain domain, Object owner, Object feature, Collection<?> collection, int index)
  {
    return domain.createCommand(AddCommand.class, new CommandParameter(owner, feature, collection, index));
  }
  
  protected static final String LABEL = EMFEditPlugin.INSTANCE.getString("_UI_AddCommand_label");
  protected static final String DESCRIPTION = EMFEditPlugin.INSTANCE.getString("_UI_AddCommand_description");
  protected static final String DESCRIPTION_FOR_LIST = EMFEditPlugin.INSTANCE.getString("_UI_AddCommand_description_for_list");
  protected EObject owner;
  protected EStructuralFeature feature;
  protected EList<Object> ownerList;
  protected Collection<?> collection;
  protected int index;
  protected Collection<?> affectedObjects;
  
  public AddCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, Object value)
  {
    this(domain, owner, feature, Collections.singleton(value), -1);
  }
  
  public AddCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, Object value, int index)
  {
    this(domain, owner, feature, Collections.singleton(value), index);
  }
  
  public AddCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, Collection<?> collection)
  {
    this(domain, owner, feature, collection, -1);
  }
  
  public AddCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, Collection<?> collection, int index)
  {
    super(domain, LABEL, DESCRIPTION);
    
    this.owner = owner;
    this.feature = feature;
    this.collection = collection;
    this.index = index;
    
    ownerList = getOwnerList(owner, feature);
  }
  
  public AddCommand(EditingDomain domain, EList<?> list, Object value)
  {
    this(domain, list, Collections.singleton(value), -1);
  }
  
  public AddCommand(EditingDomain domain, EList<?> list, Object value, int index)
  {
    this(domain, list, Collections.singleton(value), index);
  }
  
  public AddCommand(EditingDomain domain, EList<?> list, Collection<?> collection)
  {
    this(domain, list, collection, -1);
  }
  
  public AddCommand(EditingDomain domain, EList<?> list, Collection<?> collection, int index)
  {
    super(domain, LABEL, DESCRIPTION_FOR_LIST);
    
    this.collection = collection;
    this.index = index;
    
    EList<Object> untypedList = list;
    ownerList = untypedList;
  }
  
  public EObject getOwner()
  {
    return owner;
  }
  
  public EStructuralFeature getFeature()
  {
    return feature;
  }
  
  public EList<?> getOwnerList()
  {
    return ownerList;
  }
  
  public Collection<?> getCollection()
  {
    return collection;
  }
  
  public int getIndex()
  {
    return index;
  }
  
  protected boolean isUserElement(EStructuralFeature entryFeature)
  {
    return (entryFeature != XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT) && (entryFeature != XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA) && (entryFeature != XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT) && (entryFeature != XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__PROCESSING_INSTRUCTION);
  }
  
  protected boolean prepare()
  {
    if ((ownerList == null) || 
      (collection == null) || 
      (collection.size() == 0) || (
      (index != -1) && ((index < 0) || (index > ownerList.size())))) {
      return false;
    }
    if (feature != null)
    {
      FeatureMapUtil.Validator validator = null;
      boolean documentRoot = false;
      Set<EStructuralFeature> entryFeatures = Collections.emptySet();
      boolean mixed;
      if (FeatureMapUtil.isFeatureMap(feature))
      {
        EClass eClass = owner.eClass();
        validator = FeatureMapUtil.getValidator(eClass, feature);
        
        documentRoot = ExtendedMetaData.INSTANCE.getDocumentRoot(eClass.getEPackage()) == eClass;
        mixed = (documentRoot) || (ExtendedMetaData.INSTANCE.getContentKind(eClass) == 3);
        entryFeatures = new HashSet();
        for (Object entry : ownerList)
        {
          EStructuralFeature entryFeature = ((FeatureMap.Entry)entry).getEStructuralFeature();
          if ((!mixed) || (isUserElement(entryFeature))) {
            entryFeatures.add(entryFeature);
          }
        }
      }
      for (Object object : collection)
      {
        boolean containment = false;
        if (!feature.getEType().isInstance(object)) {
          return false;
        }
        if ((feature.isUnique()) && (ownerList.contains(object))) {
          return false;
        }
        if (validator != null)
        {
          FeatureMap.Entry entry = (FeatureMap.Entry)object;
          EStructuralFeature entryFeature = entry.getEStructuralFeature();
          containment = ((entryFeature instanceof EReference)) && (((EReference)entryFeature).isContainment());
          if ((!validator.isValid(entryFeature)) || (!entryFeature.getEType().isInstance(entry.getValue()))) {
            return false;
          }
          if (documentRoot)
          {
            if (isUserElement(entryFeature))
            {
              if (!entryFeatures.isEmpty()) {
                return false;
              }
              entryFeatures.add(entryFeature);
            }
          }
          else if ((!entryFeatures.add(entryFeature)) && (!FeatureMapUtil.isMany(owner, entryFeature))) {
            return false;
          }
        }
        containment |= (((feature instanceof EReference)) && (((EReference)feature).isContainment()));
        if (containment) {
          for (EObject container = owner; container != null; container = container.eContainer()) {
            if (object == container) {
              return false;
            }
          }
        }
      }
    }
    if ((owner != null) && (domain.isReadOnly(owner.eResource()))) {
      return false;
    }
    return true;
  }
  
  public void doExecute()
  {
    if (index == -1) {
      ownerList.addAll(collection);
    } else {
      ownerList.addAll(index, collection);
    }
    updateEMap(owner, feature);
    
    affectedObjects = collection;
  }
  
  public void doUndo()
  {
    int i = index != -1 ? index : ownerList.size() - collection.size();
    ownerList.subList(i, i + collection.size()).clear();
    
    updateEMap(owner, feature);
    
    affectedObjects = (owner == null ? Collections.EMPTY_SET : Collections.singleton(owner));
  }
  
  public void doRedo()
  {
    if (index == -1) {
      ownerList.addAll(collection);
    } else {
      ownerList.addAll(index, collection);
    }
    updateEMap(owner, feature);
    
    affectedObjects = collection;
  }
  
  public Collection<?> doGetResult()
  {
    return collection;
  }
  
  public Collection<?> doGetAffectedObjects()
  {
    return affectedObjects;
  }
  
  public String toString()
  {
    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (owner: " + owner + ")");
    result.append(" (feature: " + feature + ")");
    result.append(" (ownerList: " + ownerList + ")");
    result.append(" (collection: " + collection + ")");
    result.append(" (index: " + index + ")");
    result.append(" (affectedObjects:" + affectedObjects + ")");
    
    return result.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.command.AddCommand
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.edit.command;

import java.util.Collection;
import org.eclipse.emf.common.command.AbstractCommand;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.ecore.change.ChangeDescription;
import org.eclipse.emf.ecore.change.util.ChangeRecorder;

public abstract class ChangeCommand
  extends AbstractCommand
{
  protected ChangeDescription changeDescription;
  protected Notifier notifier;
  protected Collection<Notifier> notifiers;
  protected ChangeRecorder changeRecorder;
  
  protected ChangeCommand(ChangeRecorder changeRecorder)
  {
    if (changeRecorder.isRecording()) {
      throw new IllegalStateException("The changeRecorder cannot be currently recording.");
    }
    this.changeRecorder = changeRecorder;
  }
  
  public ChangeCommand(ChangeRecorder changeRecorder, Notifier notifier)
  {
    this(changeRecorder);
    this.notifier = notifier;
  }
  
  public ChangeCommand(Notifier notifier)
  {
    this.notifier = notifier;
  }
  
  public ChangeCommand(ChangeRecorder changeRecorder, Collection<Notifier> notifiers)
  {
    this(changeRecorder);
    this.notifiers = notifiers;
  }
  
  public ChangeCommand(Collection<Notifier> notifiers)
  {
    this.notifiers = notifiers;
  }
  
  public void dispose()
  {
    changeRecorder = null;
    notifier = null;
    notifiers = null;
    
    changeDescription = null;
    
    super.dispose();
  }
  
  public ChangeRecorder getChangeRecorder()
  {
    return changeRecorder;
  }
  
  protected ChangeRecorder createChangeRecorder()
  {
    return new ChangeRecorder();
  }
  
  protected ChangeDescription getChangeDescription()
  {
    return changeDescription;
  }
  
  protected void setChangeDescription(ChangeDescription changeDescription)
  {
    this.changeDescription = changeDescription;
  }
  
  protected boolean prepare()
  {
    return getChangeDescription() == null;
  }
  
  /* Error */
  public void execute()
  {
    // Byte code:
    //   0: aload_0
    //   1: invokevirtual 93	org/eclipse/emf/edit/command/ChangeCommand:getChangeRecorder	()Lorg/eclipse/emf/ecore/change/util/ChangeRecorder;
    //   4: astore_1
    //   5: aload_1
    //   6: ifnonnull +8 -> 14
    //   9: aload_0
    //   10: invokevirtual 92	org/eclipse/emf/edit/command/ChangeCommand:createChangeRecorder	()Lorg/eclipse/emf/ecore/change/util/ChangeRecorder;
    //   13: astore_1
    //   14: aload_1
    //   15: aload_0
    //   16: getfield 77	org/eclipse/emf/edit/command/ChangeCommand:notifier	Lorg/eclipse/emf/common/notify/Notifier;
    //   19: ifnull +13 -> 32
    //   22: aload_0
    //   23: getfield 77	org/eclipse/emf/edit/command/ChangeCommand:notifier	Lorg/eclipse/emf/common/notify/Notifier;
    //   26: invokestatic 81	java/util/Collections:singleton	(Ljava/lang/Object;)Ljava/util/Set;
    //   29: goto +7 -> 36
    //   32: aload_0
    //   33: getfield 76	org/eclipse/emf/edit/command/ChangeCommand:notifiers	Ljava/util/Collection;
    //   36: invokevirtual 87	org/eclipse/emf/ecore/change/util/ChangeRecorder:beginRecording	(Ljava/util/Collection;)V
    //   39: aload_0
    //   40: invokevirtual 89	org/eclipse/emf/edit/command/ChangeCommand:doExecute	()V
    //   43: goto +19 -> 62
    //   46: astore_2
    //   47: aload_0
    //   48: aload_1
    //   49: invokevirtual 88	org/eclipse/emf/ecore/change/util/ChangeRecorder:endRecording	()Lorg/eclipse/emf/ecore/change/ChangeDescription;
    //   52: invokevirtual 91	org/eclipse/emf/edit/command/ChangeCommand:setChangeDescription	(Lorg/eclipse/emf/ecore/change/ChangeDescription;)V
    //   55: aload_0
    //   56: aload_1
    //   57: invokevirtual 95	org/eclipse/emf/edit/command/ChangeCommand:disposeChangeRecorder	(Lorg/eclipse/emf/ecore/change/util/ChangeRecorder;)V
    //   60: aload_2
    //   61: athrow
    //   62: aload_0
    //   63: aload_1
    //   64: invokevirtual 88	org/eclipse/emf/ecore/change/util/ChangeRecorder:endRecording	()Lorg/eclipse/emf/ecore/change/ChangeDescription;
    //   67: invokevirtual 91	org/eclipse/emf/edit/command/ChangeCommand:setChangeDescription	(Lorg/eclipse/emf/ecore/change/ChangeDescription;)V
    //   70: aload_0
    //   71: aload_1
    //   72: invokevirtual 95	org/eclipse/emf/edit/command/ChangeCommand:disposeChangeRecorder	(Lorg/eclipse/emf/ecore/change/util/ChangeRecorder;)V
    //   75: return
    // Line number table:
    //   Java source line #126	-> byte code offset #0
    //   Java source line #127	-> byte code offset #5
    //   Java source line #129	-> byte code offset #9
    //   Java source line #132	-> byte code offset #14
    //   Java source line #136	-> byte code offset #39
    //   Java source line #139	-> byte code offset #46
    //   Java source line #140	-> byte code offset #47
    //   Java source line #141	-> byte code offset #55
    //   Java source line #142	-> byte code offset #60
    //   Java source line #140	-> byte code offset #62
    //   Java source line #141	-> byte code offset #70
    //   Java source line #143	-> byte code offset #75
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	76	0	this	ChangeCommand
    //   4	68	1	changeRecorder	ChangeRecorder
    //   46	15	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   39	46	46	finally
  }
  
  protected abstract void doExecute();
  
  protected void disposeChangeRecorder(ChangeRecorder changeRecorder)
  {
    if (changeRecorder != getChangeRecorder()) {
      changeRecorder.dispose();
    }
  }
  
  public void undo()
  {
    getChangeDescription().applyAndReverse();
  }
  
  public void redo()
  {
    getChangeDescription().applyAndReverse();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.command.ChangeCommand
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.edit.command;

import java.util.Collection;

public abstract interface ChildrenToCopyProvider
{
  public abstract Collection<?> getChildrenToCopy();
}

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.command.ChildrenToCopyProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.edit.command;

public abstract interface CommandActionDelegate
{
  public abstract boolean canExecute();
  
  public abstract Object getImage();
  
  public abstract String getText();
  
  public abstract String getDescription();
  
  public abstract String getToolTipText();
}

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.command.CommandActionDelegate
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.edit.command;

import java.util.ArrayList;
import java.util.Collection;
impo
1 2 3 4 5 6 7 8 9 10 11 12 13

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd