org.eclipse.emf.mapping.ui_2.6.0.v20120130-0943

16:43:43.629 INFO  jd.cli.Main - Decompiling org.eclipse.emf.mapping.ui_2.6.0.v20120130-0943.jar
package org.eclipse.emf.mapping.action;

import java.util.Collection;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.ui.action.CommandAction;
import org.eclipse.emf.mapping.MappingPackage;
import org.eclipse.emf.mapping.MappingRoot;
import org.eclipse.emf.mapping.domain.MappingDomain;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchPart;

public class AddRootBottomAction
  extends CommandAction
{
  protected Collection<?> getBottomsToAdd()
  {
    return null;
  }
  
  public void selectionChanged(IAction action, ISelection selection) {}
  
  public void run(IAction action)
  {
    Collection<?> additions = getBottomsToAdd();
    MappingRoot mappingRoot = ((MappingDomain)editingDomain).getMappingRoot();
    command = AddCommand.create(
      editingDomain, 
      mappingRoot, 
      mappingRoot.isTopToBottom() ? 
      
      MappingPackage.eINSTANCE.getMapping_Outputs() : 
      MappingPackage.eINSTANCE.getMapping_Inputs(), 
      additions);
    
    super.run(action);
  }
  
  public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart)
  {
    super.setActiveWorkbenchPart(workbenchPart);
    action.setEnabled(true);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.mapping.action.AddRootBottomAction
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.mapping.action;

import java.util.Collection;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.ui.action.CommandAction;
import org.eclipse.emf.mapping.MappingPackage;
import org.eclipse.emf.mapping.MappingRoot;
import org.eclipse.emf.mapping.domain.MappingDomain;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchPart;

public class AddRootTopAction
  extends CommandAction
{
  protected Collection<?> getTopsToAdd()
  {
    return null;
  }
  
  public void selectionChanged(IAction action, ISelection selection) {}
  
  public void run(IAction action)
  {
    Collection<?> additions = getTopsToAdd();
    MappingRoot mappingRoot = ((MappingDomain)editingDomain).getMappingRoot();
    command = AddCommand.create(
      editingDomain, 
      mappingRoot, 
      mappingRoot.isTopToBottom() ? 
      
      MappingPackage.eINSTANCE.getMapping_Inputs() : 
      MappingPackage.eINSTANCE.getMapping_Outputs(), 
      additions);
    
    super.run(action);
  }
  
  public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart)
  {
    super.setActiveWorkbenchPart(workbenchPart);
    action.setEnabled(true);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.mapping.action.AddRootTopAction
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.mapping.action;

import java.util.Collection;
import org.eclipse.emf.common.command.CommandWrapper;
import org.eclipse.emf.edit.command.CommandActionDelegate;
import org.eclipse.emf.edit.command.CommandParameter;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.mapping.command.CreateMappingCommand;
import org.eclipse.emf.mapping.domain.MappingDomain;

public class CreateMappingAction$DelegateCommand
  extends CommandWrapper
  implements CommandActionDelegate
{
  protected MappingDomain mappingDomain;
  protected Collection<?> collection;
  
  public CreateMappingAction$DelegateCommand(EditingDomain editingDomain, CommandParameter commandParameter)
  {
    super(CreateMappingCommand.create((MappingDomain)editingDomain, commandParameter.getCollection()));
    mappingDomain = ((MappingDomain)editingDomain);
    collection = commandParameter.getCollection();
  }
  
  public Object getImage()
  {
    return "Placeholder";
  }
  
  public String getText()
  {
    return getLabel();
  }
  
  public String getToolTipText()
  {
    return getDescription();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.mapping.action.CreateMappingAction.DelegateCommand
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.mapping.action;

import java.util.Collection;
import java.util.EventObject;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.command.CommandStackListener;
import org.eclipse.emf.common.command.CommandWrapper;
import org.eclipse.emf.edit.command.CommandActionDelegate;
import org.eclipse.emf.edit.command.CommandParameter;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.ui.action.CommandAction;
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
import org.eclipse.emf.mapping.MappingPlugin;
import org.eclipse.emf.mapping.MappingPlugin.Implementation;
import org.eclipse.emf.mapping.command.CreateMappingCommand;
import org.eclipse.emf.mapping.domain.MappingDomain;
import org.eclipse.emf.mapping.presentation.IComposedSelection;
import org.eclipse.emf.mapping.provider.MappingItemProvider;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.ui.IWorkbenchPart;

public class CreateMappingAction
  extends CommandAction
  implements CommandStackListener
{
  public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart)
  {
    if (editingDomain != null) {
      editingDomain.getCommandStack().removeCommandStackListener(this);
    }
    super.setActiveWorkbenchPart(workbenchPart);
    if (editingDomain != null) {
      editingDomain.getCommandStack().addCommandStackListener(this);
    }
  }
  
  public void commandStackChanged(EventObject event)
  {
    selectionChanged(action, ((ISelectionProvider)workbenchPart).getSelection());
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    if ((selection instanceof IComposedSelection)) {
      super.selectionChanged(action, ((IComposedSelection)selection).getCombinedSelection());
    } else {
      super.selectionChanged(action, selection);
    }
  }
  
  protected Object getDefaultImage()
  {
    return MappingPlugin.getPlugin().getImage("full/etool16/CreateOneToOneMapping");
  }
  
  public static class DelegateCommand
    extends CommandWrapper
    implements CommandActionDelegate
  {
    protected MappingDomain mappingDomain;
    protected Collection<?> collection;
    
    public DelegateCommand(EditingDomain editingDomain, CommandParameter commandParameter)
    {
      super();
      mappingDomain = ((MappingDomain)editingDomain);
      collection = commandParameter.getCollection();
    }
    
    public Object getImage()
    {
      return "Placeholder";
    }
    
    public String getText()
    {
      return getLabel();
    }
    
    public String getToolTipText()
    {
      return getDescription();
    }
  }
  
  protected ImageDescriptor objectToImageDescriptor(Object object)
  {
    MappingDomain mappingDomain = (MappingDomain)editingDomain;
    
    ((Action)action).setHoverImageDescriptor(
      ExtendedImageRegistry.getInstance().getImageDescriptor(
      MappingItemProvider.getImage(mappingDomain.getMappingRoot(), "full/ctool16/Create", collection, true)));
    
    ((Action)action).setDisabledImageDescriptor(
      ExtendedImageRegistry.getInstance().getImageDescriptor(
      MappingItemProvider.getImage(mappingDomain.getMappingRoot(), "full/dtool16/Create", collection, true)));
    
    ImageDescriptor result = 
      ExtendedImageRegistry.getInstance().getImageDescriptor(
      MappingItemProvider.getImage(mappingDomain.getMappingRoot(), "full/etool16/Create", collection, true));
    
    ((Action)action).setEnabled(!action.isEnabled());
    ((Action)action).setImageDescriptor(result);
    ((Action)action).setEnabled(!action.isEnabled());
    
    return result;
  }
  
  protected Command createActionCommand(EditingDomain editingDomain, Collection<?> collection)
  {
    return editingDomain.createCommand(DelegateCommand.class, new CommandParameter(null, null, collection));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.mapping.action.CreateMappingAction
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.mapping.action;

import java.util.Collection;
import org.eclipse.emf.common.command.CommandWrapper;
import org.eclipse.emf.edit.command.CommandActionDelegate;
import org.eclipse.emf.edit.command.CommandParameter;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.mapping.command.CreateMappingCommand;
import org.eclipse.emf.mapping.domain.MappingDomain;

public class CreateOneSidedMappingAction$DelegateCommand
  extends CommandWrapper
  implements CommandActionDelegate
{
  protected MappingDomain mappingDomain;
  protected Collection<?> collection;
  
  public CreateOneSidedMappingAction$DelegateCommand(EditingDomain editingDomain, CommandParameter commandParameter)
  {
    super(CreateMappingCommand.create((MappingDomain)editingDomain, commandParameter.getCollection()));
    mappingDomain = ((MappingDomain)editingDomain);
    collection = commandParameter.getCollection();
  }
  
  public Object getImage()
  {
    return "Placeholder";
  }
  
  public String getText()
  {
    return getLabel();
  }
  
  public String getToolTipText()
  {
    return getDescription();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.mapping.action.CreateOneSidedMappingAction.DelegateCommand
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.mapping.action;

import java.util.Collection;
import java.util.EventObject;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.command.CommandStackListener;
import org.eclipse.emf.common.command.CommandWrapper;
import org.eclipse.emf.edit.command.CommandActionDelegate;
import org.eclipse.emf.edit.command.CommandParameter;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.ui.action.CommandAction;
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
import org.eclipse.emf.mapping.MappingPlugin;
import org.eclipse.emf.mapping.MappingPlugin.Implementation;
import org.eclipse.emf.mapping.command.CreateMappingCommand;
import org.eclipse.emf.mapping.domain.MappingDomain;
import org.eclipse.emf.mapping.provider.MappingItemProvider;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.ui.IWorkbenchPart;

public class CreateOneSidedMappingAction
  extends CommandAction
  implements CommandStackListener
{
  public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart)
  {
    if (editingDomain != null) {
      editingDomain.getCommandStack().removeCommandStackListener(this);
    }
    super.setActiveWorkbenchPart(workbenchPart);
    if (editingDomain != null) {
      editingDomain.getCommandStack().addCommandStackListener(this);
    }
  }
  
  public void commandStackChanged(EventObject event)
  {
    selectionChanged(action, ((ISelectionProvider)workbenchPart).getSelection());
  }
  
  protected Object getDefaultImage()
  {
    return MappingPlugin.getPlugin().getImage("full/etool16/CreateOneToOneMapping");
  }
  
  public static class DelegateCommand
    extends CommandWrapper
    implements CommandActionDelegate
  {
    protected MappingDomain mappingDomain;
    protected Collection<?> collection;
    
    public DelegateCommand(EditingDomain editingDomain, CommandParameter commandParameter)
    {
      super();
      mappingDomain = ((MappingDomain)editingDomain);
      collection = commandParameter.getCollection();
    }
    
    public Object getImage()
    {
      return "Placeholder";
    }
    
    public String getText()
    {
      return getLabel();
    }
    
    public String getToolTipText()
    {
      return getDescription();
    }
  }
  
  protected ImageDescriptor objectToImageDescriptor(Object object)
  {
    MappingDomain mappingDomain = (MappingDomain)editingDomain;
    
    ((Action)action).setHoverImageDescriptor(
      ExtendedImageRegistry.getInstance().getImageDescriptor(
      MappingItemProvider.getImage(mappingDomain.getMappingRoot(), "full/ctool16/Create", collection, true)));
    
    ((Action)action).setDisabledImageDescriptor(
      ExtendedImageRegistry.getInstance().getImageDescriptor(
      MappingItemProvider.getImage(mappingDomain.getMappingRoot(), "full/dtool16/Create", collection, true)));
    
    ((Action)action).setEnabled(!action.isEnabled());
    ((Action)action).setEnabled(!action.isEnabled());
    
    ImageDescriptor result = 
      ExtendedImageRegistry.getInstance().getImageDescriptor(
      MappingItemProvider.getImage(mappingDomain.getMappingRoot(), "full/etool16/Create", collection, true));
    
    ((Action)action).setEnabled(!action.isEnabled());
    ((Action)action).setImageDescriptor(result);
    ((Action)action).setEnabled(!action.isEnabled());
    
    return result;
  }
  
  protected Command createActionCommand(EditingDomain editingDomain, Collection<?> collection)
  {
    return editingDomain.createCommand(DelegateCommand.class, new CommandParameter(null, null, collection));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.mapping.action.CreateOneSidedMappingAction
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.mapping.action;

import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.edit.command.CommandActionDelegate;
import org.eclipse.emf.edit.command.CommandParameter;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.mapping.Mapping;
import org.eclipse.emf.mapping.MappingRoot;
import org.eclipse.emf.mapping.command.CreateMappingCommand;
import org.eclipse.emf.mapping.command.NameMatchMappingCommand;
import org.eclipse.emf.mapping.domain.MappingDomain;
import org.eclipse.emf.mapping.presentation.MappingUIPlugin;

public class NameMatchMappingAction$DelegateCommand
  extends CompoundCommand
  implements CommandActionDelegate
{
  protected MappingDomain mappingDomain;
  protected Collection<?> collection;
  protected Command createMappingCommand;
  
  public NameMatchMappingAction$DelegateCommand(EditingDomain editingDomain, CommandParameter commandParameter)
  {
    super(MappingUIPlugin.getPlugin().getString("_UI_NameMatchMappingAction_label"), MappingUIPlugin.getPlugin().getString("_UI_NameMatchMappingAction_description"));
    
    collection = commandParameter.getCollection();
    mappingDomain = ((MappingDomain)editingDomain);
  }
  
  protected boolean prepare()
  {
    boolean result = false;
    if (collection != null)
    {
      Collection<Object> mappedObjects = new HashSet();
      Collection<Object> mappingObjects = new HashSet();
      MappingRoot mappingRoot = mappingDomain.getMappingRoot();
      for (Object object : collection) {
        if ((object instanceof Mapping))
        {
          appendIfCanExecute(NameMatchMappingCommand.create(mappingDomain, (Mapping)object));
          mappingObjects.add(object);
        }
        else if ((mappingRoot.isInputObject(object)) || (mappingRoot.isOutputObject(object)))
        {
          mappedObjects.add(object);
        }
      }
      if (!mappedObjects.isEmpty())
      {
        Collection<? extends Mapping> mappings = mappingRoot.getAllMappings(mappedObjects);
        switch (mappings.size())
        {
        case 0: 
          createMappingCommand = CreateMappingCommand.create(mappingDomain, mappedObjects);
          result = appendIfCanExecute(createMappingCommand);
          break;
        case 1: 
          result = appendIfCanExecute(NameMatchMappingCommand.create(mappingDomain, (Mapping)mappings.iterator().next()));
          break;
        }
      }
    }
    result = (result) || (!isEmpty());
    return result;
  }
  
  public void execute()
  {
    super.execute();
    if (createMappingCommand != null) {
      appendAndExecute(NameMatchMappingCommand.create(mappingDomain, (Mapping)createMappingCommand.getResult().iterator().next()));
    }
  }
  
  public Object getImage()
  {
    return "Placeholder";
  }
  
  public String getText()
  {
    return getLabel();
  }
  
  public String getToolTipText()
  {
    return getDescription();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.mapping.action.NameMatchMappingAction.DelegateCommand
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.mapping.action;

import java.util.Collection;
import java.util.EventObject;
import java.util.HashSet;
import java.util.Iterator;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.command.CommandStackListener;
import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.edit.command.CommandActionDelegate;
import org.eclipse.emf.edit.command.CommandParameter;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.ui.action.CommandAction;
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
import org.eclipse.emf.mapping.Mapping;
import org.eclipse.emf.mapping.MappingPlugin;
import org.eclipse.emf.mapping.MappingPlugin.Implementation;
import org.eclipse.emf.mapping.MappingRoot;
import org.eclipse.emf.mapping.command.CreateMappingCommand;
import org.eclipse.emf.mapping.command.NameMatchMappingCommand;
import org.eclipse.emf.mapping.domain.MappingDomain;
import org.eclipse.emf.mapping.presentation.IComposedSelection;
import org.eclipse.emf.mapping.presentation.MappingUIPlugin;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.ui.IWorkbenchPart;

public class NameMatchMappingAction
  extends CommandAction
  implements CommandStackListener
{
  public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart)
  {
    if (editingDomain != null) {
      editingDomain.getCommandStack().removeCommandStackListener(this);
    }
    super.setActiveWorkbenchPart(workbenchPart);
    if (editingDomain != null) {
      editingDomain.getCommandStack().addCommandStackListener(this);
    }
  }
  
  public void commandStackChanged(EventObject event)
  {
    selectionChanged(action, ((ISelectionProvider)workbenchPart).getSelection());
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    if ((selection instanceof IComposedSelection)) {
      super.selectionChanged(action, ((IComposedSelection)selection).getCombinedSelection());
    } else {
      super.selectionChanged(action, selection);
    }
  }
  
  protected Object getDefaultImage()
  {
    return MappingPlugin.getPlugin().getImage("full/etool16/MatchByName");
  }
  
  public static class DelegateCommand
    extends CompoundCommand
    implements CommandActionDelegate
  {
    protected MappingDomain mappingDomain;
    protected Collection<?> collection;
    protected Command createMappingCommand;
    
    public DelegateCommand(EditingDomain editingDomain, CommandParameter commandParameter)
    {
      super(MappingUIPlugin.getPlugin().getString("_UI_NameMatchMappingAction_description"));
      
      collection = commandParameter.getCollection();
      mappingDomain = ((MappingDomain)editingDomain);
    }
    
    protected boolean prepare()
    {
      boolean result = false;
      if (collection != null)
      {
        Collection<Object> mappedObjects = new HashSet();
        Collection<Object> mappingObjects = new HashSet();
        MappingRoot mappingRoot = mappingDomain.getMappingRoot();
        for (Object object : collection) {
          if ((object instanceof Mapping))
          {
            appendIfCanExecute(NameMatchMappingCommand.create(mappingDomain, (Mapping)object));
            mappingObjects.add(object);
          }
          else if ((mappingRoot.isInputObject(object)) || (mappingRoot.isOutputObject(object)))
          {
            mappedObjects.add(object);
          }
        }
        if (!mappedObjects.isEmpty())
        {
          Collection<? extends Mapping> mappings = mappingRoot.getAllMappings(mappedObjects);
          switch (mappings.size())
          {
          case 0: 
            createMappingCommand = CreateMappingCommand.create(mappingDomain, mappedObjects);
            result = appendIfCanExecute(createMappingCommand);
            break;
          case 1: 
            result = appendIfCanExecute(NameMatchMappingCommand.create(mappingDomain, (Mapping)mappings.iterator().next()));
            break;
          }
        }
      }
      result = (result) || (!isEmpty());
      return result;
    }
    
    public void execute()
    {
      super.execute();
      if (createMappingCommand != null) {
        appendAndExecute(NameMatchMappingCommand.create(mappingDomain, (Mapping)createMappingCommand.getResult().iterator().next()));
      }
    }
    
    public Object getImage()
    {
      return "Placeholder";
    }
    
    public String getText()
    {
      return getLabel();
    }
    
    public String getToolTipText()
    {
      return getDescription();
    }
  }
  
  protected ImageDescriptor objectToImageDescriptor(Object object)
  {
    ((Action)action).setHoverImageDescriptor(
      ExtendedImageRegistry.getInstance().getImageDescriptor(MappingPlugin.getPlugin().getImage("full/ctool16/MatchByName")));
    
    ((Action)action).setDisabledImageDescriptor(
      ExtendedImageRegistry.getInstance().getImageDescriptor(MappingPlugin.getPlugin().getImage("full/dtool16/MatchByName")));
    
    return 
      ExtendedImageRegistry.getInstance().getImageDescriptor(MappingPlugin.getPlugin().getImage("full/etool16/MatchByName"));
  }
  
  protected Command createActionCommand(EditingDomain editingDomain, Collection<?> collection)
  {
    return editingDomain.createCommand(DelegateCommand.class, new CommandParameter(null, null, collection));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.mapping.action.NameMatchMappingAction
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.mapping.action;

import java.util.Collection;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandWrapper;
import org.eclipse.emf.edit.command.CommandActionDelegate;
import org.eclipse.emf.edit.command.CommandParameter;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.mapping.Mapping;
import org.eclipse.emf.mapping.MappingRoot;
import org.eclipse.emf.mapping.command.RemoveMappingCommand;
import org.eclipse.emf.mapping.domain.MappingDomain;

public class RemoveMappingAction$CommandDelegate
  extends CommandWrapper
  implements CommandActionDelegate
{
  protected MappingDomain mappingDomain;
  protected Collection<?> collection;
  
  public RemoveMappingAction$CommandDelegate(EditingDomain editingDomain, CommandParameter commandParameter)
  {
    mappingDomain = ((MappingDomain)editingDomain);
    collection = commandParameter.getCollection();
  }
  
  public Object getImage()
  {
    return "Placeholder";
  }
  
  public String getText()
  {
    return getLabel();
  }
  
  public String getToolTipText()
  {
    return getDescription();
  }
  
  public Command createCommand()
  {
    boolean allMappings = true;
    for (Object object : collection) {
      if (!(object instanceof Mapping))
      {
        allMappings = false;
        break;
      }
    }
    if (allMappings) {
      return RemoveMappingCommand.create(mappingDomain, collection);
    }
    Collection<? extends Mapping> mappings = mappingDomain.getMappingRoot().getExactMappings(collection);
    return RemoveMappingCommand.create(mappingDomain, mappings);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.mapping.action.RemoveMappingAction.CommandDelegate
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.mapping.action;

import java.util.Collection;
import java.util.EventObject;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.command.CommandStackListener;
import org.eclipse.emf.common.command.CommandWrapper;
import org.eclipse.emf.edit.command.CommandActionDelegate;
import org.eclipse.emf.edit.command.CommandParameter;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.ui.action.CommandAction;
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
import org.eclipse.emf.mapping.Mapping;
import org.eclipse.emf.mapping.MappingPlugin;
import org.eclipse.emf.mapping.MappingPlugin.Implementation;
import org.eclipse.emf.mapping.MappingRoot;
import org.eclipse.emf.mapping.command.RemoveMappingCommand;
import org.eclipse.emf.mapping.domain.MappingDomain;
import org.eclipse.emf.mapping.presentation.IComposedSelection;
import org.eclipse.emf.mapping.provider.MappingItemProvider;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.ui.IWorkbenchPart;

public class RemoveMappingAction
  extends CommandAction
  implements CommandStackListener
{
  public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart)
  {
    if (editingDomain != null) {
      editingDomain.getCommandStack().removeCommandStackListener(this);
    }
    super.setActiveWorkbenchPart(workbenchPart);
    if (editingDomain != null) {
      editingDomain.getCommandStack().addCommandStackListener(this);
    }
  }
  
  public void commandStackChanged(EventObject event)
  {
    selectionChanged(action, ((ISelectionProvider)workbenchPart).getSelection());
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    if ((selection instanceof IComposedSelection)) {
      super.selectionChanged(action, ((IComposedSelection)selection).getCombinedSelection());
    } else {
      super.selectionChanged(action, selection);
    }
  }
  
  protected Object getDefaultImage()
  {
    return MappingPlugin.getPlugin().getImage("full/etool16/RemoveOneToOneMapping");
  }
  
  public static class CommandDelegate
    extends CommandWrapper
    implements CommandActionDelegate
  {
    protected MappingDomain mappingDomain;
    protected Collection<?> collection;
    
    public CommandDelegate(EditingDomain editingDomain, CommandParameter commandParameter)
    {
      mappingDomain = ((MappingDomain)editingDomain);
      collection = commandParameter.getCollection();
    }
    
    public Object getImage()
    {
      return "Placeholder";
    }
    
    public String getText()
    {
      return getLabel();
    }
    
    public String getToolTipText()
    {
      return getDescription();
    }
    
    public Command createCommand()
    {
      boolean allMappings = true;
      for (Object object : collection) {
        if (!(object instanceof Mapping))
        {
          allMappings = false;
          break;
        }
      }
      if (allMappings) {
        return RemoveMappingCommand.create(mappingDomain, collection);
      }
      Collection<? extends Mapping> mappings = mappingDomain.getMappingRoot().getExactMappings(collection);
      return RemoveMappingCommand.create(mappingDomain, mappings);
    }
  }
  
  protected ImageDescriptor objectToImageDescriptor(Object object)
  {
    MappingDomain mappingDomain = (MappingDomain)editingDomain;
    
    ((Action)action).setHoverImageDescriptor(
      ExtendedImageRegistry.getInstance().getImageDescriptor(
      MappingItemProvider.getImage(mappingDomain.getMappingRoot(), "full/ctool16/Remove", collection)));
    
    ((Action)action).setDisabledImageDescriptor(
      ExtendedImageRegistry.getInstance().getImageDescriptor(
      MappingItemProvider.getImage(mappingDomain.getMappingRoot(), "full/dtool16/Remove", collection)));
    
    ImageDescriptor result = 
      ExtendedImageRegistry.getInstance().getImageDescriptor(
      MappingItemProvider.getImage(mappingDomain.getMappingRoot(), "full/etool16/Remove", collection));
    
    ((Action)action).setEnabled(!action.isEnabled());
    ((Action)action).setImageDescriptor(result);
    ((Action)action).setEnabled(!action.isEnabled());
    
    return result;
  }
  
  protected Command createActionCommand(EditingDomain editingDomain, Collection<?> collection)
  {
    return editingDomain.createCommand(CommandDelegate.class, new CommandParameter(null, null, collection));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.mapping.action.RemoveMappingAction
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.mapping.action;

import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.edit.command.CommandActionDelegate;
import org.eclipse.emf.edit.command.CommandParameter;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.mapping.Mapping;
import org.eclipse.emf.mapping.MappingRoot;
import org.eclipse.emf.mapping.command.CreateMappingCommand;
import org.eclipse.emf.mapping.command.TypeMatchMappingCommand;
import org.eclipse.emf.mapping.domain.MappingDomain;
import org.eclipse.emf.mapping.presentation.MappingUIPlugin;

public class TypeMatchMappingAction$DelegateCommand
  extends CompoundCommand
  implements CommandActionDelegate
{
  protected MappingDomain mappingDomain;
  protected Collection<?> collection;
  protected Command createMappingCommand;
  
  public TypeMatchMappingAction$DelegateCommand(EditingDomain editingDomain, CommandParameter commandParameter)
  {
    super(MappingUIPlugin.getPlugin().getString("_UI_TypeMatchMappingAction_label"), MappingUIPlugin.getPlugin().getString("_UI_TypeMatchMappingAction_description"));
    collection = commandParameter.getCollection();
    mappingDomain = ((MappingDomain)editingDomain);
  }
  
  protected boolean prepare()
  {
    boolean result = false;
    if (collection != null)
    {
      Collection<Object> mappedObjects = new HashSet();
      Collection<Object> mappingObjects = new HashSet();
      MappingRoot mappingRoot = mappingDomain.getMappingRoot();
      for (Object object : collection) {
        if ((object instanceof Mapping))
        {
          appendIfCanExecute(TypeMatchMappingCommand.create(mappingDomain, (Mapping)object));
          mappingObjects.add(object);
        }
        else if ((mappingRoot.isInputObject(object)) || (mappingRoot.isOutputObject(object)))
        {
          mappedObjects.add(object);
        }
      }
      if (!mappedObjects.isEmpty())
      {
        Collection<? extends Mapping> mappings = mappingRoot.getAllMappings(mappedObjects);
        switch (mappings.size())
        {
        case 0: 
          createMappingCommand = CreateMappingCommand.create(mappingDomain, mappedObjects);
          result = appendIfCanExecute(createMappingCommand);
          break;
        case 1: 
          result = appendIfCanExecute(TypeMatchMappingCommand.create(mappingDomain, (Mapping)mappings.iterator().next()));
          break;
        }
      }
    }
    result = (result) || (!isEmpty());
    return result;
  }
  
  public void execute()
  {
    super.execute();
    if (createMappingCommand != null) {
      appendAndExecute(TypeMatchMappingCommand.create(mappingDomain, (Mapping)createMappingCommand.getResult().iterator().next()));
    }
  }
  
  public Object getImage()
  {
    return "Placeholder";
  }
  
  public String getText()
  {
    return getLabel();
  }
  
  public String getToolTipText()
  {
    return getDescription();
  }
  
  public void dispose()
  {
    if (createMappingCommand != null) {
      createMappingCommand.dispose();
    }
    super.dispose();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.mapping.action.TypeMatchMappingAction.DelegateCommand
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.mapping.action;

import java.util.Collection;
import java.util.EventObject;
import java.util.HashSet;
import java.util.Iterator;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.command.CommandStackListener;
import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.edit.command.CommandActionDelegate;
import org.eclipse.emf.edit.command.CommandParameter;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.ui.action.CommandAction;
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
import org.eclipse.emf.mapping.Mapping;
import org.eclipse.emf.mapping.MappingPlugin;
import org.eclipse.emf.mapping.MappingPlugin.Implementation;
import org.eclipse.emf.mapping.MappingRoot;
import org.eclipse.emf.mapping.command.CreateMappingCommand;
import org.eclipse.emf.mapping.command.TypeMatchMappingCommand;
import org.eclipse.emf.mapping.domain.MappingDomain;
import org.eclipse.emf.mapping.presentation.IComposedSelection;
import org.eclipse.emf.mapping.presentation.MappingUIPlugin;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.ui.IWorkbenchPart;

public class TypeMatchMappingAction
  extends CommandAction
  implements CommandStackListener
{
  public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart)
  {
    if (editingDomain != null) {
      editingDomain.getCommandStack().removeCommandStackListener(this);
    }
    super.setActiveWorkbenchPart(workbenchPart);
    if (editingDomain != null) {
      editingDomain.getCommandStack().addCommandStackListener(this);
    }
  }
  
  public void commandStackChanged(EventObject event)
  {
    selectionChanged(action, ((ISelectionProvider)workbenchPart).getSelection());
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    if ((selection instanceof IComposedSelection)) {
      super.selectionChanged(action, ((IComposedSelection)selection).getCombinedSelection());
    } else {
      super.selectionChanged(action, selection);
    }
  }
  
  protected Object getDefaultImage()
  {
    return MappingUIPlugin.getPlugin().getImage("full/etool16/MatchByType");
  }
  
  public static class DelegateCommand
    extends CompoundCommand
    implements CommandActionDelegate
  {
    protected MappingDomain mappingDomain;
    protected Collection<?> collection;
    protected Command createMappingCommand;
    
    public DelegateCommand(EditingDomain editingDomain, CommandParameter commandParameter)
    {
      super(MappingUIPlugin.getPlugin().getString("_UI_TypeMatchMappingAction_description"));
      collection = commandParameter.getCollection();
      mappingDomain = ((MappingDomain)editingDomain);
    }
    
    protected boolean prepare()
    {
      boolean result = false;
      if (collection != null)
      {
        Collection<Object> mappedObjects = new HashSet();
        Collection<Object> mappingObjects = new HashSet();
        MappingRoot mappingRoot = mappingDomain.getMappingRoot();
        for (Object object : collection) {
          if ((object instanceof Mapping))
          {
            appendIfCanExecute(TypeMatchMappingCommand.create(mappingDomain, (Mapping)object));
            mappingObjects.add(object);
          }
          else if ((mappingRoot.isInputObject(object)) || (mappingRoot.isOutputObject(object)))
          {
            mappedObjects.add(object);
          }
        }
        if (!mappedObjects.isEmpty())
        {
          Collection<? extends Mapping> mappings = mappingRoot.getAllMappings(mappedObjects);
          switch (mappings.size())
          {
          case 0: 
            createMappingCommand = CreateMappingCommand.create(mappingDomain, mappedObjects);
            result = appendIfCanExecute(createMappingCommand);
            break;
          case 1: 
            result = appendIfCanExecute(TypeMatchMappingCommand.create(mappingDomain, (Mapping)mappings.iterator().next()));
            break;
          }
        }
      }
      result = (result) || (!isEmpty());
      return result;
    }
    
    public void execute()
    {
      super.execute();
      if (createMappingCommand != null) {
        appendAndExecute(TypeMatchMappingCommand.create(mappingDomain, (Mapping)createMappingCommand.getResult().iterator().next()));
      }
    }
    
    public Object getImage()
    {
      return "Placeholder";
    }
    
    public String getText()
    {
      return getLabel();
    }
    
    public String getToolTipText()
    {
      return getDescription();
    }
    
    public void dispose()
    {
      if (createMappingCommand != null) {
        createMappingCommand.dispose();
      }
      super.dispose();
    }
  }
  
  protected ImageDescriptor objectToImageDescriptor(Object object)
  {
    ((Action)action).setHoverImageDescriptor(
      ExtendedImageRegistry.getInstance().getImageDescriptor(MappingPlugin.getPlugin().getImage("full/ctool16/MatchByType")));
    
    ((Action)action).setDisabledImageDescriptor(
      ExtendedImageRegistry.getInstance().getImageDescriptor(MappingPlugin.getPlugin().getImage("full/dtool16/MatchByType")));
    
    return 
      ExtendedImageRegistry.getInstance().getImageDescriptor(MappingPlugin.getPlugin().getImage("full/etool16/MatchByType"));
  }
  
  protected Command createActionCommand(EditingDomain editingDomain, Collection<?> collection)
  {
    return editingDomain.createCommand(DelegateCommand.class, new CommandParameter(null, null, collection));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.mapping.action.TypeMatchMappingAction
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.mapping.presentation;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;

public class ComposedSelection
  implements IStructuredSelection, IComposedSelection
{
  protected ISelection[] selections;
  protected ISelection primarySelection;
  
  public ComposedSelection(ISelection primarySelection, ISelection[] selections)
  {
    this.primarySelection = primarySelection;
    this.selections = selections;
  }
  
  public boolean isEmpty()
  {
    return (primarySelection == null) || (primarySelection.isEmpty());
  }
  
  @Deprecated
  public Iterator<?> getElements()
  {
    return (primarySelection instanceof IStructuredSelection) ? ((IStructuredSelection)primarySelection).iterator() : null;
  }
  
  public Iterator<?> iterator()
  {
    return (primarySelection instanceof IStructuredSelection) ? ((IStructuredSelection)primarySelection).iterator() : null;
  }
  
  public Object[] toArray()
  {
    return (primarySelection instanceof IStructuredSelection) ? ((IStructuredSelection)primarySelection).toArray() : null;
  }
  
  public List<?> toList()
  {
    return (primarySelection instanceof IStructuredSelection) ? ((IStructuredSelection)primarySelection).toList() : null;
  }
  
  public Object getFirstElement()
  {
    return (primarySelection instanceof ISt
1 2 3 4 5

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