|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.graphiti.features.impl.AbstractFeatureProvider
org.eclipse.graphiti.ui.features.DefaultFeatureProvider
org.eclipse.graphiti.pattern.DefaultFeatureProviderWithPatterns
public class DefaultFeatureProviderWithPatterns
The class DefaultFeatureProviderWithPatterns is the base class for a feature
provider that uses patterns. It is also possible to implement aspects of the
functionality triggered here using features by simply returning these
features here. In case of pattern-based functionality clients in general need
to implement nothing here, because the registered patterns (see
addPattern(IPattern)
and
addConnectionPattern(IConnectionPattern)
) delegate to the pattern
automatically.
Field Summary | |
---|---|
private List<IConnectionPattern> |
connectionPatters
|
private List<IPattern> |
patterns
|
Fields inherited from class org.eclipse.graphiti.features.impl.AbstractFeatureProvider |
---|
EMPTY_PICTOGRAM_ELEMENTS, NO_OBJECTS |
Constructor Summary | |
---|---|
DefaultFeatureProviderWithPatterns(IDiagramTypeProvider dtp)
Creates a new instance of DefaultFeatureProviderWithPatterns . |
Method Summary | |
---|---|
void |
activateDirectEditingForPatterns(PictogramElement mainPictogramElement,
Object domainObject)
Convenience method to activate the direct editing for the given PictogramElement and domain object. |
void |
activateDirectEditingForPatterns(PictogramElement mainPictogramElement,
Object domainObject,
String keyProperty)
Convenience method to activate the direct editing for the given PictogramElement and domain object. |
void |
addConnectionPattern(IConnectionPattern pattern)
Adds a pattern defined to handle connections to the list of registered patterns. |
void |
addPattern(IPattern pattern)
Adds a pattern defined to handle shapes to the list of registered patterns. |
protected boolean |
checkFeatureAndContext(IFeature feature,
IContext context)
Checks if a feature along with its context is available. |
protected boolean |
checkPattern(IPattern pattern,
Object object)
Checks the given pattern if it can deal with the given domain object. |
IAddFeature |
getAddFeature(IAddContext context)
Tries to retrieve an add feature suiting the given add context from the registered patterns. |
protected IAddFeature |
getAddFeatureAdditional(IAddContext context)
Gets the additional add feature functionality. |
Object |
getBusinessObjectForPictogramElement(PictogramElement pictogramElement)
Helper method to find the domain object for a given PictogramElement . |
protected List<IConnectionPattern> |
getConnectionPatterns()
Returns a new list of the registered patterns that deal with sonnection inside this feature provider. |
ICreateConnectionFeature[] |
getCreateConnectionFeatures()
Retrieves an array of create connection features that are available from the registered patterns and the super class of this feature provider. |
protected ICreateConnectionFeature[] |
getCreateConnectionFeaturesAdditional()
Gets the additional create connection feature functionality. |
ICreateFeature[] |
getCreateFeatures()
Retrieves an array of create features that are available from the registered patterns and the super class of this feature provider. |
protected ICreateFeature[] |
getCreateFeaturesAdditional()
Gets the additional create feature functionality. |
IDeleteFeature |
getDeleteFeature(IDeleteContext context)
Tries to retrieve a delete feature suiting the given delete context from the registered patterns. |
protected IDeleteFeature |
getDeleteFeatureAdditional(IDeleteContext context)
Gets the additional delete feature functionality. |
IDirectEditingFeature |
getDirectEditingFeature(IDirectEditingContext context)
Tries to retrieve a direct editing feature suiting the given direct editing context from the registered patterns. |
protected IDirectEditingFeature |
getDirectEditingFeatureAdditional(IDirectEditingContext context)
Gets the additional direct editing feature functionality. |
ILayoutFeature |
getLayoutFeature(ILayoutContext context)
Tries to retrieve a layout feature suiting the given layout context from the registered patterns. |
protected ILayoutFeature |
getLayoutFeatureAdditional(ILayoutContext context)
Gets the additional layout feature functionality. |
IMoveShapeFeature |
getMoveShapeFeature(IMoveShapeContext context)
Tries to retrieve a move feature for shapes suiting the given move context from the registered patterns. |
protected IMoveShapeFeature |
getMoveShapeFeatureAdditional(IMoveShapeContext context)
Gets the additional move feature functionality for shapes. |
IPattern |
getPatternForPictogramElement(PictogramElement pe)
Gets the pattern for pictogram element. |
protected List<IPattern> |
getPatterns()
Returns a new list of the registered patterns that deal with shapes inside this feature provider. |
IRemoveFeature |
getRemoveFeature(IRemoveContext context)
Tries to retrieve a remove feature suiting the given remove context from the registered patterns. |
protected IRemoveFeature |
getRemoveFeatureAdditional(IRemoveContext context)
Gets the additional remove feature functionality. |
IResizeShapeFeature |
getResizeShapeFeature(IResizeShapeContext context)
Tries to retrieve a resize feature for shapes suiting the given resize context from the registered patterns. |
protected IResizeShapeFeature |
getResizeShapeFeatureAdditional(IResizeShapeContext context)
Gets the additional resize feature functionality for shapes. |
IUpdateFeature |
getUpdateFeature(IUpdateContext context)
Tries to retrieve an update feature suiting the given update context from the registered patterns. |
protected IUpdateFeature |
getUpdateFeatureAdditional(IUpdateContext context)
Gets the additional update feature functionality. |
protected void |
traceWarning(String string,
IPattern pattern,
IPattern choosenPattern)
Helper method to trace warnings when more than one pattern is executed. |
Methods inherited from class org.eclipse.graphiti.ui.features.DefaultFeatureProvider |
---|
getAddBendpointFeature, getCopyFeature, getCustomFeatures, getMoveAnchorFeature, getMoveBendpointFeature, getMoveConnectionDecoratorFeature, getPasteFeature, getPrintFeature, getRemoveBendpointFeature, getSaveImageFeature |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private List<IPattern> patterns
private List<IConnectionPattern> connectionPatters
Constructor Detail |
---|
public DefaultFeatureProviderWithPatterns(IDiagramTypeProvider dtp)
DefaultFeatureProviderWithPatterns
.
This is usually done from the diagram type provider.
dtp
- The diagram type provider associated with this feature
provider.Method Detail |
---|
public void addPattern(IPattern pattern)
addConnectionPattern(IConnectionPattern)
. The pattern must not
be null
, or a IllegalArgumentException
will be
thrown.
addPattern
in interface IPatternContainer
pattern
- The Pattern to addpublic void addConnectionPattern(IConnectionPattern pattern)
addPattern(IPattern)
. The pattern must not be null
,
or a IllegalArgumentException
will be thrown.
pattern
- The Pattern to addprotected List<IPattern> getPatterns()
List
of the registered shape-based patterns.protected List<IConnectionPattern> getConnectionPatterns()
List
of the registered connection-based patterns.protected boolean checkFeatureAndContext(IFeature feature, IContext context)
IFeature.isAvailable(IContext)
method.
feature
- The feature to checkcontext
- The according context
true
, if the feature is available,
false
otherwise.public IAddFeature getAddFeature(IAddContext context)
getAddFeatureAdditional(IAddContext)
).
getAddFeature
in interface IFeatureProvider
getAddFeature
in class AbstractFeatureProvider
context
- An IAddContext
describing the needed functionality
IAddFeature
in case a suitable functionality has been
found, null
otherwise.IAddFeature
protected IAddFeature getAddFeatureAdditional(IAddContext context)
AbstractFeatureProvider.getAddFeature(IAddContext)
.
context
- An IAddContext
describing the needed functionality
IAddFeature
in case a suitable functionality has been
found by the super class, null
otherwise.public ICreateFeature[] getCreateFeatures()
getCreateConnectionFeaturesAdditional()
).
getCreateFeatures
in interface IFeatureProvider
getCreateFeatures
in class AbstractFeatureProvider
ICreateFeature
s in case a suitable
functionality has been found, an empty array otherwise.ICreateFeature
protected ICreateFeature[] getCreateFeaturesAdditional()
AbstractFeatureProvider.getCreateFeatures()
.
ICreateFeature
s in case a suitable
functionality has been found by the super class, an empty array
otherwise.public IDeleteFeature getDeleteFeature(IDeleteContext context)
getDeleteFeatureAdditional(IDeleteContext)
).
getDeleteFeature
in interface IFeatureProvider
getDeleteFeature
in class DefaultFeatureProvider
context
- An IDeleteContext
describing the needed functionality
IDeleteFeature
in case a suitable functionality has
been found, null
otherwise.IDeleteFeature
protected IDeleteFeature getDeleteFeatureAdditional(IDeleteContext context)
DefaultFeatureProvider.getDeleteFeature(IDeleteContext)
.
context
- An IDeleteContext
describing the needed functionality
IDeleteFeature
in case a suitable functionality has
been found by the super class, null
otherwise.public IRemoveFeature getRemoveFeature(IRemoveContext context)
getRemoveFeatureAdditional(IRemoveContext)
).
getRemoveFeature
in interface IFeatureProvider
getRemoveFeature
in class DefaultFeatureProvider
context
- An IRemoveContext
describing the needed functionality
IRemoveFeature
in case a suitable functionality has
been found, null
otherwise.IRemoveFeature
protected IRemoveFeature getRemoveFeatureAdditional(IRemoveContext context)
DefaultFeatureProvider.getRemoveFeature(IRemoveContext)
.
context
- An IRemoveContext
describing the needed functionality
IRemoveFeature
in case a suitable functionality has
been found by the super class, null
otherwise.public ILayoutFeature getLayoutFeature(ILayoutContext context)
getLayoutFeatureAdditional(ILayoutContext)
).
getLayoutFeature
in interface IFeatureProvider
getLayoutFeature
in class AbstractFeatureProvider
context
- An ILayoutContext
describing the needed functionality
ILayoutFeature
in case a suitable functionality has
been found, null
otherwise.ILayoutFeature
protected ILayoutFeature getLayoutFeatureAdditional(ILayoutContext context)
AbstractFeatureProvider.getLayoutFeature(ILayoutContext)
.
context
- An ILayoutContext
describing the needed functionality
ILayoutFeature
in case a suitable functionality has
been found by the super class, null
otherwise.public IMoveShapeFeature getMoveShapeFeature(IMoveShapeContext context)
getMoveShapeFeatureAdditional(IMoveShapeContext)
).
getMoveShapeFeature
in interface IFeatureProvider
getMoveShapeFeature
in class DefaultFeatureProvider
context
- An IMoveShapeContext
describing the needed
functionality
IMoveShapeFeature
in case a suitable functionality has
been found, null
otherwise.IMoveShapeFeature
protected IMoveShapeFeature getMoveShapeFeatureAdditional(IMoveShapeContext context)
DefaultFeatureProvider.getMoveShapeFeature(IMoveShapeContext)
.
context
- An IMoveShapeContext
describing the needed
functionality
IMoveShapeFeature
in case a suitable functionality has
been found by the super class, null
otherwise.public IResizeShapeFeature getResizeShapeFeature(IResizeShapeContext context)
getResizeShapeFeatureAdditional(IResizeShapeContext)
).
getResizeShapeFeature
in interface IFeatureProvider
getResizeShapeFeature
in class DefaultFeatureProvider
context
- An IResizeShapeContext
describing the needed
functionality
IResizeShapeFeature
in case a suitable functionality
has been found, null
otherwise.IResizeShapeFeature
protected boolean checkPattern(IPattern pattern, Object object)
IPattern.isMainBusinessObjectApplicable(Object)
method.
pattern
- The pattern to checkobject
- The domain object
true
, if the pattern can handle the domain object,
false
otherwise.protected IResizeShapeFeature getResizeShapeFeatureAdditional(IResizeShapeContext context)
DefaultFeatureProvider.getResizeShapeFeature(IResizeShapeContext)
.
context
- An IResizeShapeContext
describing the needed
functionality
IResizeShapeFeature
in case a suitable functionality
has been found by the super class, null
otherwise.public IUpdateFeature getUpdateFeature(IUpdateContext context)
getUpdateFeatureAdditional(IUpdateContext)
).
getUpdateFeature
in interface IFeatureProvider
getUpdateFeature
in class DefaultFeatureProvider
context
- An IUpdateContext
describing the needed functionality
IUpdateFeature
in case a suitable functionality has
been found, null
otherwise.IUpdateFeature
protected IUpdateFeature getUpdateFeatureAdditional(IUpdateContext context)
DefaultFeatureProvider.getUpdateFeature(IUpdateContext)
.
context
- An IUpdateContext
describing the needed functionality
IUpdateFeature
in case a suitable functionality has
been found by the super class, null
otherwise.public IPattern getPatternForPictogramElement(PictogramElement pe)
IFeatureProviderWithPatterns
getPatternForPictogramElement
in interface IFeatureProviderWithPatterns
pe
- the pictogram element
public void activateDirectEditingForPatterns(PictogramElement mainPictogramElement, Object domainObject)
PictogramElement
and domain object. The default implementation
tries to retrieve the direct editing functionality from the registered
patterns for shapes.
activateDirectEditingForPatterns
in interface IFeatureProviderWithPatterns
mainPictogramElement
- The root PictogramElement
for which direct editing
shall be triggered. This pictogram element is used to find a
suitable pattern for this request via
AbstractPattern.isPatternRoot(PictogramElement)
.domainObject
- The domain object behind the direct editing request. This
object is passed to the IDirectEditingInfo
.public void activateDirectEditingForPatterns(PictogramElement mainPictogramElement, Object domainObject, String keyProperty)
PictogramElement
and domain object. The default implementation
tries to retrieve the direct editing functionality from the registered
patterns for shapes.
activateDirectEditingForPatterns
in interface IFeatureProviderWithPatterns
mainPictogramElement
- The root PictogramElement
for which direct editing
shall be triggered. This pictogram element is used to find a
suitable pattern for this request via
AbstractPattern.isPatternRoot(PictogramElement)
.domainObject
- The domain object behind the direct editing request. This
object is passed to the IDirectEditingInfo
.keyProperty
- An additional key property that is passed to the
IDirectEditingInfo
.public ICreateConnectionFeature[] getCreateConnectionFeatures()
getCreateConnectionFeaturesAdditional()
).
getCreateConnectionFeatures
in interface IFeatureProvider
getCreateConnectionFeatures
in class AbstractFeatureProvider
ICreateConnectionFeature
s in case a suitable
functionality has been found, an empty array otherwise.ICreateConnectionFeature
protected ICreateConnectionFeature[] getCreateConnectionFeaturesAdditional()
AbstractFeatureProvider.getCreateConnectionFeatures()
.
ICreateConnectionFeature
s in case a suitable
functionality has been found by the super class, an empty array
otherwise.public IDirectEditingFeature getDirectEditingFeature(IDirectEditingContext context)
getDirectEditingFeatureAdditional(IDirectEditingContext)
).
getDirectEditingFeature
in interface IFeatureProvider
getDirectEditingFeature
in class AbstractFeatureProvider
context
- An IDirectEditingContext
describing the needed
functionality
IDirectEditingFeature
in case a suitable functionality
has been found, null
otherwise.IDirectEditingFeature
protected IDirectEditingFeature getDirectEditingFeatureAdditional(IDirectEditingContext context)
AbstractFeatureProvider.getDirectEditingFeature(IDirectEditingContext)
.
context
- An IDirectEditingContext
describing the needed
functionality
IDirectEditingFeature
in case a suitable functionality
has been found by the super class, null
otherwise.protected void traceWarning(String string, IPattern pattern, IPattern choosenPattern)
string
- The string information to tracepattern
- The patternchoosenPattern
- The additionally chosen patternpublic Object getBusinessObjectForPictogramElement(PictogramElement pictogramElement)
PictogramElement
. The default implementation first delegates to
AbstractFeatureProvider.getBusinessObjectForPictogramElement(PictogramElement)
and then directly tries to follow an eventually set link property, see
ILinkService.setLinkProperty(PictogramElement, String)
.
getBusinessObjectForPictogramElement
in interface IMappingProvider
getBusinessObjectForPictogramElement
in class AbstractFeatureProvider
pictogramElement
- The PictogramElement
to find the domain object for.
null
otherwise.IMappingProvider.link(PictogramElement, Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |