public abstract class DefaultProvider extends Element implements InternalProvider
InternalProvider.LifecycleEvent
ECPDisposable.DisposeListener
EMF_ADAPTER_FACTORY
TYPE
Modifier | Constructor and Description |
---|---|
protected |
DefaultProvider(String name)
Convenient constructor for an
ECPProvider . |
Modifier and Type | Method and Description |
---|---|
void |
addDisposeListener(ECPDisposable.DisposeListener listener)
Adds a
ECPDisposable.DisposeListener to this instance. |
boolean |
contains(InternalProject project,
Object object)
Checks whether a specific project contains a specific object.
|
protected org.eclipse.emf.common.command.CommandStack |
createCommandStack(InternalProject project)
This is used during the creation of the
EditingDomain . |
org.eclipse.emf.edit.domain.EditingDomain |
createEditingDomain(InternalProject project)
This method creates an editing domain each time it is called.
|
void |
delete(InternalProject project,
Collection<Object> objects)
Deletes a collection of EObjects from the model.
|
void |
dispose()
Disposes the current instance.
|
abstract void |
doDelete(InternalProject project,
Collection<Object> objects)
Executes the delete opertation.
|
protected void |
doDispose()
This method is called when a provider is disposed.
|
void |
doSave(InternalProject project)
Convenient implementation where nothing happens.
|
void |
fillChildren(ECPContainer context,
Object parent,
InternalChildrenList childrenList)
Fills the elements of a certain parent object, depending on the context into the childrenList.
|
Object |
getAdapter(Class adapterType)
Returns an object which is an instance of the given class associated with this object.
|
<T> T |
getAdapter(Object adaptable,
Class<T> adapterType) |
String |
getDescription()
Return the description.
|
String |
getLabel()
Label of the ECPProvider.
|
Iterator<org.eclipse.emf.ecore.EObject> |
getLinkElements(InternalProject project,
org.eclipse.emf.ecore.EObject modelElement,
org.eclipse.emf.ecore.EReference eReference)
Convenient implementation of the
getLinkElements(InternalProject, EObject, EReference) method to use the
ItemPropertyDescriptor to get all object of an object. |
ECPContainer |
getModelContext(Object element)
Returns the first
ECPContainer that can be found for the provided Object. |
protected ECPContainer |
getModelContextFromAdapter(org.eclipse.emf.common.notify.Notifier notifier)
This allows to get the
ECPContainer from a Notifier using the EcoreUtil. |
Set<InternalProject> |
getOpenProjects()
Array of all ECPProjects based on this ECPProvider which are open.
|
InternalProvider |
getProvider()
The Provider this class references in any way.
|
String |
getType()
This return the type of the object.
|
AdapterProvider |
getUIProvider()
Allows access of the corresponding UI Adapter.
|
Set<org.eclipse.emf.ecore.EPackage> |
getUnsupportedEPackages(Collection<org.eclipse.emf.ecore.EPackage> packages,
InternalRepository repository)
Convenient implementation of the
getUnsupportedEPackages(Collection,InternalRepository) method to return
an empty list. |
void |
handleLifecycle(ECPContainer context,
InternalProvider.LifecycleEvent event)
This method is called to handle a specific life cycle.
|
boolean |
hasCreateProjectWithoutRepositorySupport()
Convenient implementation that return false.
|
boolean |
hasCreateRepositorySupport()
Check whether a new repository can be added to this ECPProvider.
|
boolean |
isDirty(InternalProject project)
Convenient implementation where the provider saves changes of the project automatically, so a project never gets
dirty.
|
boolean |
isDisposed()
Whether this instance is already disposed.
|
boolean |
isSlow(Object parent)
Whether this provider is slow or not.
|
boolean |
modelExists(InternalProject project)
Convenient implementation that return true during this check.
|
protected void |
notifyProviderChangeListeners(org.eclipse.emf.common.notify.Notification notification) |
void |
registerChangeListener(ProviderChangeListener listener)
Registers a new
ProviderChangeListener . |
void |
removeDisposeListener(ECPDisposable.DisposeListener listener)
Removed a
ECPDisposable.DisposeListener from this instance. |
void |
setDescription(String description)
Sets the description.
|
void |
setLabel(String label)
Sets the label.
|
void |
setUIProvider(AdapterProvider uiProvider)
Allows to set the uiProvider.
|
void |
unregisterChangeListener(ProviderChangeListener listener)
Unregisters a new
ProviderChangeListener . |
compareTo, equals, getName, hashCode, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
cloneProject, getElements, getRoot, isThreadSafe
getName
compareTo
protected DefaultProvider(String name)
ECPProvider
.name
- the name of the implementing providerpublic final String getType()
public final InternalProvider getProvider()
getProvider
in interface ECPProviderAware
ECPProvider
public final String getLabel()
getLabel
in interface ECPProvider
getLabel
in interface InternalRegistryElement
public final void setLabel(String label)
setLabel
in interface InternalRegistryElement
label
- the Label to setpublic final String getDescription()
getDescription
in interface InternalRegistryElement
public final void setDescription(String description)
setDescription
in interface InternalRegistryElement
description
- the Description to setpublic final AdapterProvider getUIProvider()
getUIProvider
in interface InternalProvider
public final void setUIProvider(AdapterProvider uiProvider)
setUIProvider
in interface InternalProvider
uiProvider
- the uiProvider to setpublic final Set<InternalProject> getOpenProjects()
getOpenProjects
in interface InternalProvider
public final boolean isDisposed()
isDisposed
in interface ECPDisposable
public final void dispose()
dispose
in interface ECPDisposable
public final void addDisposeListener(ECPDisposable.DisposeListener listener)
ECPDisposable.DisposeListener
to this instance.addDisposeListener
in interface ECPDisposable
listener
- the listener to addpublic final void removeDisposeListener(ECPDisposable.DisposeListener listener)
ECPDisposable.DisposeListener
from this instance.removeDisposeListener
in interface ECPDisposable
listener
- the listener to removeprotected void doDispose()
public <T> T getAdapter(Object adaptable, Class<T> adapterType)
getAdapter
in interface AdapterProvider
public Object getAdapter(Class adapterType)
null
if
no such object can be found.
This implementation of the method declared by IAdaptable
passes the request along to the platform's
adapter manager; roughly Platform.getAdapterManager().getAdapter(this, adapter)
. Subclasses may
override this method (however, if they do so, they should invoke the method on their superclass to ensure that
the Platform's adapter manager is consulted).
getAdapter
in interface org.eclipse.core.runtime.IAdaptable
adapterType
- the class to adapt tonull
IAdaptable.getAdapter(Class)
public org.eclipse.emf.edit.domain.EditingDomain createEditingDomain(InternalProject project)
createEditingDomain
in interface InternalProvider
project
- the InternalProject
to create the domain for.EditingDomain
protected org.eclipse.emf.common.command.CommandStack createCommandStack(InternalProject project)
EditingDomain
. This implementation creates an
BasicCommandStack
.project
- the project to create the CommandStack
forCommandStack
public boolean hasCreateRepositorySupport()
hasCreateRepositorySupport
in interface ECPProvider
public boolean isSlow(Object parent)
isSlow
in interface InternalProvider
parent
- to checkpublic ECPContainer getModelContext(Object element)
ECPContainer
that can be found for the provided Object.getModelContext
in interface ECPModelContextProvider
element
- the element to search the ECPContainer
forECPContainer
of this elementprotected final ECPContainer getModelContextFromAdapter(org.eclipse.emf.common.notify.Notifier notifier)
ECPContainer
from a Notifier
using the EcoreUtil.
This first gets the ECPModelContextAdapter
and from it it gets the ECPContainer
.notifier
- the Notifier
to get the ECPContainer
fromECPContainer
registered as an Adapter on this Notifier
or nullpublic void fillChildren(ECPContainer context, Object parent, InternalChildrenList childrenList)
fillChildren
in interface InternalProvider
context
- the context to useparent
- the parent to read the children fromchildrenList
- the list to fillpublic void handleLifecycle(ECPContainer context, InternalProvider.LifecycleEvent event)
handleLifecycle
in interface InternalProvider
context
- the context to handle the lifecycle forevent
- the lifecycle event to handlepublic Set<org.eclipse.emf.ecore.EPackage> getUnsupportedEPackages(Collection<org.eclipse.emf.ecore.EPackage> packages, InternalRepository repository)
getUnsupportedEPackages(Collection,InternalRepository)
method to return
an empty list. The
provider has to Override
this method if not all EPackage
s are supported.getUnsupportedEPackages
in interface InternalProvider
packages
- available packagesrepository
- the repository to checkCollection
of EPackages
unsupported by this provider for the specified
repositorypublic Iterator<org.eclipse.emf.ecore.EObject> getLinkElements(InternalProject project, org.eclipse.emf.ecore.EObject modelElement, org.eclipse.emf.ecore.EReference eReference)
getLinkElements(InternalProject, EObject, EReference)
method to use the
ItemPropertyDescriptor
to get all object of an object.getLinkElements
in interface InternalProvider
project
- the project the call is frommodelElement
- EObject
to add the EReference
toeReference
- the EReference
to addIterator
of EObject
that can be linkedpublic void doSave(InternalProject project)
doSave
in interface InternalProvider
project
- the project to savepublic boolean isDirty(InternalProject project)
isDirty
in interface InternalProvider
project
- the project to checkpublic boolean modelExists(InternalProject project)
modelExists
in interface InternalProvider
project
- the project to checkpublic boolean hasCreateProjectWithoutRepositorySupport()
hasCreateProjectWithoutRepositorySupport
in interface ECPProvider
public boolean contains(InternalProject project, Object object)
contains
in interface InternalProvider
project
- the project to checkobject
- the object to checkpublic void registerChangeListener(ProviderChangeListener listener)
ProviderChangeListener
.registerChangeListener
in interface InternalProvider
listener
- the listenerpublic void unregisterChangeListener(ProviderChangeListener listener)
ProviderChangeListener
.unregisterChangeListener
in interface InternalProvider
listener
- the listenerprotected void notifyProviderChangeListeners(org.eclipse.emf.common.notify.Notification notification)
notification
- a Notification
public void delete(InternalProject project, Collection<Object> objects)
delete
in interface InternalProvider
project
- the project from where to deleteobjects
- the Collection
if Objects
to deleteInternalProvider.delete(org.eclipse.emf.ecp.spi.core.InternalProject,
java.util.Collection)
public abstract void doDelete(InternalProject project, Collection<Object> objects)
project
- the project from where to deleteobjects
- the Collection
if Objects
to deleteCopyright © 2019. All rights reserved.