Class ElementManager

java.lang.Object
org.eclipse.handly.model.impl.support.ElementManager

public class ElementManager extends Object
Manages element handle/body relationships for a Handly-based model. Generally, each model will have its own instance of the element manager.

An instance of this class is safe for use by multiple threads.

See Also:
  • Field Details

  • Constructor Details

    • ElementManager

      public ElementManager(IBodyCache cache)
      Constructs an element manager with the given body cache.
      Parameters:
      cache - the body cache to be used by the element manager (not null)
  • Method Details

    • getWorkingCopies

      public final ISourceFile[] getWorkingCopies()
      Returns the working copies currently managed by this manager. Performs atomically.

      Note that the result may immediately become stale if other threads can create or destroy working copies that are managed by this manager.

      Returns:
      the working copies currently managed by this manager (never null)
    • close

      protected void close(IElement element, IContext context)
      Attempts to close the given element according to options specified in the given context. If the current state of an open element does not permit closing (e.g., a working copy), it remains open. Closing of an element generally involves closing its children and removal of its body from the body cache. This method is called under the element manager lock.

      Subclasses may override this method, but are not intended to invoke it.

      This implementation invokes ((IElementImplExtension)element).close_(context).

      Parameters:
      element - the element that needs closing (never null)
      context - the operation context (never null)