Class ShellManager
- java.lang.Object
-
- com.biglybt.ui.swt.components.shell.ShellManager
-
public class ShellManager extends java.lang.Object
ShellManager provides a logical grouping for a set of shellsNote: This class must be used from the SWT display thread
- Version:
- 1.0
- See Also:
org.eclipse.jface.window.WindowManager
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List
addHandlers
private static ShellManager
instance
private java.util.List
removeHandlers
private java.util.Collection<org.eclipse.swt.widgets.Shell>
shells
-
Constructor Summary
Constructors Constructor Description ShellManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addWindow(org.eclipse.swt.widgets.Shell shell)
Adds a shell to the shell manager.void
addWindowAddedListener(org.eclipse.swt.widgets.Listener listener)
Adds a listener that will be invoked when a shell has been added to the ShellManagervoid
addWindowRemovedListener(org.eclipse.swt.widgets.Listener listener)
Adds a listener that will be invoked when a shell has been removed from the ShellManagerprotected java.util.Collection
getManagedShellSet()
Gets the set of managed shellsint
getSize()
Gets the number of shells the ShellManager managesprotected org.eclipse.swt.widgets.Event
getSWTEvent(org.eclipse.swt.widgets.Shell shell)
Gets a generated SWT Event based on the shelljava.util.Iterator<org.eclipse.swt.widgets.Shell>
getWindows()
Gets the shells managed by the manager as an Iteratorboolean
isEmpty()
Gets whether the ShellManager manages no shellsprotected void
notifyAddListeners(org.eclipse.swt.widgets.Shell sender)
Notifies the WindowAddedListener handlersprotected void
notifyRemoveListeners(org.eclipse.swt.widgets.Shell sender)
Notifies the WindowRemovedListener handlersvoid
performForShells(org.eclipse.swt.widgets.Listener command)
Invokes the handleEvent method specified by the SWT listener for each managed shellvoid
removeWindow(org.eclipse.swt.widgets.Shell shell)
Removes a shell from the shell managervoid
removeWindowAddedListener(org.eclipse.swt.widgets.Listener listener)
Removes a listener that will be invoked when a shell has been added to the ShellManagervoid
removeWindowRemovedListener(org.eclipse.swt.widgets.Listener listener)
Removes a listener that will be invoked when a shell has been removed from the ShellManagerstatic ShellManager
sharedManager()
Gets the application's shared shell manager
-
-
-
Field Detail
-
instance
private static ShellManager instance
-
shells
private final java.util.Collection<org.eclipse.swt.widgets.Shell> shells
-
addHandlers
private final java.util.List addHandlers
-
removeHandlers
private final java.util.List removeHandlers
-
-
Method Detail
-
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 managerNote: This method must be invoked by the SWT display thread
- Parameters:
shell
- A SWT Shell
-
getWindows
public final java.util.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 java.util.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
-
-