org.eclipse.emf.mapping.domain
Class AdapterFactoryMappingDomain

java.lang.Object
  extended byorg.eclipse.emf.edit.domain.AdapterFactoryEditingDomain
      extended byorg.eclipse.emf.mapping.domain.AdapterFactoryMappingDomain
All Implemented Interfaces:
EditingDomain, MappingDomain
Direct Known Subclasses:
PluginAdapterFactoryMappingDomain

public class AdapterFactoryMappingDomain
extends AdapterFactoryEditingDomain
implements MappingDomain

This class implements MappingDomain interface using two strategies. The primary strategy is to delegate to an adapter that is produced by a AdapterFactoryMappingDomain.LabelUpdatePropagatingComposedAdapterFactory that comprises an adapter factory for the mapping model, an adapter factory for the top domain, and an adapter factory for the bottom domain (which may be the same as the one for the top domain). The secondary strategy is to use table lookup, which provides an easy way to supply the input/ouput type correspondence information from a plugin configuration file, when the top and bottom domains are of different type.


Nested Class Summary
static class AdapterFactoryMappingDomain.EditingDomainProvidingComposedAdapterFactory
           
protected  class AdapterFactoryMappingDomain.LabelUpdatePropagatingComposedAdapterFactory
           
 
Nested classes inherited from class org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain
AdapterFactoryEditingDomain.AdapterFactoryEditingDomainResourceSet, AdapterFactoryEditingDomain.DomainTreeIterator, AdapterFactoryEditingDomain.EditingDomainProvider
 
Field Summary
protected  int bottomLabelCase
           
protected  List bottomLabelLongForms
           
protected  char bottomLabelSeparator
           
protected  List bottomLabelShortForms
           
protected  HashMap bottomToTopTypeTable
           
protected  boolean isSameEditingDomainAdapterFactory
           
static int LABEL_LOWER
           
static int LABEL_MIXED
           
static char LABEL_NO_SEPARATOR
           
static int LABEL_UPPER
           
protected  int mappingEnablementFlags
           
protected  MappingRoot mappingRoot
           
protected  char packageTypeSeparator
           
protected  PersistentCommandStack persistentCommandStack
           
protected  int topLabelCase
           
protected  List topLabelLongForms
           
protected  char topLabelSeparator
           
protected  List topLabelShortForms
           
protected  HashMap topToBottomTypeTable
           
 
Fields inherited from class org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain
adapterFactory, clipboard, commandStack, optimizeCopy, resourceSet, resourceToReadOnlyMap
 
Fields inherited from interface org.eclipse.emf.mapping.domain.MappingDomain
ENABLE_ALL, ENABLE_EMPTY_INPUTS, ENABLE_EMPTY_OUTPUTS, ENABLE_INCOMPATIBLE_METAOBJECTS, ENABLE_INCOMPATIBLE_TYPE_CLASSIFIERS, ENABLE_MULTIPLE_INPUT_MAPPINGS, ENABLE_MULTIPLE_INPUTS, ENABLE_MULTIPLE_OUTPUT_MAPPINGS, ENABLE_MULTIPLE_OUTPUTS, ENABLE_UNMAPPED_PARENTS
 
Constructor Summary
AdapterFactoryMappingDomain(AdapterFactory mappingDomainAdapterFactory, AdapterFactory topDomainAdapterFactory, AdapterFactory bottomDomainAdapterFactory, CommandStack commandStack)
           
AdapterFactoryMappingDomain(AdapterFactory mappingDomainAdapterFactory, AdapterFactory topDomainAdapterFactory, AdapterFactory bottomDomainAdapterFactory, CommandStack commandStack, ResourceSet resourceSet)
           
AdapterFactoryMappingDomain(AdapterFactory mappingDomainAdapterFactory, AdapterFactory editingDomainAdapterFactory, CommandStack commandStack)
           
AdapterFactoryMappingDomain(AdapterFactory mappingDomainAdapterFactory, AdapterFactory editingDomainAdapterFactory, CommandStack commandStack, ResourceSet resourceSet)
           
 
Method Summary
protected  String change(String in, String oldPat, String newPat)
           
protected  String convertCase(String sourceName, int sourceCase, int targetCase, char sourceSeparator)
           
