|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.emf.common.notify.impl.AdapterImpl
org.eclipse.emf.edit.provider.ItemProviderAdapter
This adapter implementation provides a convenient reusable base for
adapters that will be used as item providers.
Default implementations for the following interfaces are provided:
IItemLabelProvider
, IItemPropertySource
,
IStructuredItemContentProvider
,
ITreeItemContentProvider
, and IEditingDomainItemProvider
.
Also, IUpdateableItemText.getUpdateableText(java.lang.Object)
is implemented to delegate to getText(java.lang.Object)
;
often the editable text will be just the text, in which case this is a good default implementation.
Nested Class Summary | |
protected static class |
ItemProviderAdapter.ChildrenStore
A ChildrenStore stores a number of objects that are to be presented as the children of an object.
|
protected static class |
ItemProviderAdapter.ModifiableSingletonEList
A single-element implementation of EList . |
class |
ItemProviderAdapter.ResultAndAffectedObjectsWrappingCommand
A ResultAndAffectedObjectsWrappingCommand wraps another command to substitute IWrapperItemProvider s for their values in the command's result and affected objects. |
class |
ItemProviderAdapter.ResultAndAffectedObjectsWrappingCommandActionDelegate
A ResultAndAffectedObjectsWrappingCommandActionDelegate wraps another command that also implements
CommandActionDelegate , to substitute IWrapperItemProvider s for its values, which have been
unwrapped for the command to operate on properly. |
Nested classes inherited from class org.eclipse.emf.common.notify.Adapter |
Adapter.Internal |
Field Summary | |
protected AdapterFactory |
adapterFactory
This keeps track of the adapter factory that created this adaptor. |
protected IChangeNotifier |
changeNotifier
This is used to implement IChangeNotifier . |
protected List |
childrenFeatures
This is used to store all the children features. |
protected List |
childrenReferences
Deprecated. As of EMF 2.0, replaced by childrenFeatures . |
protected Map |
childrenStoreMap
When ItemProviderAdapter.ChildrenStore s are to be used to cache children (typically to hold wrappers for non-EObject
children), this maps adapted objects to their corresponding stores. |
protected List |
itemPropertyDescriptors
This is used to store all the property descriptors. |
protected List |
targets
This keeps track of all the targets to which this adapter is set. |
protected Disposable |
wrappers
This holds children wrappers that are created by this item provider, so that they can be disposed with it. |
protected Boolean |
wrappingNeeded
This caches the result returned by isWrappingNeeded so that it need not be recomputed
each time. |
Fields inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl |
target |
Constructor Summary | |
ItemProviderAdapter(AdapterFactory adapterFactory)
An instance is created from an adapter factory. |
Method Summary | |
void |
addListener(INotifyChangedListener listener)
This adds another listener. |
protected void |
adjustWrapperIndex(Object object,
int increment)
If the given object implements IWrapperItemProvider and specifies an index, that index is adjusted by the
given increment. |
protected void |
adjustWrapperIndices(List objects,
int from,
int increment)
For each element of the given list, starting at from , that implements IWrapperItemProvider
and specifies an index, that index is adjusted by the given increment. |
protected void |
adjustWrapperIndices(List objects,
int from,
int to,
int increment)
For each element of the given list, between from and to , that implements IWrapperItemProvider and specifies an index, that index is adjusted by the given increment. |
protected void |
collectNewChildDescriptors(Collection newChildDescriptors,
Object object)
This adds to newChildDescriptors , a collection of CommandParameter s, parameters for
possible children of the specified object , when viewed as
an instance of the type for which this is an item provider. |
protected Command |
createAddCommand(EditingDomain domain,
EObject owner,
EReference feature,
Collection collection,
int index)
Deprecated. As of EMF 2.0, replaced by createAddCommand . |
protected Command |
createAddCommand(EditingDomain domain,
EObject owner,
EStructuralFeature feature,
Collection collection,
int index)
This creates a primitive AddCommand . |
protected CommandParameter |
createChildParameter(Object feature,
Object child)
This is a convenience method that creates a CommandParameter
for a given parent feature and child object. |
protected ItemProviderAdapter.ChildrenStore |
createChildrenStore(Object object)
Consults isWrappingNeeded to decide whether to create a store for the children of the
given object. |
Command |
createCommand(Object object,
EditingDomain domain,
Class commandClass,
CommandParameter commandParameter)
This implements delegated command creation for the given object. |
protected Command |
createCopyCommand(EditingDomain domain,
EObject owner,
CopyCommand.Helper helper)
This creates a primitive CopyCommand . |
protected Command |
createCreateChildCommand(EditingDomain domain,
EObject owner,
EReference feature,
EObject value,
int index,
Collection collection)
Deprecated. As of EMF 2.0, replaced by createCreateChildCommand . |
protected Command |
createCreateChildCommand(EditingDomain domain,
EObject owner,
EStructuralFeature feature,
Object value,
int index,
Collection collection)
This creates a primitive CreateChildCommand . |
protected Command |
createCreateCopyCommand(EditingDomain domain,
EObject owner,
CopyCommand.Helper helper)
This creates a primitive CreateCopyCommand . |
protected Command |
createDragAndDropCommand(EditingDomain domain,
Object owner,
float location,
int operations,
int operation,
Collection collection)
This creates a primitive DragAndDropCommand . |
protected Command |
createInitializeCopyCommand(EditingDomain domain,
EObject owner,
CopyCommand.Helper helper)
This creates a primitive InitializeCopyCommand . |
protected ItemPropertyDescriptor |
createItemPropertyDescriptor(AdapterFactory adapterFactory,
ResourceLocator resourceLocator,
String displayName,
String description,
EStructuralFeature feature,
boolean isSettable,
boolean multiLine,
boolean sortChoices,
Object staticImage,
String category,
String[] filterFlags)
Creates an instance that uses a resource locator; indicates whether to be mutli-line and to sort choices; specifies a static image, a category, and filter flags; and determines the cell editor from the type of the structural feature. |
protected ItemPropertyDescriptor |
createItemPropertyDescriptor(AdapterFactory adapterFactory,
ResourceLocator resourceLocator,
String displayName,
String description,
EStructuralFeature feature,
boolean isSettable,
Object staticImage,
String category,
String[] filterFlags)
This creates an item provider descriptor that uses a resource locator; specifies a static image, a category, and filter flags; and determines the cell editor from the type of the structural feature. |
protected Command |
createMoveCommand(EditingDomain domain,
EObject owner,
EReference feature,
EObject value,
int index)
Deprecated. As of EMF 2.0, replaced by createMoveCommand . |
protected Command |
createMoveCommand(EditingDomain domain,
EObject owner,
EStructuralFeature feature,
Object value,
int index)
This creates a primitive MoveCommand . |
protected Command |
createRemoveCommand(EditingDomain domain,
EObject owner,
EReference feature,
Collection collection)
Deprecated. As of EMF 2.0, replaced by createRemoveCommand . |
protected Command |
createRemoveCommand(EditingDomain domain,
EObject owner,
EStructuralFeature feature,
Collection collection)
This creates a primitive RemoveCommand . |
protected Command |
createReplaceCommand(EditingDomain domain,
EObject owner,
EReference feature,
EObject value,
Collection collection)
Deprecated. As of EMF 2.0, replaced by createReplaceCommand . |
protected Command |
createReplaceCommand(EditingDomain domain,
EObject owner,
EStructuralFeature feature,
EObject value,
Collection collection)
This creates a primitive ReplaceCommand . |
protected Command |
createSetCommand(EditingDomain domain,
EObject owner,
EStructuralFeature feature,
Object value)
This returned a primitive SetCommand , but it has been replaced, since this
command can now take an index. |
protected Command |
createSetCommand(EditingDomain domain,
EObject owner,
EStructuralFeature feature,
Object value,
int index)
This creates a primitive SetCommand . |
protected Object |
createWrapper(EObject object,
EStructuralFeature feature,
Object value,
int index)
Creates and returns a wrapper for the given value, at the given index in the given feature of the given object if such a wrapper is needed; otherwise, returns the original value. |
String |
crop(String text)
This crops the given text to exclude any control characters. |
void |
dispose()
This will remove this adapter from all its the targets and dispose any remainging children wrappers in the children store. |
protected void |
disposeWrapper(Object object)
If the given object implements IWrapperItemProvider , it is disposed by calling dispose . |
protected void |
disposeWrappers(List objects)
Each element of the given list that implements IWrapperItemProvider is disposed by calling
IWrapperItemProvider#dispose dispose} and is removed from wrappers . |
protected Command |
factorAddCommand(EditingDomain domain,
CommandParameter commandParameter)
This method factors an AddCommand for a collection of objects
into one or more primitive add command,
i.e., one per unique feature. |
protected Command |
factorMoveCommand(EditingDomain domain,
CommandParameter commandParameter)
This method factors a MoveCommand to determine the feature. |
protected Command |
factorRemoveCommand(EditingDomain domain,
CommandParameter commandParameter)
This method factors a RemoveCommand for a collection of objects
into one or more primitive remove commands,
i.e., one per unique feature. |
void |
fireNotifyChanged(Notification notification)
This convenience method converts the arguments into an appropriate update call on the viewer. |
AdapterFactory |
getAdapterFactory()
This provides access to the factory. |
URL |
getBaseURL()
Get the base URL from the resource locator. |
protected EStructuralFeature |
getChildFeature(Object object,
Object child)
This returns the most appropriate feature of the object into which the given child could be added. |
protected EReference |
getChildReference(Object object,
Object child)
Deprecated. As of EMF 2.0, replaced by getChildFeature . |
Collection |
getChildren(Object object)
This implements ITreeItemContentProvider.getChildren . |
protected Collection |
getChildrenFeatures(Object object)
If this is defined to be something other than an empty list, it is used to implement getChildren , including in determining whether to cache children and, if so, in setting up the store. |
protected Collection |
getChildrenReferences(Object object)
Deprecated. As of EMF 2.0, replaced by getChildrenFeatures . |
protected ItemProviderAdapter.ChildrenStore |
getChildrenStore(Object object)
Returns the store for the children of the given object, or null if no such store is being maintained. |
String |
getCreateChildDescription(Object owner,
Object feature,
Object child,
Collection selection)
This returns the description for CreateChildCommand . |
Object |
getCreateChildImage(Object owner,
Object feature,
Object child,
Collection selection)
This returns the icon image for CreateChildCommand . |
Collection |
getCreateChildResult(Object child)
This returns the result collection for CreateChildCommand . |
String |
getCreateChildText(Object owner,
Object feature,
Object child,
Collection selection)
This returns the label for CreateChildCommand . |
String |
getCreateChildToolTipText(Object owner,
Object feature,
Object child,
Collection selection)
This returns the tool tip text for CreateChildCommand . |
Object |
getEditableValue(Object object)
This implements IItemPropertySource.getEditableValue
by simply returning the object itself. |
Collection |
getElements(Object object)
This implements IStructuredItemContentProvider.getElements
by forwarding the call to getChildren .
|
protected String |
getFeatureText(Object feature)
This looks up the name of the specified feature. |
protected Object |
getFeatureValue(EObject object,
EStructuralFeature feature)
This method is called by factorRemoveCommand to retrieve the children objects of the
features returned from getChildrenFeatures . |
Object |
getImage(Object object)
This implements IItemLabelProvider.getImage by returning null.
|
Object |
getImage(String key)
Get an image from the resource locator. |
Collection |
getNewChildDescriptors(Object object,
EditingDomain editingDomain,
Object sibling)
This implements IEditingDomainItemProvider.getNewChildDescriptors , returning CommandParameter s to describe all the possible children that can be added to the
specified object .
|
Object |
getParent(Object object)
This implements ITreeItemContentProvider.getParent by returning the EMF object's
container. |
IItemPropertyDescriptor |
getPropertyDescriptor(Object object,
Object propertyId)
This convenience method finds a particular descriptor given its property name. |
List |
getPropertyDescriptors(Object object)
This implements IItemPropertySource.getPropertyDescriptors
by returning the locally stored vector of descriptors.
|
Object |
getPropertyValue(Object object,
String property)
This implements a PropertySource by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor interface |
protected Object |
getReferenceValue(EObject object,
EReference reference)
Deprecated. As of EMF 2.0, replaced by getFeatureValue . |
protected ResourceLocator |
getResourceLocator()
Get the resource locator for this adapter's resources. |
protected ResourceLocator |
getResourceLocator(Object anyObject)
Get the resource locator from the adapter of the object, if possible. |
protected AdapterFactory |
getRootAdapterFactory()
Gets the root factory if this local adapter factory is composed, otherwise just the local one. |
protected EStructuralFeature |
getSetFeature(Object object,
Object value)
This returns the most appropriate feature of the object into which the value be set. |
protected Collection |
getSetFeatures(Object object)
If this is defined to be something other than an empty list, it is used to implement getSetFeature
and to deduce the EMF feature in the SetCommand createCommand .
|
String |
getString(String key)
Get a translated string from the resource locator. |
String |
getString(String key,
boolean translate)
Get a translated string from the resource locator. |
String |
getString(String key,
Object[] substitutions)
Get a translated string from the resource locator, with substitutions. |
String |
getString(String key,
Object[] substitutions,
boolean translate)
Get a translated string from the resource locator, with substitutions. |
protected String |
getString(String key,
String s0)
Get a translated string from the resource locator, substituting another such translated string. |
protected String |
getString(String key,
String s0,
boolean translate)
Get a translated string from the resource locator, substituting another such translated string. |
protected String |
getString(String key,
String s0,
String s1)
Get a translated string from the resource locator, substituting two other such translated strings. |
protected String |
getString(String key,
String s0,
String s1,
boolean translate)
Get a translated string from the resource locator, substituting two other such translated strings. |
String |
getText(Object object)
This implements IItemLabelProvider.getText by simply calling toString on the argument.
|
protected String |
getTypeText(EAttribute attribute)
This looks up the name of the type of the specified attribute. |
protected String |
getTypeText(Object object)
This looks up the name of the type of the specified object. |
String |
getUpdateableText(Object object)
This implements IUpdateableItemText.getUpdateableText
by simply calling getText(java.lang.Object) .
|
protected Collection |
getWrappedValues(CommandParameter commandParameter)
Returns a collection of any objects in the given command parameter's collection and value , that implement IWrapperItemProvider . |
boolean |
hasChildren(Object object)
This implements ITreeItemContentProvider.hasChildren
by simply testing whether getChildren returns any children.
|
boolean |
isAdapterForType(Object type)
The adapter factory is used as the type key. |
protected boolean |
isEquivalentValue(Object value,
Object referenceValue)
Returns whether the given value is to be considered equivalent to the given reference value. |
boolean |
isPropertySet(Object object,
String property)
This implements PropertySource by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor interface |
protected boolean |
isWrappingNeeded(Object object)
Returns whether this item provider may need to use wrappers for some or all of the values it returns as children . |
protected Object |
overlayImage(Object object,
Object image)
This adds an overlay to the given image if the object is controlled. |
void |
removeListener(INotifyChangedListener listener)
This removes a listener. |
void |
resetPropertyValue(Object object,
String property)
This implements PropertySource.resetPropertyValue by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor interface |
void |
setPropertyValue(Object object,
String property,
Object value)
This implements PropertySource by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor interface |
void |
setTarget(Notifier target)
Sets the target from which the adapter will receive notification. |
protected boolean |
shouldTranslate()
Indicates whether strings should be translated by default. |
void |
unsetTarget(Notifier target)
Unsets the target from which the adapter will receive notification. |
protected Object |
unwrap(Object object)
If the given object implements IWrapperItemProvider , it is unwrapped by obtaining a value from getValue . |
protected CommandParameter |
unwrapCommandValues(CommandParameter commandParameter,
Class commandClass)
If the given command parameter contains wrapped values that need to be unwrapped for the given command class to operate on, a new command parameter will be returned, with those values unwrapped; otherwise, the original one is returned. |
protected void |
updateChildren(Notification notification)
Updates any cached children based on the given notification. |
protected Object |
wrap(EObject object,
EStructuralFeature feature,
Object value,
int index)
Wraps a value, if needed, and keeps the wrapper for disposal along with the item provider. |
protected Command |
wrapCommand(Command command,
Object object,
Class commandClass,
CommandParameter commandParameter,
CommandParameter oldCommandParameter)
Returns a version of the given command that automatically re-wraps values that have been unwrapped when returning them as the command's result or affected objects. |
Methods inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl |
getTarget, notifyChanged |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected AdapterFactory adapterFactory
protected List itemPropertyDescriptors
protected List childrenFeatures
protected List childrenReferences
childrenFeatures
.
protected IChangeNotifier changeNotifier
IChangeNotifier
.
protected List targets
protected Map childrenStoreMap
ItemProviderAdapter.ChildrenStore
s are to be used to cache children (typically to hold wrappers for non-EObject
children), this maps adapted objects to their corresponding stores. Stores should be accessed and created
via getChildrenStore
and createChildrenStore
.
protected Disposable wrappers
created
by this item provider, so that they can be disposed
with it.
protected Boolean wrappingNeeded
isWrappingNeeded
so that it need not be recomputed
each time.
Constructor Detail |
public ItemProviderAdapter(AdapterFactory adapterFactory)
Method Detail |
public boolean isAdapterForType(Object type)
isAdapterForType
in interface Adapter
isAdapterForType
in class AdapterImpl
type
- the type.
false
public AdapterFactory getAdapterFactory()
public void addListener(INotifyChangedListener listener)
IChangeNotifier
addListener
in interface IChangeNotifier
public void removeListener(INotifyChangedListener listener)
IChangeNotifier
removeListener
in interface IChangeNotifier
public void fireNotifyChanged(Notification notification)
Notifier
.
fireNotifyChanged
in interface IChangeNotifier
public Object getEditableValue(Object object)
IItemPropertySource.getEditableValue
by simply returning the object itself.
public List getPropertyDescriptors(Object object)
IItemPropertySource.getPropertyDescriptors
by returning the locally stored vector of descriptors.
This vector could be populated in the constructor of a derived class
but it's probably more efficient to create them only on demand by overriding this method.
You'll probably want to call super.getPropertyDescriptors if you do this,
since you may have one adapter derive from another.
public IItemPropertyDescriptor getPropertyDescriptor(Object object, Object propertyId)
public Object getPropertyValue(Object object, String property)
public boolean isPropertySet(Object object, String property)
public void resetPropertyValue(Object object, String property)
public void setPropertyValue(Object object, String property, Object value)
public Collection getElements(Object object)
IStructuredItemContentProvider.getElements
by forwarding the call to getChildren
.
It seems that you almost always want getElements and getChildren to return the same thing, so this makes that easy.
public Collection getChildren(Object object)
ITreeItemContentProvider.getChildren
. If children are
already cached in a ItemProviderAdapter.ChildrenStore
, they are returned. Otherwise, children are collected from the features
returned by getChildrenFeatures
. The collected children may or may not be cached,
depending on the result of createChildrenStore
; by default, no store is returned if
getChildrenFeatures
returns only containment references. All children are optionally
wrapped
before being cached and returned. Subclasses may override createWrapper
to specify when and with what to wrap children.
public boolean hasChildren(Object object)
ITreeItemContentProvider.hasChildren
by simply testing whether getChildren
returns any children.
This implementation will always be right, however, for efficiency you may want to override it to return false
or to compute the result in some other efficient way.
protected Collection getChildrenFeatures(Object object)
getChildren
, including in determining whether to cache children and, if so, in setting up the store. It is also
used to deduce the appropriate feature for an AddCommand
, RemoveCommand
or
MoveCommand
in createCommand
. If you override those methods, then you don't
need to implement this.
protected Collection getChildrenReferences(Object object)
getChildrenFeatures
.
protected Object getFeatureValue(EObject object, EStructuralFeature feature)
factorRemoveCommand
to retrieve the children objects of the
features returned from getChildrenFeatures
. For references, this default
implementation calls the deprecated getReferenceValue
to provide backwards
compatibility.
protected Object getReferenceValue(EObject object, EReference reference)
getFeatureValue
.
protected EStructuralFeature getChildFeature(Object object, Object child)
getChildReference
, for backwards
compatibility. If that does not yield a non-null result, it returns the first feature returned by getChildrenFeatures
that has a type compatible with the child. You can override this to
return a better result or to compute it more efficiently.
protected EReference getChildReference(Object object, Object child)
getChildFeature
.
protected Collection getSetFeatures(Object object)
getSetFeature
and to deduce the EMF feature in the SetCommand createCommand
.
If you override those, then you don't need to implement this.
protected EStructuralFeature getSetFeature(Object object, Object value)
getSetFeatures
that has a type compatible with the value.
You can override this to return a better result or to compute it more efficiently.
public Object getParent(Object object)
ITreeItemContentProvider.getParent
by returning the EMF object's
container. This is used by certain commands to find an owner, where
none is specified, and by the viewers, when trying to locate an
arbitrary object within the view (i.e. during select and reveal
operation).
public Object getImage(Object object)
IItemLabelProvider.getImage
by returning null.
Most things really should have an icon, but not having one is technically correct too.
protected Object overlayImage(Object object, Object image)
public String getText(Object object)
IItemLabelProvider.getText
by simply calling toString on the argument.
This will often be correct as is.
public String getUpdateableText(Object object)
IUpdateableItemText.getUpdateableText
by simply calling getText(java.lang.Object)
.
This will often be correct as is.
public String crop(String text)
public Collection getNewChildDescriptors(Object object, EditingDomain editingDomain, Object sibling)
IEditingDomainItemProvider.getNewChildDescriptors
, returning CommandParameter
s to describe all the possible children that can be added to the
specified object
.
This implementation invokes collectNewChildDescriptors
, which should be
overridden by derived classes, to build this collection.
If sibling
is non-null, an index
is added to each CommandParameter
with
a multi-valued feature
, to ensure that the new child object gets added in the right position.
protected boolean isEquivalentValue(Object value, Object referenceValue)
protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object)
newChildDescriptors
, a collection of CommandParameter
s, parameters for
possible children of the specified object
, when viewed as
an instance of the type for which this is an item provider. This
implementation adds nothing to the collection, but derived classes
should override this method, invoking the superclass implementation and
then adding to the collection.
public Command createCommand(Object object, EditingDomain domain, Class commandClass, CommandParameter commandParameter)
protected Command createSetCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, Object value, int index)
SetCommand
.
protected Command createSetCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, Object value)
SetCommand
, but it has been replaced, since this
command can now take an index. The replacement method still calls this method when invoked with no index
, to provide backwards compatibility.
This method will soon be deprecated. New code should use or override the new form
, instead.
protected Command createCopyCommand(EditingDomain domain, EObject owner, CopyCommand.Helper helper)
CopyCommand
.
protected Command createCreateCopyCommand(EditingDomain domain, EObject owner, CopyCommand.Helper helper)
CreateCopyCommand
.
protected Command createInitializeCopyCommand(EditingDomain domain, EObject owner, CopyCommand.Helper helper)
InitializeCopyCommand
.
protected Command createRemoveCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, Collection collection)
RemoveCommand
.
protected Command createRemoveCommand(EditingDomain domain, EObject owner, EReference feature, Collection collection)
createRemoveCommand
.
RemoveCommand
, but it has been replaced since
this command is now used on attributes, too. The replacement method still calls this method for references, to
provide backwards compatibility.
protected Command createReplaceCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, EObject value, Collection collection)
ReplaceCommand
.
protected Command createReplaceCommand(EditingDomain domain, EObject owner, EReference feature, EObject value, Collection collection)
createReplaceCommand
.
ReplaceCommand
, but it has been replaced since
this command is now used on attributes, too. The replacement method still calls this method for references, to
provide backwards compatibility.
protected Command createAddCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, Collection collection, int index)
AddCommand
.
protected Command createAddCommand(EditingDomain domain, EObject owner, EReference feature, Collection collection, int index)
createAddCommand
.
AddCommand
, but it has been replaced since
this command is now used on attributes, too. The replacement method still calls this method for references, to
provide backwards compatibility.
protected Command createMoveCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, Object value, int index)
MoveCommand
.
protected Command createMoveCommand(EditingDomain domain, EObject owner, EReference feature, EObject value, int index)
createMoveCommand
.
MoveCommand
, but it has been replaced since
this command is now used on attributes, too. The replacement method still calls this method for references, to
provide backwards compatibility.
protected Command createDragAndDropCommand(EditingDomain domain, Object owner, float location, int operations, int operation, Collection collection)
DragAndDropCommand
.
protected Command createCreateChildCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, Object value, int index, Collection collection)
CreateChildCommand
.
protected Command createCreateChildCommand(EditingDomain domain, EObject owner, EReference feature, EObject value, int index, Collection collection)
createCreateChildCommand
.
CreateChildCommand
, but it has been replaced since
this command is now used on attributes, too. The replacement method still calls this method for references, to
provide backwards compatibility.
protected Command factorRemoveCommand(EditingDomain domain, CommandParameter commandParameter)
RemoveCommand
for a collection of objects
into one or more primitive remove commands,
i.e., one per unique feature.
protected Command factorAddCommand(EditingDomain domain, CommandParameter commandParameter)
AddCommand
for a collection of objects
into one or more primitive add command,
i.e., one per unique feature.
protected Command factorMoveCommand(EditingDomain domain, CommandParameter commandParameter)
MoveCommand
to determine the feature.
public void setTarget(Notifier target)
Adapter
setTarget
in interface Adapter
setTarget
in class AdapterImpl
public void unsetTarget(Notifier target)
Adapter.Internal
unsetTarget
in interface Adapter.Internal
unsetTarget
in class AdapterImpl
public void dispose()
dispose
in interface IDisposable
protected CommandParameter createChildParameter(Object feature, Object child)
CommandParameter
for a given parent feature and child object.
public Collection getCreateChildResult(Object child)
CreateChildCommand
.
getCreateChildResult
in interface CreateChildCommand.Helper
public String getCreateChildText(Object owner, Object feature, Object child, Collection selection)
CreateChildCommand
.
getCreateChildText
in interface CreateChildCommand.Helper
public String getCreateChildDescription(Object owner, Object feature, Object child, Collection selection)
CreateChildCommand
.
getCreateChildDescription
in interface CreateChildCommand.Helper
public String getCreateChildToolTipText(Object owner, Object feature, Object child, Collection selection)
CreateChildCommand
.
getCreateChildToolTipText
in interface CreateChildCommand.Helper
public Object getCreateChildImage(Object owner, Object feature, Object child, Collection selection)
CreateChildCommand
.
getCreateChildImage
in interface CreateChildCommand.Helper
protected String getTypeText(Object object)
protected String getTypeText(EAttribute attribute)
protected String getFeatureText(Object feature)
protected ResourceLocator getResourceLocator()
protected ResourceLocator getResourceLocator(Object anyObject)
protected AdapterFactory getRootAdapterFactory()
public URL getBaseURL()
getBaseURL
in interface ResourceLocator
public Object getImage(String key)
getImage
in interface ResourceLocator
key
- the key of the image resource.
protected boolean shouldTranslate()
true
if strings should be translated by default; false
otherwise.public String getString(String key)
getString
in interface ResourceLocator
key
- the key of the string resource.
public String getString(String key, boolean translate)
getString
in interface ResourceLocator
key
- the key of the string resource.translate
- whether the result is to be translated to the current locale.
public String getString(String key, Object[] substitutions)
getString
in interface ResourceLocator
key
- the key of the string.substitutions
- the message substitutions.
ResourceLocator.getString(String)
,
MessageFormat.format(String, Object[])
public String getString(String key, Object[] substitutions, boolean translate)
getString
in interface ResourceLocator
key
- the key of the string.substitutions
- the message substitutions.translate
- whether the result is to be translated to the current locale.
ResourceLocator.getString(String)
,
MessageFormat.format(String, Object[])
protected String getString(String key, String s0)
protected String getString(String key, String s0, boolean translate)
protected String getString(String key, String s0, String s1)
protected String getString(String key, String s0, String s1, boolean translate)
protected boolean isWrappingNeeded(Object object)
children
. This is used to determine whether to use a store to keep track of children and whether to
use command wrappers that re-wrap results and affected objects. The default implementation of createWrapper
also tests this method and will not create any wrappers if it returns
false
.
This implementation consults getChildrenFeatures
, returning true if any feature
map or simple attributes contribute children. This provides backwards compatibility with pre-2.0 subclasses
and enables the more useful new default behaviour for attributes, which were previously not allowed. Subclasses
may override this to enable wrapping of cross-referenced model objects, or to immediately return true
or false
, as desired. This is a convenient way to disable all of the new wrapping features in 2.0.
protected ItemProviderAdapter.ChildrenStore getChildrenStore(Object object)
protected ItemProviderAdapter.ChildrenStore createChildrenStore(Object object)
isWrappingNeeded
to decide whether to create a store for the children of the
given object. If so, the new store is created, added to the collection being maintained, and returned. If not,
null is returned.
protected Object wrap(EObject object, EStructuralFeature feature, Object value, int index)
createWrapper
to determine if the given value, at the given index in the given
feature of the given object, should be wrapped and to obtain the wrapper. If a wrapper is obtained, it is recorded
and returned. Otherwise, the orginal value is returned. Subclasses may override createWrapper
to specify when and with what to wrap values.
protected Object createWrapper(EObject object, EStructuralFeature feature, Object value, int index)
isWrappingNeeded
and, if it is true
, creates different wrappers that implement
IWrapperItemProvider
for feature maps, simple attributes, and cross references.
By default, isWrappingNeeded
does not return true
unless there is at
least one feature map or simple attribute that contributes children, in order to maintain backwards compatibility.
As a result, it may be necessary to override that method in order to wrap cross-referenced model objects here.
Subclasses may also override this method, in order to create their own specialized wrappers.
protected Object unwrap(Object object)
IWrapperItemProvider
, it is unwrapped by obtaining a value from getValue
. The unwrapping continues until a non-wrapper value is returned. This
iterative unwrapping is required because values may be repeatedly wrapped, as children of a delegating wrapper.
protected void disposeWrapper(Object object)
IWrapperItemProvider
, it is disposed by calling dispose
. It is also removed from wrappers
, as it will longer need to be
disposed along with this item provider.
protected void disposeWrappers(List objects)
IWrapperItemProvider
is disposed by calling
IWrapperItemProvider#dispose dispose} and is removed from wrappers
.
protected void adjustWrapperIndex(Object object, int increment)
IWrapperItemProvider
and specifies an index, that index is adjusted by the
given increment.
protected void adjustWrapperIndices(List objects, int from, int increment)
from
, that implements IWrapperItemProvider
and specifies an index, that index is adjusted by the given increment.
protected void adjustWrapperIndices(List objects, int from, int to, int increment)
from
and to
, that implements IWrapperItemProvider
and specifies an index, that index is adjusted by the given increment.
protected void updateChildren(Notification notification)
ItemProviderAdapter.ChildrenStore
exists for its notifier,
then the children of the specified feature are updated.
Existing children in the store that correspond to any set, removed or unset values are disposed
before being removed from the store. When children are added to, removed from, or moved
within a feature, the indices of any others affected are adjusted
. Since this method
is typically called from notifyChanged
, which, in subclasses, is often invoked repeatedly
up the inheritance chain, it can be safely called repeatedly for a single notification, and only the first such
call will have an effect. Such repeated calls may not, however, safely be interleaved with calls for another
notification.
protected CommandParameter unwrapCommandValues(CommandParameter commandParameter, Class commandClass)
collection
or in the value
that implement IWrapperItemProvider
will be unwrapped
. DragAndDropCommand
is never unwrapped.
protected Command wrapCommand(Command command, Object object, Class commandClass, CommandParameter commandParameter, CommandParameter oldCommandParameter)
isWrappingNeeded
returns true
, and never for a DragAndDropCommand
.
protected Collection getWrappedValues(CommandParameter commandParameter)
collection
and value
, that implement IWrapperItemProvider
.
protected ItemPropertyDescriptor createItemPropertyDescriptor(AdapterFactory adapterFactory, ResourceLocator resourceLocator, String displayName, String description, EStructuralFeature feature, boolean isSettable, Object staticImage, String category, String[] filterFlags)
Newly regenerated code will no longer use this method. You'll need to override this form
instead.
protected ItemPropertyDescriptor createItemPropertyDescriptor(AdapterFactory adapterFactory, ResourceLocator resourceLocator, String displayName, String description, EStructuralFeature feature, boolean isSettable, boolean multiLine, boolean sortChoices, Object staticImage, String category, String[] filterFlags)
|
Copyright 2001-2006 IBM Corporation and others. All Rights Reserved. |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |