org.eclipse.gmt.umlx.editor.regime
Class AbstractRegime<M extends org.eclipse.emf.common.notify.Notifier,P>

java.lang.Object
  extended by org.eclipse.gmt.umlx.utils.ClassExtension<M>
      extended by org.eclipse.gmt.umlx.editor.regime.AbstractRegime<M,P>
All Implemented Interfaces:
IRegime, IRegimeCo0<M,P>, IClassExtension
Direct Known Subclasses:
AbstractLinkRegimeCo0, AbstractNodeRegimeCo0

public abstract class AbstractRegime<M extends org.eclipse.emf.common.notify.Notifier,P>
extends ClassExtension<M>
implements IRegimeCo0<M,P>


Method Summary
 boolean canCopy(IRegimeContext regimeContext, M selectedObject)
           
 boolean canDelete(IRegimeContext regimeContext, M selectedObject)
           
 IProblemMessage<?> computeProblemMessage(M model)
          Return a non-null message describing a problem with model.
 IAbstractCommand createCreateChildLinkCommand(IActiveEditDomain editDomain, java.lang.Object coChild, java.lang.Object child, java.lang.Object parent)
          Create a command to create a graphical link between a newly created graphical child and its graphical parent.
 CreateCommand createCreateCommand(IActiveEditDomain editDomain, java.lang.Object coModel, java.lang.Object context)
          Create a command to create an instance of the model element managed by this regime, with the created element a child of parent, and instantiating coModel.
 DeleteCommand createDeleteCommand(DeleteDomain deleteDomain, M model)
           
 void createFacets(java.util.List<IFacet<? super M>> facetList)
           
 ILinkEnd createLinkEnd(java.lang.Object object)
          Create an object to describe the end of a link terminating at object.
 M createModelObject()
          Create a new and uninitialised EMF object of the type managed by this regime.
 AbstractOutline createOutline(OutlineViewer viewer, M model)
           
 AbstractPropertySource createPropertySource(M model)
           
 org.eclipse.gef.EditPart createView(SheetViewer viewer, M model)
           
 GModelElement getBackElement(java.lang.Object editModel)
          Return the non-opaque model element behind the graphical editModel.
 java.lang.Class<M> getBasicClass()
           
 java.lang.Object getCoModel(java.lang.Object model)
          Return the co-model of model if it has one.
 java.lang.Class<?> getCoModelClass()
          Return the co-model class if it has one.
 java.lang.Class<?> getCoModelParentClass()
          Return the co-model parent class if it has one.
abstract  IRegimeCo0<?,?> getCoRegime()
          Return the co-regime if it has one.
 IFacet<? super M>[] getFacets()
           
 java.lang.Class<M> getModelClass()
          Return the model class.
 java.lang.String getNewNamePrefix()
          Return a prefix for autogenerated names.
 java.lang.Class<P> getParentModelClass()
          Return the class of the parent
 java.lang.Class<? extends GSheet> getSheetClass()
          Return the class of the sheet that this regime supports
 java.lang.Object getSource(java.lang.Object model)
          Return the source node of model if it is a link.
 java.lang.Class<?> getSourceModelClass()
          Return the class of source nodes if appropriate
 java.lang.Object getTarget(java.lang.Object model)
          Return the target node of model if it is a link.
 java.lang.Class<?> getTargetModelClass()
          Return the class of target nodes if appropriate
 void initialise(IModelState rawState)
           
 ILinkRegimeCo0<?,M,?,P> isLink()
           
 INodeRegimeCo0<M,P> isNode()
           
 IRegimeCo0<M,P> isRegimeCo0()
          Return this non-null regime if it is suitable for use with zero or more levels of co-model.
 IRegimeCo1<M,P,?,?> isRegimeCo1()
          Return this non-null regime if it is suitable for use with one or more levels of co-model.
 IRegimeCo2<M,P,?,?> isRegimeCo2()
          Return this non-null regime if it is suitable for use with two or more levels of co-model.
static void load()
           
 IProblemMessage<?> refreshProblemMessage(ActiveEditDomain domain, M model)
          Recompute and return the error message for model within domain.
 void setCoModel(M model, java.lang.Object coModel)
           
 java.lang.String toString()
           
 
Methods inherited from class org.eclipse.gmt.umlx.utils.ClassExtension
toDebugString, toUserString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.gmt.umlx.editor.regime.IRegime
getIcon, getLabel
 
Methods inherited from interface org.eclipse.gmt.umlx.utils.IClassExtension
toDebugString, toUserString
 

Method Detail

load

public static void load()

canCopy

public boolean canCopy(IRegimeContext regimeContext,
                       M selectedObject)
Specified by:
canCopy in interface IRegimeCo0<M extends org.eclipse.emf.common.notify.Notifier,P>

canDelete

public boolean canDelete(IRegimeContext regimeContext,
                         M selectedObject)
Specified by:
canDelete in interface IRegimeCo0<M extends org.eclipse.emf.common.notify.Notifier,P>

computeProblemMessage

public final IProblemMessage<?> computeProblemMessage(M model)
Description copied from interface: IRegimeCo0
Return a non-null message describing a problem with model.

Specified by:
computeProblemMessage in interface IRegimeCo0<M extends org.eclipse.emf.common.notify.Notifier,P>
Returns:
a error message or null.

createCreateChildLinkCommand

public IAbstractCommand createCreateChildLinkCommand(IActiveEditDomain editDomain,
                                                     java.lang.Object coChild,
                                                     java.lang.Object child,
                                                     java.lang.Object parent)
Description copied from interface: IRegime
Create a command to create a graphical link between a newly created graphical child and its graphical parent. This is used to create an attribution link when a sheet attribute is created.

Specified by:
createCreateChildLinkCommand in interface IRegime

createCreateCommand

public CreateCommand createCreateCommand(IActiveEditDomain editDomain,
                                         java.lang.Object coModel,
                                         java.lang.Object context)
Description copied from interface: IRegime
Create a command to create an instance of the model element managed by this regime, with the created element a child of parent, and instantiating coModel.

Specified by:
createCreateCommand in interface IRegime

createDeleteCommand

public DeleteCommand createDeleteCommand(DeleteDomain deleteDomain,
                                         M model)
Specified by:
createDeleteCommand in interface IRegimeCo0<M extends org.eclipse.emf.common.notify.Notifier,P>

createFacets

public void createFacets(java.util.List<IFacet<? super M>> facetList)

createLinkEnd

public ILinkEnd createLinkEnd(java.lang.Object object)
Description copied from interface: IRegime
Create an object to describe the end of a link terminating at object.

Specified by:
createLinkEnd in interface IRegime

createModelObject

public M createModelObject()
Description copied from interface: IRegime
Create a new and uninitialised EMF object of the type managed by this regime.

Specified by:
createModelObject in interface IRegime
Specified by:
createModelObject in interface IRegimeCo0<M extends org.eclipse.emf.common.notify.Notifier,P>

createOutline

public AbstractOutline createOutline(OutlineViewer viewer,
                                     M model)
Specified by:
createOutline in interface IRegimeCo0<M extends org.eclipse.emf.common.notify.Notifier,P>

createPropertySource

public AbstractPropertySource createPropertySource(M model)
Specified by:
createPropertySource in interface IRegimeCo0<M extends org.eclipse.emf.common.notify.Notifier,P>

createView

public org.eclipse.gef.EditPart createView(SheetViewer viewer,
                                           M model)
Specified by:
createView in interface IRegimeCo0<M extends org.eclipse.emf.common.notify.Notifier,P>

getBackElement

public GModelElement getBackElement(java.lang.Object editModel)
Description copied from interface: IRegime
Return the non-opaque model element behind the graphical editModel.

Specified by:
getBackElement in interface IRegime
Returns:
the non-opaque model element behind the graphical editModel

getBasicClass

public java.lang.Class<M> getBasicClass()
Specified by:
getBasicClass in interface IClassExtension
Overrides:
getBasicClass in class ClassExtension<M extends org.eclipse.emf.common.notify.Notifier>

getCoModel

public java.lang.Object getCoModel(java.lang.Object model)
Description copied from interface: IRegime
Return the co-model of model if it has one.

Specified by:
getCoModel in interface IRegime
Parameters:
model - model
Returns:
co-model or null

getCoModelClass

public java.lang.Class<?> getCoModelClass()
Description copied from interface: IRegime
Return the co-model class if it has one.

Specified by:
getCoModelClass in interface IRegime
Returns:
co-model class or null

getCoModelParentClass

public java.lang.Class<?> getCoModelParentClass()
Description copied from interface: IRegime
Return the co-model parent class if it has one.

Specified by:
getCoModelParentClass in interface IRegime
Returns:
co-model parent class or null

getCoRegime

public abstract IRegimeCo0<?,?> getCoRegime()
Description copied from interface: IRegime
Return the co-regime if it has one.

