classpathhelper.eclipse.ui
Class ClassPathModelMultiplexer

java.lang.Object
  extended byclasspathhelper.eclipse.ui.AbstractClassPathModel
      extended byclasspathhelper.eclipse.ui.ClassPathModelMultiplexer
All Implemented Interfaces:
IClassPathModel

public class ClassPathModelMultiplexer
extends AbstractClassPathModel

IClassPathModel that manages all of the IClassPathModel plugins. Its role is to take the currently selected model source and propogate its changes.

All views should register themselves with this model.

Implementation Notes

This class listens to preference changes so it can switch to the currently selected source, updating all of the views.

This class also resets models when no listeners are registered (such as when all views are closed). This is intended to free up memory that might otherwise be cached.

Since:
1.0
Author:
bharris

Constructor Summary
ClassPathModelMultiplexer()
           
 
Method Summary
 void addClassPathChangeListener(IClassPathChangeListener changeListener)
          Registers a classpath change listener with this model object.
protected  CGClassLoader getCurrentClassLoader()
          Internal method used to obtain the current classloader for addClassPathChangeListener(IClassPathChangeListener).
 boolean removeClassPathChangeListener(IClassPathChangeListener changeListener)
          Deregisteres a classpath change listener with this model object.
 void reset()
          Method that requests that this model reset (and resend) its classpath, clearing any internal caching.
 void startClassPathListening()
          Method called to indicate that this model is the selected model and should start sending classpath change events.
 void stopClassPathListening()
          Method called to indicate that this model is nolonger the selected model and can clean up any listeners it has started (as well as any caching.
 
Methods inherited from class classpathhelper.eclipse.ui.AbstractClassPathModel
fireClassPathChangeEvent, getNumberOfListeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassPathModelMultiplexer

public ClassPathModelMultiplexer()
Since:
1.0
Method Detail

getCurrentClassLoader

protected CGClassLoader getCurrentClassLoader()
Description copied from class: AbstractClassPathModel
Internal method used to obtain the current classloader for AbstractClassPathModel.addClassPathChangeListener(IClassPathChangeListener). If not class loader exists, this method should return null.

Specified by:
getCurrentClassLoader in class AbstractClassPathModel
Returns:
The current class loader.

reset

public void reset()
Description copied from interface: IClassPathModel
Method that requests that this model reset (and resend) its classpath, clearing any internal caching.

Specified by:
reset in interface IClassPathModel
Overrides:
reset in class AbstractClassPathModel

startClassPathListening

public void startClassPathListening()
Description copied from interface: IClassPathModel

Method called to indicate that this model is the selected model and should start sending classpath change events. If a model needs to attach any listeners this is a good point to do so.

A model should also use this call send its initial class loader via its IClassPathChangeListener objects.


stopClassPathListening

public void stopClassPathListening()
Description copied from interface: IClassPathModel
Method called to indicate that this model is nolonger the selected model and can clean up any listeners it has started (as well as any caching.


addClassPathChangeListener

public void addClassPathChangeListener(IClassPathChangeListener changeListener)
Description copied from interface: IClassPathModel
Registers a classpath change listener with this model object. This listener should be immediately notified regarding the current classloader (if there is one) via its callback method. In otherwords calling this method may mean that the listeners callback method is called, only if a class loader already exists.

Specified by:
addClassPathChangeListener in interface IClassPathModel
Overrides:
addClassPathChangeListener in class AbstractClassPathModel

removeClassPathChangeListener

public boolean removeClassPathChangeListener(IClassPathChangeListener changeListener)
Description copied from interface: IClassPathModel
Deregisteres a classpath change listener with this model object.

Specified by:
removeClassPathChangeListener in interface IClassPathModel
Overrides:
removeClassPathChangeListener in class AbstractClassPathModel