Methods Summary |
---|
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
//Debug.out("Invoked by thread " + Thread.currentThread().getName());
if(shells.contains(shell)) {return;}
shells.add(shell);
notifyAddListeners(shell);
shell.addDisposeListener(new DisposeListener()
{
public void widgetDisposed(DisposeEvent event)
{
try {
removeWindow(shell);
} catch (Exception e) {
Logger.log(new LogEvent(LogIDs.GUI, "removeWindow", e));
}
}
});
shell.addListener(SWT.Show, new Listener() {
public void handleEvent(Event event) {
Utils.verifyShellRect(shell, false);
}
});
|
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
addHandlers.add(listener);
|
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
removeHandlers.add(listener);
|
protected final java.util.Collection | getManagedShellSet()Gets the set of managed shells
return shells;
|
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
Event e = new Event();
e.widget = shell;
e.item = shell;
return e;
|
public final int | getSize()Gets the number of shells the ShellManager manages
return shells.size();
|
public final java.util.Iterator | 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
return shells.iterator();
|
public final boolean | isEmpty()Gets whether the ShellManager manages no shells
return shells.isEmpty();
|
protected final void | notifyAddListeners(org.eclipse.swt.widgets.Shell sender)Notifies the WindowAddedListener handlers
Iterator iter = addHandlers.iterator();
for(int i = 0; i < addHandlers.size(); i++)
{
((Listener)iter.next()).handleEvent(getSWTEvent(sender));
}
|
protected final void | notifyRemoveListeners(org.eclipse.swt.widgets.Shell sender)Notifies the WindowRemovedListener handlers
Iterator iter = removeHandlers.iterator();
for(int i = 0; i < removeHandlers.size(); i++)
{
((Listener)iter.next()).handleEvent(getSWTEvent(sender));
}
|
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
Iterator iter = shells.iterator();
for(int i = 0; i < shells.size(); i++)
{
Shell aShell = (Shell)iter.next();
Event evt = new Event();
evt.widget = aShell;
evt.data = this;
command.handleEvent(evt);
}
|
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
shells.remove(shell);
notifyRemoveListeners(shell);
|
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
addHandlers.remove(listener);
|
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
removeHandlers.remove(listener);
|
public static final org.gudy.azureus2.ui.swt.components.shell.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
instance = new ShellManager();
return instance;
|