protected  String convertName(String sourceName, char sourceSeparator, int sourceCase, List sourceShortForms, List sourceLongForms, char targetSeparator, int targetCase, List targetShortForms, List targetLongForms)
           
protected  String convertNameForm(String name, List fromStrings, List toStrings)
           
protected  String convertSeparator(String sourceName, char sourceSeparator, char targetSeparator, int sourceCase)
           
protected  Command createAddOverrideCommand(AddCommand addCommand)
           
 Command createCommand(Class commandClass, CommandParameter commandParameter)
          This creates a command of the type of the specified by the command class and acting upon the information specified in the given command parameter.
protected  ComposedAdapterFactory createComposedAdapterFactory(AdapterFactory[] adapterFactories)
           
protected  ComposedAdapterFactory createComposedAdapterFactory(AdapterFactory mappingDomainAdapterFactory, AdapterFactory topDomainAdapterFactory, AdapterFactory bottomDomainAdapterFactory)
           
protected  Command createCopyToClipboardOverrideCommand(CopyToClipboardCommand copyToClipboardCommand)
           
protected  Command createCreateCopyOverrideCommand(CreateCopyCommand createCopyCommand)
           
protected  Command createDragAndDropOverrideCommand(DragAndDropCommand dragAndDropCommand)
           
protected  Command createInitializeCopyOverrideCommand(InitializeCopyCommand initializeCopyCommand)
           
protected  Command createMoveOverrideCommand(MoveCommand moveCommand)
           
 Command createOverrideCommand(OverrideableCommand command)
          This creates an override for the given command.
protected  Command createPasteFromClipboardOverrideCommand(PasteFromClipboardCommand pasteFromClipboardCommand)
           
protected  Command createRemoveOverrideCommand(RemoveCommand removeCommand)
           
protected  Command createReplaceOverrideCommand(ReplaceCommand replaceCommand)
           
protected  Command createSetOverrideCommand(SetCommand setCommand)
           
protected  EObject getCorrespondingType(EObject sourceType, HashMap typeTable)
           
 int getMappingEnablementFlags()
          This returns a set of flags that control enablement of mapping creation and removal commands for this domain.
 MappingRoot getMappingRoot()
          This returns the mapping root for this domain.
 String getName(Object object)
          This returns the name of the object.
 EObject getOutputMetaObject(EObject inputMetaObject)
          This returns the output meta object corresponding to the given input meta object.
 String getOutputName(String inputName)
          This returns the corresponding output name for the given input name.
 Object getOutputTypeClassifier(Object inputType)
          This returns the corresponding type classifier for the given input type classifier.
 Object getTypeClassifier(Object mappedObject)
          This default implementation returns null or the ETypedElement if the object is an ETypedElement.
 void handleCreateCommand(Class commandClass, CommandParameter commandParameter, Command command)
          This is called for every command created by the domain.
 List parseInputName(String inputName)
          This returns the list of words (substrings) in the specified input name.
protected  List parseName(String sourceName, char sourceSeparator)
           
 List parseOutputName(String outputName)
          This returns the list of words (substrings) in the specified output name.
 void setMappingEnablementFlags(int mappingEnablementFlags)
           
 void setMappingRoot(MappingRoot mappingRoot)
          This sets the mapping root for this domain to use.
 void setName(Object object, String name)
          This sets the name of the object.
 void setTypeClassifier(Object mappedObject, Object typeClassifier)
          This default implementation sets the ETypedElement if the object is an ETypedElement.
 
Methods inherited from class org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain
createResource, getAdapterFactory, getChildren, getClipboard, getCommandStack, getEditingDomainFor, getEditingDomainFor, getEditingDomainItemProviderFor, getNewChildDescriptors, getOptimizeCopy, getParent, getResourceSet, getResourceToReadOnlyMap, getRoot, getTreePath, getWrapper, isControllable, isControlled, isReadOnly, isReadOnlyURI, loadResource, setAdapterFactory, setClipboard, setOptimizeCopy, setResourceToReadOnlyMap, treeIterator, unwrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.edit.domain.EditingDomain
createResource, getChildren, getClipboard, getCommandStack, getNewChildDescriptors, getOptimizeCopy, getParent, getResourceSet, getRoot, getTreePath, isControllable, isReadOnly, loadResource, setClipboard, treeIterator
 

