org.eclipse.emf.ecp.internal.core
Class ECPProjectManagerImpl

java.lang.Object
  extended by org.eclipse.net4j.util.event.Notifier
      extended by org.eclipse.net4j.util.lifecycle.Lifecycle
          extended by org.eclipse.emf.ecp.internal.core.util.Registry<ELEMENT,OBSERVER>
              extended by org.eclipse.emf.ecp.internal.core.util.ElementRegistry<ELEMENT,OBSERVER>
                  extended by org.eclipse.emf.ecp.internal.core.util.PropertiesStore<InternalProject,ECPObserver>
                      extended by org.eclipse.emf.ecp.internal.core.ECPProjectManagerImpl
All Implemented Interfaces:
ECPProjectManager, ECPObserver, ECPRepositoriesChangedObserver, ECPDisposable.DisposeListener, org.eclipse.net4j.util.event.INotifier, org.eclipse.net4j.util.lifecycle.ILifecycle, org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivation

public final class ECPProjectManagerImpl
extends PropertiesStore<InternalProject,ECPObserver>
implements ECPProjectManager, ECPRepositoriesChangedObserver

This class manages the available ECPProjects.

Author:
Eike Stepper, Eugen Neufeld

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.emf.ecp.internal.core.util.PropertiesStore
PropertiesStore.StorableElement
 
Nested classes/interfaces inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle
org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivation
 
Field Summary
static ECPProjectManagerImpl INSTANCE
          Deprecated. use ECPUtil instead
 
Fields inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle
USE_LABEL
 
Constructor Summary
ECPProjectManagerImpl()
          Should not be called directly, use service instead.
 
Method Summary
 void changeProject(ECPProject project, boolean opened, boolean store)
          This is called by projects to notify observers if a project gets openes or closed.
 ECPProject createProject(ECPProject project, String name)
          Method to construct a new Project based on an existing project as template.
 ECPProject createProject(ECPProvider provider, String name)
          Method to construct an offline Project, this method calls ECPProjectManager.createProject(ECPProvider, String, ECPProperties) with empty properties.
 ECPProject createProject(ECPProvider provider, String name, ECPProperties properties)
          Method to construct an offline Project and notify listeners about this add.
 ECPProject createProject(ECPRepository repository, String name, ECPProperties properties)
          Method to construct an shared Project, e.g.
 InternalProject getProject(Object adaptable)
          Retrieves the project the adaptable belongs to if possible.
 InternalProject getProject(String name)
          Searches for a project based on the provided String.
 Collection<ECPProject> getProjects()
          Returns all known projects.
 void notifyObjectsChanged(ECPProject project, Collection<Object> objects, boolean structural)
          This is called by projects to notify observers about object changes.
 void repositoriesChanged(Collection<ECPRepository> oldRepositories, Collection<ECPRepository> newRepositories)
          This is called to indicate, that repositories changed.
 
Methods inherited from class org.eclipse.emf.ecp.internal.core.util.PropertiesStore
getFolder, setFolder, storeElement
 
Methods inherited from class org.eclipse.emf.ecp.internal.core.util.ElementRegistry
addResolveListener, removeResolveListener
 
Methods inherited from class org.eclipse.emf.ecp.internal.core.util.Registry
addObserver, changeElements, disposed, getElement, getElementCount, getElementNames, getElements, hasElement, hasElements, removeObserver
 
Methods inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle
activate, deactivate, getLifecycleState, isActive, isDeferredActivation, toString
 
Methods inherited from class org.eclipse.net4j.util.event.Notifier
addListener, fireEvent, fireEvent, fireEvent, getListeners, hasListeners, removeListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.net4j.util.event.INotifier
addListener, getListeners, hasListeners, removeListener
 

Field Detail

INSTANCE

@Deprecated
public static ECPProjectManagerImpl INSTANCE
Deprecated. use ECPUtil instead
The Singleton to access the implementation of the Default ECPProjectManager.