Specified by:
getCoRegime in interface IRegime
Specified by:
getCoRegime in interface IRegimeCo0<M extends org.eclipse.emf.common.notify.Notifier,P>
Returns:
co-regime class or null

getFacets

public IFacet<? super M>[] getFacets()
Specified by:
getFacets in interface IRegimeCo0<M extends org.eclipse.emf.common.notify.Notifier,P>

getModelClass

public final java.lang.Class<M> getModelClass()
Description copied from interface: IRegime
Return the model class.

Specified by:
getModelClass in interface IRegime
Specified by:
getModelClass in interface IRegimeCo0<M extends org.eclipse.emf.common.notify.Notifier,P>
Returns:
model class

getNewNamePrefix

public java.lang.String getNewNamePrefix()
Description copied from interface: IRegime
Return a prefix for autogenerated names.

Specified by:
getNewNamePrefix in interface IRegime
Returns:
prefix

getParentModelClass

public final java.lang.Class<P> getParentModelClass()
Description copied from interface: IRegime
Return the class of the parent

Specified by:
getParentModelClass in interface IRegime
Specified by:
getParentModelClass in interface IRegimeCo0<M extends org.eclipse.emf.common.notify.Notifier,P>
Returns:
parent class

getSheetClass

public java.lang.Class<? extends GSheet> getSheetClass()
Description copied from interface: IRegime
Return the class of the sheet that this regime supports

Specified by:
getSheetClass in interface IRegime
Returns:
sheet class or null.

getSource

public java.lang.Object getSource(java.lang.Object model)
Description copied from interface: IRegime
Return the source node of model if it is a link.

Specified by:
getSource in interface IRegime
Parameters:
model - model
Returns:
this or null

getSourceModelClass

public java.lang.Class<?> getSourceModelClass()
Description copied from interface: IRegime
Return the class of source nodes if appropriate

Specified by:
getSourceModelClass in interface IRegime
Returns:
source node class or null

getTarget

public java.lang.Object getTarget(java.lang.Object model)
Description copied from interface: IRegime
Return the target node of model if it is a link.

Specified by:
getTarget in interface IRegime
Parameters:
model - model
Returns:
this or null

getTargetModelClass

public java.lang.Class<?> getTargetModelClass()
Description copied from interface: IRegime
Return the class of target nodes if appropriate

Specified by:
getTargetModelClass in interface IRegime
Returns:
target node class or null

initialise

public void initialise(IModelState rawState)

isLink

public ILinkRegimeCo0<?,M,?,P> isLink()
Specified by:
isLink in interface IRegimeCo0<M extends org.eclipse.emf.common.notify.Notifier,P>

isNode

public INodeRegimeCo0<M,P> isNode()
Specified by:
isNode in interface IRegimeCo0<M extends org.eclipse.emf.common.notify.Notifier,P>

isRegimeCo0

public IRegimeCo0<M,P> isRegimeCo0()
Description copied from interface: IRegime
Return this non-null regime if it is suitable for use with zero or more levels of co-model.

Specified by:
isRegimeCo0 in interface IRegime
Specified by:
isRegimeCo0 in interface IRegimeCo0<M extends org.eclipse.emf.common.notify.Notifier,P>
Returns:
this or null

isRegimeCo1

public IRegimeCo1<M,P,?,?> isRegimeCo1()
Description copied from interface: IRegime
Return this non-null regime if it is suitable for use with one or more levels of co-model.

Specified by:
isRegimeCo1 in interface IRegime
Specified by:
isRegimeCo1 in interface IRegimeCo0<M extends org.eclipse.emf.common.notify.Notifier,P>
Returns:
this or null

isRegimeCo2

public IRegimeCo2<M,P,?,?> isRegimeCo2()
Description copied from interface: IRegime
Return this non-null regime if it is suitable for use with two or more levels of co-model.

Specified by:
isRegimeCo2 in interface IRegime
Specified by:
isRegimeCo2 in interface IRegimeCo0<M extends org.eclipse.emf.common.notify.Notifier,P>
Returns:
this or null

refreshProblemMessage

public IProblemMessage<?> refreshProblemMessage(ActiveEditDomain domain,
                                                M model)
Description copied from interface: IRegimeCo0
Recompute and return the error message for model within domain.

Specified by:
refreshProblemMessage in interface IRegimeCo0<M extends org.eclipse.emf.common.notify.Notifier,P>
Returns:
the error message or null.

setCoModel

public void setCoModel(M model,
                       java.lang.Object coModel)
Specified by:
setCoModel in interface IRegimeCo0<M extends org.eclipse.emf.common.notify.Notifier,P>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object