Field Detail

LABEL_UPPER

public static final int LABEL_UPPER
See Also:
Constant Field Values

LABEL_LOWER

public static final int LABEL_LOWER
See Also:
Constant Field Values

LABEL_MIXED

public static final int LABEL_MIXED
See Also:
Constant Field Values

LABEL_NO_SEPARATOR

public static final char LABEL_NO_SEPARATOR
See Also:
Constant Field Values

topToBottomTypeTable

protected HashMap topToBottomTypeTable

bottomToTopTypeTable

protected HashMap bottomToTopTypeTable

topLabelSeparator

protected char topLabelSeparator

bottomLabelSeparator

protected char bottomLabelSeparator

topLabelCase

protected int topLabelCase

bottomLabelCase

protected int bottomLabelCase

topLabelLongForms

protected List topLabelLongForms

bottomLabelLongForms

protected List bottomLabelLongForms

topLabelShortForms

protected List topLabelShortForms

bottomLabelShortForms

protected List bottomLabelShortForms

packageTypeSeparator

protected char packageTypeSeparator

mappingRoot

protected MappingRoot mappingRoot

isSameEditingDomainAdapterFactory

protected boolean isSameEditingDomainAdapterFactory

persistentCommandStack

protected PersistentCommandStack persistentCommandStack

mappingEnablementFlags

protected int mappingEnablementFlags
Constructor Detail

AdapterFactoryMappingDomain

public AdapterFactoryMappingDomain(AdapterFactory mappingDomainAdapterFactory,
                                   AdapterFactory editingDomainAdapterFactory,
                                   CommandStack commandStack)

AdapterFactoryMappingDomain

public AdapterFactoryMappingDomain(AdapterFactory mappingDomainAdapterFactory,
                                   AdapterFactory editingDomainAdapterFactory,
                                   CommandStack commandStack,
                                   ResourceSet resourceSet)

AdapterFactoryMappingDomain

public AdapterFactoryMappingDomain(AdapterFactory mappingDomainAdapterFactory,
                                   AdapterFactory topDomainAdapterFactory,
                                   AdapterFactory bottomDomainAdapterFactory,
                                   CommandStack commandStack)

AdapterFactoryMappingDomain

public AdapterFactoryMappingDomain(AdapterFactory mappingDomainAdapterFactory,
                                   AdapterFactory topDomainAdapterFactory,
                                   AdapterFactory bottomDomainAdapterFactory,
                                   CommandStack commandStack,
                                   ResourceSet resourceSet)
Method Detail

createComposedAdapterFactory

protected ComposedAdapterFactory createComposedAdapterFactory(AdapterFactory mappingDomainAdapterFactory,
                                                              AdapterFactory topDomainAdapterFactory,
                                                              AdapterFactory bottomDomainAdapterFactory)

createComposedAdapterFactory

protected ComposedAdapterFactory createComposedAdapterFactory(AdapterFactory[] adapterFactories)

getOutputName

public String getOutputName(String inputName)
Description copied from interface: MappingDomain
This returns the corresponding output name for the given input name.

Specified by:
getOutputName in interface MappingDomain

parseOutputName

public List parseOutputName(String outputName)
Description copied from interface: MappingDomain
This returns the list of words (substrings) in the specified output name.

Specified by:
parseOutputName in interface MappingDomain

parseInputName

public List parseInputName(String inputName)
Description copied from interface: MappingDomain
This returns the list of words (substrings) in the specified input name.

Specified by:
parseInputName in interface MappingDomain

getName

public String getName(Object object)
Description copied from interface: MappingDomain
This returns the name of the object.

Specified by:
getName in interface MappingDomain

setName

public void setName(Object object,
                    String name)
Description copied from interface: MappingDomain
This sets the name of the object.

Specified by:
setName in interface MappingDomain

getOutputMetaObject

public EObject getOutputMetaObject(EObject inputMetaObject)
Description copied from interface: MappingDomain
This returns the output meta object corresponding to the given input meta object.

Specified by:
getOutputMetaObject in interface MappingDomain

getMappingRoot

public MappingRoot getMappingRoot()
Description copied from interface: MappingDomain
This returns the mapping root for this domain.

