public final class ECPProjectImpl extends PropertiesElement implements InternalProject, ECPDisposable.DisposeListener
TYPE
Constructor and Description |
---|
ECPProjectImpl(ECPRepository repository,
String name,
ECPProperties properties)
Constructor used when an online project is created.
|
ECPProjectImpl(InternalProvider provider,
String name,
ECPProperties properties)
Constructor used when an offline project is created.
|
ECPProjectImpl(ObjectInput in)
Constructor used to load persisted projects on startup.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canDelete()
Whether this instance can be deleted or not.
|
InternalProject |
clone(String name)
This method clones a project.
|
void |
close()
This closes an opened object.
|
boolean |
contains(Object object)
Check whether a project contains an Object.
|
void |
delete()
Deletes the current instance.
|
void |
deleteElements(Collection<Object> objects)
Deletes a collection of
Object s by delegating the task to the provider. |
void |
disposed(ECPDisposable disposable)
Callback method being used to notify listeners about a dispose.
|
Object |
getAdapter(Class adapterType)
Returns an object which is an instance of the given class associated with this object.
|
org.eclipse.emf.common.util.EList<Object> |
getContents()
Returns the list of the direct content objects; each is of type Object.
|
org.eclipse.emf.edit.domain.EditingDomain |
getEditingDomain() |
InternalProject |
getProject()
This returns the project this object belongs to or references in any way.
|
InternalProvider |
getProvider()
This method returns the provider of this project.
|
Object |
getProviderSpecificData()
This method returns the provider specific data of this project.
|
Iterator<org.eclipse.emf.ecore.EObject> |
getReferenceCandidates(org.eclipse.emf.ecore.EObject modelElement,
org.eclipse.emf.ecore.EReference eReference)
Get all possible
EObject s from the provider to which a reference can be added from a certain
EObject based
on the type of the EReference . |
InternalRepository |
getRepository()
This method returns the repository this project is shared on.
|
String |
getType()
This return the type of the object.
|
Set<org.eclipse.emf.ecore.EPackage> |
getUnsupportedEPackages()
Returns a collection of
EPackage s which are not supported by the provider. |
Set<org.eclipse.emf.ecore.EClass> |
getVisibleEClasses()
Get the currently visible
EClass es. |
Set<org.eclipse.emf.ecore.EPackage> |
getVisiblePackages()
Get the currently visible
EPackage s. |
boolean |
hasDirtyContents()
Checks whether the model, associated with this project is dirty.
|
boolean |
isModelRoot(Object object)
This method checks whether the provided object is the model root of the project.
|
boolean |
isOpen()
Whether an object is open or not.
|
boolean |
isStorable() |
void |
notifyObjectsChanged(Collection<Object> objects,
boolean structural)
This method is a callback for the provider to notify the project about changes.
|
void |
notifyProvider(InternalProvider.LifecycleEvent event)
This method is used to notify the provider about a
InternalProvider.LifecycleEvent of this project. |
void |
open()
This opens a closed object.
|
protected void |
propertiesChanged(Collection<Map.Entry<String,String>> oldProperties,
Collection<Map.Entry<String,String>> newProperties)
Called if the properties of the element change.
|
void |
saveContents()
Saves the currently pending changes of the model.
|
void |
saveProperties()
Deprecated.
|
void |
setProviderSpecificData(Object providerSpecificData)
This method sets the provider specific data of this project.
|
void |
setVisibleEClasses(Set<org.eclipse.emf.ecore.EClass> filteredEClasses)
Set the visible
EClass es. |
void |
setVisiblePackages(Set<org.eclipse.emf.ecore.EPackage> filteredPackages)
Set the visible
EPackage s. |
void |
undispose(InternalRepository repository)
This method undisposes the project based on a repository.
|
void |
write(ObjectOutput out) |
cleanup, getProperties
compareTo, equals, getName, hashCode, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getName
compareTo
getProperties
public ECPProjectImpl(InternalProvider provider, String name, ECPProperties properties)
provider
- the InternalProvider
of this projectname
- the name of the projectproperties
- the properties of the projectpublic ECPProjectImpl(ECPRepository repository, String name, ECPProperties properties)
repository
- the ECPRepository
of this projectname
- the name of the projectproperties
- the properties of the projectpublic ECPProjectImpl(ObjectInput in) throws IOException
in
- the ObjectInput
to parseIOException
- is thrown when file can't be read.public void write(ObjectOutput out) throws IOException
PropertiesElement
write
in interface PropertiesStore.StorableElement
write
in class PropertiesElement
IOException
public String getType()
public void disposed(ECPDisposable disposable)
disposed
in interface ECPDisposable.DisposeListener
disposable
- the object being disposedpublic boolean isStorable()
isStorable
in interface PropertiesStore.StorableElement
public InternalProject getProject()
getProject
in interface ECPProjectAware
ECPProject
public InternalRepository getRepository()
getRepository
in interface ECPRepositoryAware
getRepository
in interface InternalProject
public InternalProvider getProvider()
getProvider
in interface ECPProviderAware
getProvider
in interface InternalProject
public Object getProviderSpecificData()
getProviderSpecificData
in interface InternalProject
public void setProviderSpecificData(Object providerSpecificData)
setProviderSpecificData
in interface InternalProject
providerSpecificData
- the provider specific data of this projectpublic void notifyObjectsChanged(Collection<Object> objects, boolean structural)
notifyObjectsChanged
in interface InternalProject
objects
- the objects that have changedstructural
- if the changes where structural (e.g. delete)public org.eclipse.emf.edit.domain.EditingDomain getEditingDomain()
getEditingDomain
in interface org.eclipse.emf.edit.domain.IEditingDomainProvider
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).
adapterType
- the class to adapt tonull
IAdaptable#getAdapter(Class)
public boolean canDelete()
canDelete
in interface ECPContainer
public void delete()
delete
in interface ECPContainer
public boolean isOpen()
isOpen
in interface ECPProject
public void open()
open
in interface ECPProject
public void close()
close
in interface ECPProject
public void notifyProvider(InternalProvider.LifecycleEvent event)
InternalProvider.LifecycleEvent
of this project.notifyProvider
in interface InternalProject
event
- to pass to the providerpublic void undispose(InternalRepository repository)
undispose
in interface InternalProject
repository
- the repositorypublic org.eclipse.emf.common.util.EList<Object> getContents()
getContents
in interface ECPProject
Object
public Set<org.eclipse.emf.ecore.EPackage> getUnsupportedEPackages()
EPackage
s which are not supported by the provider. EObjects from these packages
cannot be created within the project.getUnsupportedEPackages
in interface InternalProject
Collection
of unsupported EPackage
spublic void setVisiblePackages(Set<org.eclipse.emf.ecore.EPackage> filteredPackages)
EPackage
s. New model elements can only be created from EPackage
s contained in
the visiblePackages and the InternalProject.setVisibleEClasses(Set)
.setVisiblePackages
in interface InternalProject
filteredPackages
- the EPackage
s to be visiblepublic Set<org.eclipse.emf.ecore.EPackage> getVisiblePackages()
EPackage
s. If no filter is set, then all EPackage
s supported by the
provider are returned.getVisiblePackages
in interface InternalProject
Set
of EPackage
s that should be available, or all supported EPackagespublic Set<org.eclipse.emf.ecore.EClass> getVisibleEClasses()
getVisibleEClasses
in interface InternalProject
Set
of EClass
es that should be available, or empty.public void setVisibleEClasses(Set<org.eclipse.emf.ecore.EClass> filteredEClasses)
EClass
es.setVisibleEClasses
in interface InternalProject
filteredEClasses
- the classes that should be availablepublic Iterator<org.eclipse.emf.ecore.EObject> getReferenceCandidates(org.eclipse.emf.ecore.EObject modelElement, org.eclipse.emf.ecore.EReference eReference)
EObject
s from the provider to which a reference can be added from a certain
EObject
based
on the type of the EReference
.getReferenceCandidates
in interface InternalProject
modelElement
- - the EObject
for which the reference should be set.eReference
- - the EReference
to be set.Iterator
over all EObject
that can be added as a referencepublic void saveContents()
saveContents
in interface ECPProject
public boolean hasDirtyContents()
hasDirtyContents
in interface ECPProject
public void deleteElements(Collection<Object> objects)
Object
s by delegating the task to the provider.deleteElements
in interface ECPProject
objects
- the collection of Object
s to deletepublic InternalProject clone(String name)
clone
in interface InternalProject
name
- the name of the project to createprotected void propertiesChanged(Collection<Map.Entry<String,String>> oldProperties, Collection<Map.Entry<String,String>> newProperties)
PropertiesElement
propertiesChanged
in class PropertiesElement
oldProperties
- the old propertiesnewProperties
- the new properties@Deprecated public void saveProperties()
saveProperties
in interface InternalProject
public boolean isModelRoot(Object object)
isModelRoot
in interface InternalProject
object
- the object to checkpublic boolean contains(Object object)
contains
in interface InternalProject
object
- the object to check for containmentCopyright © 2019. All rights reserved.