Class ShellManager
Note: This class must be used from the SWT display thread
- Version:
- 1.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Listprivate static ShellManagerprivate final Listprivate final Collection<org.eclipse.swt.widgets.Shell> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddWindow(org.eclipse.swt.widgets.Shell shell) Adds a shell to the shell manager.final voidaddWindowAddedListener(org.eclipse.swt.widgets.Listener listener) Adds a listener that will be invoked when a shell has been added to the ShellManagerfinal voidaddWindowRemovedListener(org.eclipse.swt.widgets.Listener listener) Adds a listener that will be invoked when a shell has been removed from the ShellManagerprotected final CollectionGets the set of managed shellsfinal intgetSize()Gets the number of shells the ShellManager managesprotected org.eclipse.swt.widgets.EventgetSWTEvent(org.eclipse.swt.widgets.Shell shell) Gets a generated SWT Event based on the shellfinal Iterator<org.eclipse.swt.widgets.Shell> Gets the shells managed by the manager as an Iteratorfinal booleanisEmpty()Gets whether the ShellManager manages no shellsprotected final voidnotifyAddListeners(org.eclipse.swt.widgets.Shell sender) Notifies the WindowAddedListener handlersprotected final voidnotifyRemoveListeners(org.eclipse.swt.widgets.Shell sender) Notifies the WindowRemovedListener handlersfinal voidperformForShells(org.eclipse.swt.widgets.Listener command) Invokes the handleEvent method specified by the SWT listener for each managed shellfinal voidremoveWindow(org.eclipse.swt.widgets.Shell shell) Removes a shell from the shell managerfinal voidremoveWindowAddedListener(org.eclipse.swt.widgets.Listener listener) Removes a listener that will be invoked when a shell has been added to the ShellManagerfinal voidremoveWindowRemovedListener(org.eclipse.swt.widgets.Listener listener) Removes a listener that will be invoked when a shell has been removed from the ShellManagerstatic final ShellManagerGets the application's shared shell manager
-
Field Details
-
instance
-
shells
-
addHandlers
-
removeHandlers
-
-
Constructor Details
-
ShellManager
public ShellManager()
-
-
Method Details
-
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
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
-
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