Specified by:
getMappingRoot in interface MappingDomain

setMappingRoot

public void setMappingRoot(MappingRoot mappingRoot)
Description copied from interface: MappingDomain
This sets the mapping root for this domain to use.

Specified by:
setMappingRoot in interface MappingDomain

getTypeClassifier

public Object getTypeClassifier(Object mappedObject)
This default implementation returns null or the ETypedElement if the object is an ETypedElement.

Specified by:
getTypeClassifier in interface MappingDomain

setTypeClassifier

public void setTypeClassifier(Object mappedObject,
                              Object typeClassifier)
This default implementation sets the ETypedElement if the object is an ETypedElement.

Specified by:
setTypeClassifier in interface MappingDomain

getOutputTypeClassifier

public Object getOutputTypeClassifier(Object inputType)
Description copied from interface: MappingDomain
This returns the corresponding type classifier for the given input type classifier.

Specified by:
getOutputTypeClassifier in interface MappingDomain

getMappingEnablementFlags

public int getMappingEnablementFlags()
Description copied from interface: MappingDomain
This returns a set of flags that control enablement of mapping creation and removal commands for this domain.

Specified by:
getMappingEnablementFlags in interface MappingDomain

setMappingEnablementFlags

public void setMappingEnablementFlags(int mappingEnablementFlags)

handleCreateCommand

public void handleCreateCommand(Class commandClass,
                                CommandParameter commandParameter,
                                Command command)
This is called for every command created by the domain.


createCommand

public Command createCommand(Class commandClass,
                             CommandParameter commandParameter)
Description copied from interface: EditingDomain
This creates a command of the type of the specified by the command class and acting upon the information specified in the given command parameter.

Specified by:
createCommand in interface EditingDomain
Overrides:
createCommand in class AdapterFactoryEditingDomain

createOverrideCommand

public Command createOverrideCommand(OverrideableCommand command)
Description copied from interface: EditingDomain
This creates an override for the given command.

Specified by:
createOverrideCommand in interface EditingDomain
Overrides:
createOverrideCommand in class AdapterFactoryEditingDomain

createAddOverrideCommand

protected Command createAddOverrideCommand(AddCommand addCommand)

createRemoveOverrideCommand

protected Command createRemoveOverrideCommand(RemoveCommand removeCommand)

createSetOverrideCommand

protected Command createSetOverrideCommand(SetCommand setCommand)

createMoveOverrideCommand

protected Command createMoveOverrideCommand(MoveCommand moveCommand)

createReplaceOverrideCommand

protected Command createReplaceOverrideCommand(ReplaceCommand replaceCommand)

createCreateCopyOverrideCommand

protected Command createCreateCopyOverrideCommand(CreateCopyCommand createCopyCommand)

createInitializeCopyOverrideCommand

protected Command createInitializeCopyOverrideCommand(InitializeCopyCommand initializeCopyCommand)

createCopyToClipboardOverrideCommand

protected Command createCopyToClipboardOverrideCommand(CopyToClipboardCommand copyToClipboardCommand)

createPasteFromClipboardOverrideCommand

protected Command createPasteFromClipboardOverrideCommand(PasteFromClipboardCommand pasteFromClipboardCommand)

createDragAndDropOverrideCommand

protected Command createDragAndDropOverrideCommand(DragAndDropCommand dragAndDropCommand)

getCorrespondingType

protected EObject getCorrespondingType(EObject sourceType,
                                       HashMap typeTable)

parseName

protected List parseName(String sourceName,
                         char sourceSeparator)

convertName

protected String convertName(String sourceName,
                             char sourceSeparator,
                             int sourceCase,
                             List sourceShortForms,
                             List sourceLongForms,
                             char targetSeparator,
                             int targetCase,
                             List targetShortForms,
                             List targetLongForms)

convertCase

protected String convertCase(String sourceName,
                             int sourceCase,
                             int targetCase,
                             char sourceSeparator)

convertSeparator

protected String convertSeparator(String sourceName,
                                  char sourceSeparator,
                                  char targetSeparator,
                                  int sourceCase)

convertNameForm

protected String convertNameForm(String name,
                                 List fromStrings,
                                 List toStrings)

change

protected String change(String in,
                        String oldPat,
                        String newPat)

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.