Class WindowManager

java.lang.Object
org.eclipse.jface.window.WindowManager

public class WindowManager extends Object
A manager for a group of windows. Window managers are an optional JFace feature used in applications which create many different windows (dialogs, wizards, etc.) in addition to a main window. A window manager can be used to remember all the windows that an application has created (independent of whether they are presently open or closed). There can be several window managers, and they can be arranged into a tree. This kind of organization makes it simple to close whole subgroupings of windows.

Creating a window manager is as simple as creating an instance of WindowManager. Associating a window with a window manager is done with WindowManager.add(Window). A window is automatically removed from its window manager as a side effect of closing the window.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an empty window manager without a parent window manager (that is, a root window manager).
    Creates an empty window manager with the given window manager as parent.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(Window window)
    Adds the given window to the set of windows managed by this window manager.
    boolean
    Attempts to close all windows managed by this window manager, as well as windows managed by any descendent window managers.
    int
    Returns this window manager's number of windows
    Returns this window manager's set of windows.
    final void
    remove(Window window)
    Removes the given window from the set of windows managed by this window manager.

    Methods inherited from class java.lang.Object

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

    • WindowManager

      public WindowManager()
      Creates an empty window manager without a parent window manager (that is, a root window manager).
    • WindowManager

      public WindowManager(WindowManager parent)
      Creates an empty window manager with the given window manager as parent.
      Parameters:
      parent - the parent window manager
  • Method Details

    • add

      public void add(Window window)
      Adds the given window to the set of windows managed by this window manager. Does nothing is this window is already managed by this window manager.
      Parameters:
      window - the window
    • close

      public boolean close()
      Attempts to close all windows managed by this window manager, as well as windows managed by any descendent window managers.
      Returns:
      true if all windows were successfully closed, and false if any window refused to close
    • getWindowCount

      public int getWindowCount()
      Returns this window manager's number of windows
      Returns:
      the number of windows
      Since:
      3.0
    • getWindows

      public Window[] getWindows()
      Returns this window manager's set of windows.
      Returns:
      a possibly empty list of window
    • remove

      public final void remove(Window window)
      Removes the given window from the set of windows managed by this window manager. Does nothing is this window is not managed by this window manager.
      Parameters:
      window - the window