Class ECPRepositoryImpl
- java.lang.Object
-
- org.eclipse.emf.ecp.internal.core.util.Element
-
- org.eclipse.emf.ecp.internal.core.util.PropertiesElement
-
- org.eclipse.emf.ecp.internal.core.ECPRepositoryImpl
-
- All Implemented Interfaces:
java.lang.Comparable<ECPElement>
,ECPRepository
,ECPContainer
,ECPElement
,ECPPropertiesAware
,ECPProviderAware
,PropertiesStore.StorableElement
,InternalRepository
,ECPDisposable
,ECPDisposable.DisposeListener
,InternalRegistryElement
public final class ECPRepositoryImpl extends PropertiesElement implements InternalRepository, ECPDisposable.DisposeListener
This Class describes a repository.- Author:
- Eike Stepper, Eugen Neufeld
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.emf.ecp.spi.core.util.ECPDisposable
ECPDisposable.DisposeListener
-
-
Field Summary
-
Fields inherited from interface org.eclipse.emf.ecp.core.ECPRepository
TYPE
-
-
Constructor Summary
Constructors Constructor Description ECPRepositoryImpl(java.io.ObjectInput in)
Constructor used by theECPRepositoryManager
when loading existing repositories during startup.ECPRepositoryImpl(ECPProvider provider, java.lang.String name, ECPProperties properties)
Constructor used to create an instance through user input.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDisposeListener(ECPDisposable.DisposeListener listener)
Adds aECPDisposable.DisposeListener
to this instance.boolean
canDelete()
Whether this instance can be deleted or not.void
delete()
Deletes the current instance.void
dispose()
Disposes the current instance.void
disposed(ECPDisposable disposable)
Callback method being used to notify listeners about a dispose.java.lang.Object
getAdapter(java.lang.Class adapterType)
Returns an object which is an instance of the given class associated with this object.java.lang.String
getDescription()
Returns the description for thisECPRepository
.java.lang.String
getLabel()
Returns the label for theECPRepository
.InternalProject[]
getOpenProjects()
Return all open projects of that are shared on this repository.InternalProvider
getProvider()
This method returns the provider of this repository.java.lang.Object
getProviderSpecificData()
This method returns provider specific data of this repository.java.lang.String
getType()
This return the type of the object.boolean
isDisposed()
Whether this instance is already disposed.boolean
isStorable()
void
notifyObjectsChanged(java.util.Collection<java.lang.Object> objects)
This is a callback method used to notify the repository about changes.protected void
propertiesChanged(java.util.Collection<java.util.Map.Entry<java.lang.String,java.lang.String>> oldProperties, java.util.Collection<java.util.Map.Entry<java.lang.String,java.lang.String>> newProperties)
Called if the properties of the element change.void
removeDisposeListener(ECPDisposable.DisposeListener listener)
Removed aECPDisposable.DisposeListener
from this instance.void
setDescription(java.lang.String description)
Sets the description.void
setLabel(java.lang.String label)
Sets the label.void
setProviderSpecificData(java.lang.Object providerSpecificData)
This method sets the provider specific data for this repository.void
write(java.io.ObjectOutput out)
-
Methods inherited from class org.eclipse.emf.ecp.internal.core.util.PropertiesElement
cleanup, getProperties
-
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
-
Methods inherited from interface org.eclipse.emf.ecp.core.util.ECPPropertiesAware
getProperties
-
-
-
-
Constructor Detail
-
ECPRepositoryImpl
public ECPRepositoryImpl(ECPProvider provider, java.lang.String name, ECPProperties properties)
Constructor used to create an instance through user input.- Parameters:
provider
- theECPProvider
for this repositoryname
- the name of this repositoryproperties
- theECPProperties
of this repository
-
ECPRepositoryImpl
public ECPRepositoryImpl(java.io.ObjectInput in) throws java.io.IOException
Constructor used by theECPRepositoryManager
when loading existing repositories during startup.- Parameters:
in
- theObjectInput
to parse- Throws:
java.io.IOException
- when an error occurs
-
-
Method Detail
-
getType
public java.lang.String getType()
This return the type of the object.
-
disposed
public void disposed(ECPDisposable disposable) throws DisposeException
Callback method being used to notify listeners about a dispose.- Specified by:
disposed
in interfaceECPDisposable.DisposeListener
- Parameters:
disposable
- the object being disposed- Throws:
DisposeException
- is thrown when something goes wrong
-
isStorable
public boolean isStorable()
- Specified by:
isStorable
in interfacePropertiesStore.StorableElement
-
write
public void write(java.io.ObjectOutput out) throws java.io.IOException
Description copied from class:PropertiesElement
- Specified by:
write
in interfacePropertiesStore.StorableElement
- Overrides:
write
in classPropertiesElement
- Throws:
java.io.IOException
-
getLabel
public java.lang.String getLabel()
Returns the label for theECPRepository
.- Specified by:
getLabel
in interfaceECPRepository
- Specified by:
getLabel
in interfaceInternalRegistryElement
- Returns:
- the label for this repository
-
setLabel
public void setLabel(java.lang.String label)
Sets the label.- Specified by:
setLabel
in interfaceInternalRegistryElement
- Parameters:
label
- the Label to set
-
getDescription
public java.lang.String getDescription()
Returns the description for thisECPRepository
.- Specified by:
getDescription
in interfaceECPRepository
- Specified by:
getDescription
in interfaceInternalRegistryElement
- Returns:
- the description for this repository
-
setDescription
public void setDescription(java.lang.String description)
Sets the description.- Specified by:
setDescription
in interfaceInternalRegistryElement
- Parameters:
description
- the Description to set
-
isDisposed
public boolean isDisposed()
Whether this instance is already disposed.- Specified by:
isDisposed
in interfaceECPDisposable
- Returns:
- true if already disposed, false otherwise.
-
getAdapter
public java.lang.Object getAdapter(java.lang.Class adapterType)
Returns an object which is an instance of the given class associated with this object. Returnsnull
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; roughlyPlatform.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).- Parameters:
adapterType
- the class to adapt to- Returns:
- the adapted object or
null
- See Also:
IAdaptable.getAdapter(Class)
-
dispose
public void dispose()
Disposes the current instance.- Specified by:
dispose
in interfaceECPDisposable
-
addDisposeListener
public void addDisposeListener(ECPDisposable.DisposeListener listener)
Adds aECPDisposable.DisposeListener
to this instance.- Specified by:
addDisposeListener
in interfaceECPDisposable
- Parameters:
listener
- the listener to add
-
removeDisposeListener
public void removeDisposeListener(ECPDisposable.DisposeListener listener)
Removed aECPDisposable.DisposeListener
from this instance.- Specified by:
removeDisposeListener
in interfaceECPDisposable
- Parameters:
listener
- the listener to remove
-
getProvider
public InternalProvider getProvider()
This method returns the provider of this repository.- Specified by:
getProvider
in interfaceECPProviderAware
- Specified by:
getProvider
in interfaceInternalRepository
- Returns:
- the provider of the repository
-
getProviderSpecificData
public java.lang.Object getProviderSpecificData()
This method returns provider specific data of this repository.- Specified by:
getProviderSpecificData
in interfaceInternalRepository
- Returns:
- the provider specific data
-
setProviderSpecificData
public void setProviderSpecificData(java.lang.Object providerSpecificData)
This method sets the provider specific data for this repository.- Specified by:
setProviderSpecificData
in interfaceInternalRepository
- Parameters:
providerSpecificData
- the provider specific data to set
-
canDelete
public boolean canDelete()
Whether this instance can be deleted or not.- Specified by:
canDelete
in interfaceECPContainer
- Returns:
- true if this instance can be deleted, false otherwise.
-
delete
public void delete()
Deletes the current instance.- Specified by:
delete
in interfaceECPContainer
-
notifyObjectsChanged
public void notifyObjectsChanged(java.util.Collection<java.lang.Object> objects)
This is a callback method used to notify the repository about changes.- Specified by:
notifyObjectsChanged
in interfaceInternalRepository
- Parameters:
objects
- that have changed
-
getOpenProjects
public InternalProject[] getOpenProjects()
Return all open projects of that are shared on this repository.- Returns:
- array of currently open
ECPProjects
that are shared on this repository
-
propertiesChanged
protected void propertiesChanged(java.util.Collection<java.util.Map.Entry<java.lang.String,java.lang.String>> oldProperties, java.util.Collection<java.util.Map.Entry<java.lang.String,java.lang.String>> newProperties)
Description copied from class:PropertiesElement
Called if the properties of the element change. Can be implemented by subclasses- Overrides:
propertiesChanged
in classPropertiesElement
- Parameters:
oldProperties
- the old propertiesnewProperties
- the new properties
-
-