Class WorkspaceProvider
- java.lang.Object
-
- org.eclipse.emf.ecp.internal.core.util.Element
-
- org.eclipse.emf.ecp.spi.core.DefaultProvider
-
- org.eclipse.emf.ecp.workspace.internal.core.WorkspaceProvider
-
- All Implemented Interfaces:
java.lang.Comparable<ECPElement>
,org.eclipse.core.runtime.IAdaptable
,ECPProvider
,ECPElement
,ECPModelContextProvider
,ECPProviderAware
,InternalProvider
,AdapterProvider
,ECPDisposable
,InternalRegistryElement
public class WorkspaceProvider extends DefaultProvider
- Author:
- Eike Stepper, Tobias Verhoeven
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.emf.ecp.spi.core.util.ECPDisposable
ECPDisposable.DisposeListener
-
Nested classes/interfaces inherited from interface org.eclipse.emf.ecp.spi.core.InternalProvider
InternalProvider.LifecycleEvent
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NAME
The Provider Name.static java.lang.String
PROP_ROOT_URI
Root URI Property Name.static java.lang.String
VIRTUAL_ROOT_URI
Constant which is used to indicated the theroot uri
is not existing yet.-
Fields inherited from interface org.eclipse.emf.ecp.core.ECPProvider
TYPE
-
Fields inherited from interface org.eclipse.emf.ecp.spi.core.InternalProvider
EMF_ADAPTER_FACTORY
-
-
Constructor Summary
Constructors Constructor Description WorkspaceProvider()
Instantiates a new workspace provider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cloneProject(InternalProject projectToClone, InternalProject targetProject)
This method clones a project.boolean
contains(InternalProject project, java.lang.Object object)
Checks whether a specific project contains a specific object.org.eclipse.emf.edit.domain.EditingDomain
createEditingDomain(InternalProject project)
This method creates an editing domain each time it is called.void
doDelete(InternalProject project, java.util.Collection<java.lang.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, java.lang.Object parent, InternalChildrenList childrenList)
Fills the elements of a certain parent object, depending on the context into the childrenList.org.eclipse.emf.common.util.EList<? extends java.lang.Object>
getElements(InternalProject project)
This method returns anEList
of the root elements.ECPContainer
getModelContext(java.lang.Object element)
Returns the firstECPContainer
that can be found for the provided Object.org.eclipse.emf.common.notify.Notifier
getRoot(InternalProject project)
Method checking whether an object is the root of the model container.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
isThreadSafe()
Whether it is safe to modify theEList
of model elements ot this provider.void
reload(InternalProject project)
Reloads the project.-
Methods inherited from class org.eclipse.emf.ecp.spi.core.DefaultProvider
addDisposeListener, createCommandStack, delete, dispose, getAdapter, getAdapter, getDescription, getLabel, getLinkElements, getModelContextFromAdapter, getOpenProjects, getProvider, getType, getUIProvider, getUnsupportedEPackages, isDisposed, isSlow, modelExists, notifyProviderChangeListeners, registerChangeListener, removeDisposeListener, setDescription, setLabel, setUIProvider, unregisterChangeListener
-
Methods inherited from class org.eclipse.emf.ecp.internal.core.util.Element
compareTo, equals, getName, hashCode, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.emf.ecp.core.util.ECPElement
getName
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
The Provider Name.- See Also:
- Constant Field Values
-
PROP_ROOT_URI
public static final java.lang.String PROP_ROOT_URI
Root URI Property Name.- See Also:
- Constant Field Values
-
VIRTUAL_ROOT_URI
public static final java.lang.String VIRTUAL_ROOT_URI
Constant which is used to indicated the theroot uri
is not existing yet.- See Also:
- Constant Field Values
-
-
Method Detail
-
handleLifecycle
public void handleLifecycle(ECPContainer context, InternalProvider.LifecycleEvent event)
This method is called to handle a specific life cycle.- Specified by:
handleLifecycle
in interfaceInternalProvider
- Overrides:
handleLifecycle
in classDefaultProvider
- Parameters:
context
- the context to handle the lifecycle forevent
- the lifecycle event to handle
-
doDispose
protected void doDispose()
Description copied from class:DefaultProvider
This method is called when a provider is disposed. Subclasses which need to dispose should overwrite this.- Overrides:
doDispose
in classDefaultProvider
-
hasCreateRepositorySupport
public boolean hasCreateRepositorySupport()
Description copied from class:DefaultProvider
Check whether a new repository can be added to this ECPProvider.- Specified by:
hasCreateRepositorySupport
in interfaceECPProvider
- Overrides:
hasCreateRepositorySupport
in classDefaultProvider
- Returns:
- true if new repositories can be added.
-
fillChildren
public void fillChildren(ECPContainer context, java.lang.Object parent, InternalChildrenList childrenList)
Description copied from class:DefaultProvider
Fills the elements of a certain parent object, depending on the context into the childrenList.- Specified by:
fillChildren
in interfaceInternalProvider
- Overrides:
fillChildren
in classDefaultProvider
- Parameters:
context
- the context to useparent
- the parent to read the children fromchildrenList
- the list to fill
-
getElements
public org.eclipse.emf.common.util.EList<? extends java.lang.Object> getElements(InternalProject project)
This method returns anEList
of the root elements.- Parameters:
project
- the project to get the root elements for- Returns:
- list of root elements of this project
-
contains
public boolean contains(InternalProject project, java.lang.Object object)
Description copied from class:DefaultProvider
Checks whether a specific project contains a specific object.- Specified by:
contains
in interfaceInternalProvider
- Overrides:
contains
in classDefaultProvider
- Parameters:
project
- the project to checkobject
- the object to check- Returns:
- true if the project contains such an object, false otherwise
-
reload
public void reload(InternalProject project)
Reloads the project.- Parameters:
project
- the project to be reloaded.
-
cloneProject
public void cloneProject(InternalProject projectToClone, InternalProject targetProject)
This method clones a project.- Parameters:
projectToClone
- the project to be clonedtargetProject
- the project to add the cloned data to
-
getRoot
public org.eclipse.emf.common.notify.Notifier getRoot(InternalProject project)
Method checking whether an object is the root of the model container.- Parameters:
project
- to check the root container for- Returns:
- a
Notifier
that is the model root of this project
-
doSave
public void doSave(InternalProject project)
Description copied from class:DefaultProvider
Convenient implementation where nothing happens.- Specified by:
doSave
in interfaceInternalProvider
- Overrides:
doSave
in classDefaultProvider
- Parameters:
project
- the project to save
-
isDirty
public boolean isDirty(InternalProject project)
Description copied from class:DefaultProvider
Convenient implementation where the provider saves changes of the project automatically, so a project never gets dirty. Thus this returns false.- Specified by:
isDirty
in interfaceInternalProvider
- Overrides:
isDirty
in classDefaultProvider
- Parameters:
project
- the project to check- Returns:
- false
-
createEditingDomain
public org.eclipse.emf.edit.domain.EditingDomain createEditingDomain(InternalProject project)
Description copied from class:DefaultProvider
This method creates an editing domain each time it is called.- Specified by:
createEditingDomain
in interfaceInternalProvider
- Overrides:
createEditingDomain
in classDefaultProvider
- Parameters:
project
- theInternalProject
to create the domain for.- Returns:
- the created
EditingDomain
-
getModelContext
public ECPContainer getModelContext(java.lang.Object element)
Description copied from class:DefaultProvider
Returns the firstECPContainer
that can be found for the provided Object.- Specified by:
getModelContext
in interfaceECPModelContextProvider
- Overrides:
getModelContext
in classDefaultProvider
- Parameters:
element
- the element to search theECPContainer
for- Returns:
- the
ECPContainer
of this element
-
hasCreateProjectWithoutRepositorySupport
public boolean hasCreateProjectWithoutRepositorySupport()
Description copied from class:DefaultProvider
Convenient implementation that return false.- Specified by:
hasCreateProjectWithoutRepositorySupport
in interfaceECPProvider
- Overrides:
hasCreateProjectWithoutRepositorySupport
in classDefaultProvider
- Returns:
- false
-
isThreadSafe
public boolean isThreadSafe()
Whether it is safe to modify theEList
of model elements ot this provider.- Returns:
- true, if the provider is thread-safe, false otherwise
- See Also:
InternalProvider.isThreadSafe()
-
doDelete
public void doDelete(InternalProject project, java.util.Collection<java.lang.Object> objects)
Executes the delete opertation. Is supposed to be implemented by providers.- Specified by:
doDelete
in classDefaultProvider
- Parameters:
project
- the project from where to deleteobjects
- theCollection
ifObjects
to delete- See Also:
DefaultProvider.doDelete(org.eclipse.emf.ecp.spi.core.InternalProject, java.util.Collection)
-
-