org.eclipse.emf.ecp.workspace.internal.core
Class WorkspaceProvider

java.lang.Object
  extended by org.eclipse.emf.ecp.internal.core.util.Element
      extended by org.eclipse.emf.ecp.spi.core.DefaultProvider
          extended by org.eclipse.emf.ecp.workspace.internal.core.WorkspaceProvider
All Implemented Interfaces:
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.InternalProvider
InternalProvider.LifecycleEvent
 
Nested classes/interfaces inherited from interface org.eclipse.emf.ecp.spi.core.util.ECPDisposable
ECPDisposable.DisposeListener
 
Field Summary
static String NAME
          The Provider Name.
static String PROP_ROOT_URI
          Root URI Property Name.
 
Fields inherited from interface org.eclipse.emf.ecp.spi.core.InternalProvider
EMF_ADAPTER_FACTORY
 
Fields inherited from interface org.eclipse.emf.ecp.core.ECPProvider
TYPE
 
Constructor Summary
WorkspaceProvider()
          Instantiates a new workspace provider.
 
Method Summary
 void cloneProject(InternalProject projectToClone, InternalProject targetProject)
          This method clones a project.
 boolean contains(InternalProject project, 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 delete(InternalProject project, Collection<Object> objects)
          Deletes a collection of EObjects from the model.
 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.
 org.eclipse.emf.common.util.EList<? extends Object> getElements(InternalProject project)
          This method returns an EList of the root elements.
 ECPContainer getModelContext(Object element)
          Returns the first ECPContainer 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 the EList 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, dispose, getAdapter, getAdapter, getDescription, getLabel, getLinkElements, getOpenProjects, getProvider, getType, getUIProvider, getUnsupportedEPackages, isDisposed, isSlow, modelExists, removeDisposeListener, setDescription, setLabel, setUIProvider
 
Methods inherited from class org.eclipse.emf.ecp.internal.core.util.Element
compareTo, equals, getName, hashCode, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.ecp.core.util.ECPElement
getName
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

NAME

public static final String NAME
The Provider Name.

See Also:
Constant Field Values

PROP_ROOT_URI

public static final String PROP_ROOT_URI
Root URI Property Name.

See Also:
Constant Field Values
Constructor Detail

WorkspaceProvider

public WorkspaceProvider()
Instantiates a new workspace provider.

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 interface InternalProvider
Overrides:
handleLifecycle in class DefaultProvider
Parameters:
context - the context to handle the lifecycle for
event - the lifecycle event to handle

hasCreateRepositorySupport

public boolean hasCreateRepositorySupport()
Description copied from class: DefaultProvider
Check whether a new repository can be added to this ECPProvider.

Specified by:
hasCreateRepositorySupport in interface ECPProvider
Overrides:
hasCreateRepositorySupport in class DefaultProvider
Returns:
true if new repositories can be added.

fillChildren

public void fillChildren(ECPContainer context,
                         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 interface InternalProvider
Overrides:
fillChildren in class DefaultProvider
Parameters:
context - the context to use
parent - the parent to read the children from
childrenList - the list to fill

getElements

public org.eclipse.emf.common.util.EList<? extends Object> getElements(InternalProject project)
This method returns an EList 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,
                        Object object)
Description copied from class: DefaultProvider
Checks whether a specific project contains a specific object.

Specified by:
contains in interface InternalProvider
Overrides:
contains in class DefaultProvider
Parameters:
project - the project to check
object - 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.

delete

public void delete(InternalProject project,
                   Collection<Object> objects)
Deletes a collection of EObjects from the model.

Parameters:
project - the project from where to delete
objects - the Collection if Objects to delete

cloneProject

public void cloneProject(InternalProject projectToClone,
                         InternalProject targetProject)
This method clones a project.

Parameters:
projectToClone - the project to be cloned
targetProject - 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 interface InternalProvider
Overrides:
doSave in class DefaultProvider
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 interface InternalProvider
Overrides:
isDirty in class DefaultProvider
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 interface InternalProvider
Overrides:
createEditingDomain in class DefaultProvider
Parameters:
project - the InternalProject to create the domain for.
Returns:
the created EditingDomain

getModelContext

public ECPContainer getModelContext(Object element)
Description copied from class: DefaultProvider
Returns the first ECPContainer that can be found for the provided Object.

Specified by:
getModelContext in interface ECPModelContextProvider
Overrides:
getModelContext in class DefaultProvider
Parameters:
element - the element to search the ECPContainer 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 interface ECPProvider
Overrides:
hasCreateProjectWithoutRepositorySupport in class DefaultProvider
Returns:
false

isThreadSafe

public boolean isThreadSafe()
Whether it is safe to modify the EList of model elements ot this provider.

Returns:
true, if the provider is thread-safe, false otherwise
See Also:
InternalProvider.isThreadSafe()


Copyright © 2014. All Rights Reserved.