org.eclipse.emf.mapping.domain
Class AdapterFactoryMappingDomain

java.lang.Object
  extended by org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain
      extended by org.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/interfaces inherited from class org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain
AdapterFactoryEditingDomain.AdapterFactoryEditingDomainResourceSet, AdapterFactoryEditingDomain.DomainTreeIterator<E>, AdapterFactoryEditingDomain.EditingDomainProvider
 
Field Summary
protected  int bottomLabelCase
           
protected  java.util.List<java.lang.String> bottomLabelLongForms
           
protected  char bottomLabelSeparator
           
protected  java.util.List<java.lang.String> bottomLabelShortForms
           
protected  java.util.HashMap<java.lang.String,java.lang.String> 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  java.util.List<java.lang.String> topLabelLongForms
           
protected  char topLabelSeparator
           
protected  java.util.List<java.lang.String> topLabelShortForms
           
protected  java.util.HashMap<java.lang.String,java.lang.String> 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  java.lang.String change(java.lang.String in, java.lang.String oldPat, java.lang.String newPat)
           
protected  java.lang.String convertCase(java.lang.String sourceName, int sourceCase, int targetCase, char sourceSeparator)
           
protected  java.lang.String convertName(java.lang.String sourceName, char sourceSeparator, int sourceCase, java.util.List<java.lang.String> sourceShortForms, java.util.List<java.lang.String> sourceLongForms, char targetSeparator, int targetCase, java.util.List<java.lang.String> targetShortForms, java.util.List<java.lang.String> targetLongForms)
           
protected  java.lang.String convertNameForm(java.lang.String name, java.util.List<java.lang.String> fromStrings, java.util.List<java.lang.String> toStrings)
           
protected  java.lang.String convertSeparator(java.lang.String sourceName, char sourceSeparator, char targetSeparator, int sourceCase)
           
protected  Command createAddOverrideCommand(AddCommand addCommand)
           
 Command createCommand(java.lang.Class<? extends Command> commandClass, CommandParameter commandParameter)
          This delegates to IEditingDomainItemProvider.createCommand.
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 just returns null, since this is an optional feature that we don't support here.
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, java.util.HashMap<java.lang.String,java.lang.String> 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.
 java.lang.String getName(java.lang.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.
 java.lang.String getOutputName(java.lang.String inputName)
          This returns the corresponding output name for the given input name.
 java.lang.Object getOutputTypeClassifier(java.lang.Object inputType)
          This returns the corresponding type classifier for the given input type classifier.
 java.lang.Object getTypeClassifier(java.lang.Object mappedObject)
          This default implementation returns null or the ETypedElement if the object is an ETypedElement.
 void handleCreateCommand(java.lang.Class<? extends Command> commandClass, CommandParameter commandParameter, Command command)
          This is called for every command created by the domain.
 java.util.List<java.lang.String> parseInputName(java.lang.String inputName)
          This returns the list of words (substrings) in the specified input name.
protected  java.util.List<java.lang.String> parseName(java.lang.String sourceName, char sourceSeparator)
           
 java.util.List<java.lang.String> parseOutputName(java.lang.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(java.lang.Object object, java.lang.String name)
          This sets the name of the object.
 void setTypeClassifier(java.lang.Object mappedObject, java.lang.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, getWrapper, isControllable, isControlled, isReadOnly, isReadOnlyURI, isStale, loadResource, resolve, 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 java.util.HashMap<java.lang.String,java.lang.String> topToBottomTypeTable

bottomToTopTypeTable

protected java.util.HashMap<java.lang.String,java.lang.String> bottomToTopTypeTable

topLabelSeparator

protected char topLabelSeparator

bottomLabelSeparator

protected char bottomLabelSeparator

topLabelCase

protected int topLabelCase

bottomLabelCase

protected int bottomLabelCase

topLabelLongForms

protected java.util.List<java.lang.String> topLabelLongForms

bottomLabelLongForms

protected java.util.List<java.lang.String> bottomLabelLongForms

topLabelShortForms

protected java.util.List<java.lang.String> topLabelShortForms

bottomLabelShortForms

protected java.util.List<java.lang.String> 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 java.lang.String getOutputName(java.lang.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 java.util.List<java.lang.String> parseOutputName(java.lang.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 java.util.List<java.lang.String> parseInputName(java.lang.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 java.lang.String getName(java.lang.Object object)
Description copied from interface: MappingDomain
This returns the name of the object.

Specified by:
getName in interface MappingDomain

setName

public void setName(java.lang.Object object,
                    java.lang.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 java.lang.Object getTypeClassifier(java.lang.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(java.lang.Object mappedObject,
                              java.lang.Object typeClassifier)
This default implementation sets the ETypedElement if the object is an ETypedElement.

Specified by:
setTypeClassifier in interface MappingDomain

getOutputTypeClassifier

public java.lang.Object getOutputTypeClassifier(java.lang.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(java.lang.Class<? extends Command> commandClass,
                                CommandParameter commandParameter,
                                Command command)
This is called for every command created by the domain.


createCommand

public Command createCommand(java.lang.Class<? extends Command> commandClass,
                             CommandParameter commandParameter)
Description copied from class: AdapterFactoryEditingDomain
This delegates to IEditingDomainItemProvider.createCommand.

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

createOverrideCommand

public Command createOverrideCommand(OverrideableCommand command)
Description copied from class: AdapterFactoryEditingDomain
This just returns null, since this is an optional feature that we don't support here.

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,
                                       java.util.HashMap<java.lang.String,java.lang.String> typeTable)

parseName

protected java.util.List<java.lang.String> parseName(java.lang.String sourceName,
                                                     char sourceSeparator)

convertName

protected java.lang.String convertName(java.lang.String sourceName,
                                       char sourceSeparator,
                                       int sourceCase,
                                       java.util.List<java.lang.String> sourceShortForms,
                                       java.util.List<java.lang.String> sourceLongForms,
                                       char targetSeparator,
                                       int targetCase,
                                       java.util.List<java.lang.String> targetShortForms,
                                       java.util.List<java.lang.String> targetLongForms)

convertCase

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

convertSeparator

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

convertNameForm

protected java.lang.String convertNameForm(java.lang.String name,
                                           java.util.List<java.lang.String> fromStrings,
                                           java.util.List<java.lang.String> toStrings)

change

protected java.lang.String change(java.lang.String in,
                                  java.lang.String oldPat,
                                  java.lang.String newPat)

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