Class ShellManager

java.lang.Object
com.biglybt.ui.swt.components.shell.ShellManager

public class ShellManager extends Object
ShellManager provides a logical grouping for a set of shells

Note: This class must be used from the SWT display thread

Version:
1.0
See Also:
  • invalid reference
    org.eclipse.jface.window.WindowManager
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final List
     
    private static ShellManager
     
    private final List
     
    private final Collection<org.eclipse.swt.widgets.Shell>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    addWindow(org.eclipse.swt.widgets.Shell shell)
    Adds a shell to the shell manager.
    final void
    addWindowAddedListener(org.eclipse.swt.widgets.Listener listener)
    Adds a listener that will be invoked when a shell has been added to the ShellManager
    final void
    addWindowRemovedListener(org.eclipse.swt.widgets.Listener listener)
    Adds a listener that will be invoked when a shell has been removed from the ShellManager
    protected final Collection
    Gets the set of managed shells
    final int
    Gets the number of shells the ShellManager manages
    protected org.eclipse.swt.widgets.Event
    getSWTEvent(org.eclipse.swt.widgets.Shell shell)
    Gets a generated SWT Event based on the shell
    final Iterator<org.eclipse.swt.widgets.Shell>
    Gets the shells managed by the manager as an Iterator
    final boolean
    Gets whether the ShellManager manages no shells
    protected final void
    notifyAddListeners(org.eclipse.swt.widgets.Shell sender)
    Notifies the WindowAddedListener handlers
    protected final void
    notifyRemoveListeners(org.eclipse.swt.widgets.Shell sender)
    Notifies the WindowRemovedListener handlers
    final void
    performForShells(org.eclipse.swt.widgets.Listener command)
    Invokes the handleEvent method specified by the SWT listener for each managed shell
    final void
    removeWindow(org.eclipse.swt.widgets.Shell shell)
    Removes a shell from the shell manager
    final void
    removeWindowAddedListener(org.eclipse.swt.widgets.Listener listener)
    Removes a listener that will be invoked when a shell has been added to the ShellManager
    final void
    removeWindowRemovedListener(org.eclipse.swt.widgets.Listener listener)
    Removes a listener that will be invoked when a shell has been removed from the ShellManager
    static final ShellManager
    Gets the application's shared shell manager

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • instance

      private static ShellManager instance
    • shells

      private final Collection<org.eclipse.swt.widgets.Shell> shells
    • addHandlers

      private final List addHandlers
    • removeHandlers

      private final List removeHandlers
  • Constructor Details

    • ShellManager

      public ShellManager()
  • Method Details

    • sharedManager

      public static final ShellManager sharedManager()

      Gets the application's shared shell manager

      This ShellManager has no bearing on other ShellManager instances

      Note: This method must be invoked by the SWT display thread

      Returns:
    • addWindow

      public final void addWindow(org.eclipse.swt.widgets.Shell shell)
      Adds a shell to the shell manager. If the shell is already managed, it is not added again.

      Note: This method must be invoked by the SWT display thread

      Parameters:
      shell - A SWT Shell
    • removeWindow

      public final void removeWindow(org.eclipse.swt.widgets.Shell shell)
      Removes a shell from the shell manager

      Note: This method must be invoked by the SWT display thread

      Parameters:
      shell - A SWT Shell
    • getWindows

      public final Iterator<org.eclipse.swt.widgets.Shell> getWindows()

      Gets the shells managed by the manager as an Iterator

      The order in which the shells were added are retained.

      Note: This method must be invoked by the SWT display thread

      Returns:
      The iterator
    • isEmpty

      public final boolean isEmpty()
      Gets whether the ShellManager manages no shells
      Returns:
      True if ShellManager is empty
    • getSize

      public final int getSize()
      Gets the number of shells the ShellManager manages
      Returns:
      The number
    • performForShells

      public final void performForShells(org.eclipse.swt.widgets.Listener command)

      Invokes the handleEvent method specified by the SWT listener for each managed shell

      The event's widget is set to the reference of the shell invoking it

      Parameters:
      command - A command implemented as a SWT Listener
    • getManagedShellSet

      protected final Collection getManagedShellSet()
      Gets the set of managed shells
      Returns:
      The set
    • addWindowAddedListener

      public final void addWindowAddedListener(org.eclipse.swt.widgets.Listener listener)

      Adds a listener that will be invoked when a shell has been added to the ShellManager

      The listener and the shell will automatically be removed when the shell is disposed

      Parameters:
      listener - A SWT Listener
    • removeWindowAddedListener

      public final void removeWindowAddedListener(org.eclipse.swt.widgets.Listener listener)
      Removes a listener that will be invoked when a shell has been added to the ShellManager
      Parameters:
      listener - A SWT Listener
    • addWindowRemovedListener

      public final void addWindowRemovedListener(org.eclipse.swt.widgets.Listener listener)
      Adds a listener that will be invoked when a shell has been removed from the ShellManager
      Parameters:
      listener - A SWT Listener
    • removeWindowRemovedListener

      public final void removeWindowRemovedListener(org.eclipse.swt.widgets.Listener listener)
      Removes a listener that will be invoked when a shell has been removed from the ShellManager
      Parameters:
      listener - A SWT Listener
    • notifyAddListeners

      protected final void notifyAddListeners(org.eclipse.swt.widgets.Shell sender)
      Notifies the WindowAddedListener handlers
      Parameters:
      sender - A SWT shell that "sends" the events
    • notifyRemoveListeners

      protected final void notifyRemoveListeners(org.eclipse.swt.widgets.Shell sender)
      Notifies the WindowRemovedListener handlers
      Parameters:
      sender - A SWT shell that "sends" the events
    • getSWTEvent

      protected org.eclipse.swt.widgets.Event getSWTEvent(org.eclipse.swt.widgets.Shell shell)

      Gets a generated SWT Event based on the shell

      The widget field of the event should be set to the shell

      Parameters:
      shell - A SWT Shell
      Returns:
      The event