Constructor Detail

ECPProjectManagerImpl

public ECPProjectManagerImpl()
Should not be called directly, use service instead.

Method Detail

createProject

public ECPProject createProject(ECPProvider provider,
                                String name)
                         throws ECPProjectWithNameExistsException
Method to construct an offline Project, this method calls ECPProjectManager.createProject(ECPProvider, String, ECPProperties) with empty properties. If ECPProvider.hasCreateProjectWithoutRepositorySupport() returns false an UnsupportedOperationException is thrown.

Specified by:
createProject in interface ECPProjectManager
Parameters:
provider - the ECPProvider of this project
name - the name of the project
Returns:
created ECPProject
Throws:
ECPProjectWithNameExistsException - when a project with the same name already exists

createProject

public ECPProject createProject(ECPProvider provider,
                                String name,
                                ECPProperties properties)
                         throws ECPProjectWithNameExistsException
Method to construct an offline Project and notify listeners about this add. If ECPProvider.hasCreateProjectWithoutRepositorySupport() returns false an UnsupportedOperationException is thrown.

Specified by:
createProject in interface ECPProjectManager
Parameters:
provider - the ECPProvider of this project
name - the name of the project
properties - the project properties
Returns:
created ECPProject
Throws:
ECPProjectWithNameExistsException - when a project with the same name already exists

createProject

public ECPProject createProject(ECPRepository repository,
                                String name,
                                ECPProperties properties)
                         throws ECPProjectWithNameExistsException
Method to construct an shared Project, e.g. during a checkout, and notify listeners about this add.

Specified by:
createProject in interface ECPProjectManager
Parameters:
repository - the ECPRepository of this project
name - the name of the project
properties - the project properties
Returns:
created ECPProject
Throws:
ECPProjectWithNameExistsException - when a project with the same name already exists

createProject

public ECPProject createProject(ECPProject project,
                                String name)
Method to construct a new Project based on an existing project as template. If the template project is shared, so is the created project.

Specified by:
createProject in interface ECPProjectManager
Parameters:
project - the template ECPProject
name - the name of the created project
Returns:
the clone of the ECPProject

getProject

public InternalProject getProject(Object adaptable)
Retrieves the project the adaptable belongs to if possible. This method checks whether the adaptable is ECPProjectAware and else uses the AdapterUtil to adapt to a project.

Specified by:
getProject in interface ECPProjectManager
Parameters:
adaptable - the Object to adapt
Returns:
the adapted ECPProject

getProject

public InternalProject getProject(String name)
Searches for a project based on the provided String.

Specified by:
getProject in interface ECPProjectManager
Parameters:
name - of the project to search for
Returns:
the ECPProject

getProjects

public Collection<ECPProject> getProjects()
Returns all known projects.

Specified by:
getProjects in interface ECPProjectManager
Returns:
an array of all known projects

changeProject

public void changeProject(ECPProject project,
                          boolean opened,
                          boolean store)
This is called by projects to notify observers if a project gets openes or closed.

Parameters:
project - the project that called this method
opened - whether the project is open
store - whether to store the change

notifyObjectsChanged

public void notifyObjectsChanged(ECPProject project,
                                 Collection<Object> objects,
                                 boolean structural)
This is called by projects to notify observers about object changes. First the IECPProjectObjectsChangedObservers are notified then the IECPProjectsChangedUIObservers.

Parameters:
project - the project that called this method
objects - the objects that changed
structural - whether the changes where structural

repositoriesChanged

public void repositoriesChanged(Collection<ECPRepository> oldRepositories,
                                Collection<ECPRepository> newRepositories)
This is called to indicate, that repositories changed.

Specified by:
repositoriesChanged in interface ECPRepositoriesChangedObserver
Parameters:
oldRepositories - repositories before change
newRepositories - repositories after change


Copyright © 2014. All Rights Reserved.