An application window is a high-level "main window", with built-in
support for an optional menu bar with standard menus, an optional toolbar,
and an optional status line.
Creating an application window involves the following steps:
creating an instance of ApplicationWindow
assigning the window to a window manager (optional)
opening the window by calling open
Only on the last step, when the window is told to open, are
the window's shell and widget tree created. When the window is
closed, the shell and widget tree are disposed of and are no longer
referenced, and the window is automatically removed from its window
manager. Like all windows, an application window may be reopened.
An application window is also a suitable context in which to perform
long-running operations (that is, it implements IRunnableContext).
Inner Class :class ApplicationWindowLayout extends Layout
Field Summary
protected Label
seperator1 The seperator between the menu bar and the rest of the window.
Constructor Summary
public
ApplicationWindow(Shell parentShell) Create an application window instance, whose shell will be created under the
given parent shell.
Note that the window will have no visual representation (no widgets)
until it is told to open.
Method Summary
protected void
addCoolBar(int style) Configures this window to have a cool bar.
protected void
addMenuBar() Configures this window to have a menu bar.
protected void
addStatusLine() Configures this window to have a status line.
protected void
addToolBar(int style) Configures this window to have a tool bar.
getToolBarManager2() Returns the tool bar manager for this window (if it has one).
public void
run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) This implementation of IRunnableContext#run(boolean, boolean,
IRunnableWithProgress) blocks until the runnable has been run,
regardless of the value of fork.
It is recommended that fork is set to
true in most cases.
public void
setStatus(String message) Sets or clears the message displayed in this window's status
line (if it has one).
protected boolean
showTopSeperator() Returns whether to show a top separator line between the menu bar
and the rest of the window contents.
protected boolean
toolBarChildrenExist() Returns whether or not children exist for the Application Window's
toolbar control.
Create an application window instance, whose shell will be created under the
given parent shell.
Note that the window will have no visual representation (no widgets)
until it is told to open. By default, open does not block.
Parameters: parentShell - the parent shell, or null to create a top-level shell
Configures this window to have a cool bar.
Does nothing if it already has one.
This method must be called before this window's shell is created.
Parameters: style - the cool bar style since: 3.0
Configures this window to have a tool bar.
Does nothing if it already has one.
This method must be called before this window's shell is created.
Parameters: style - swt style bits used to create the Toolbar See Also:ToolBarManager.ToolBarManager(int) See Also: ToolBar See Also: for style bits
Subclasses may override this method to customize the cool bar manager.
Parameters: style - swt style bits used to create the Coolbar a cool bar manager since: 3.0 See Also:CoolBarManager.CoolBarManager(int) See Also: CoolBar See Also: for style bits
By default this method calls createCoolBarManager. Subclasses
may override this method to provide an alternative implementation for the
cool bar manager.
Subclasses may override this method to customize the tool bar manager.
Parameters: style - swt style bits used to create the Toolbar a tool bar manager See Also:ToolBarManager.ToolBarManager(int) See Also: ToolBar See Also: for style bits
By default this method calls createToolBarManager. Subclasses
may override this method to provide an alternative implementation for the
tool bar manager.
Returns the cool bar manager for this window.
the cool bar manager, or null ifthis window does not have a cool bar See Also:ApplicationWindow.addCoolBar(int) since: 3.0
Returns the cool bar manager for this window.
the cool bar manager, or null ifthis window does not have a cool bar See Also:ApplicationWindow.addCoolBar(int) since: 3.2
The default implementation of this framework method
obtains the symbolic name of the font from the
getSymbolicFontName framework method
and retrieves this font from JFace's font
registry using JFaceResources.getFont.
Subclasses may override to use a different registry,
etc.
Returns the menu bar manager for this window (if it has one).
the menu bar manager, or null ifthis window does not have a menu bar See Also:ApplicationWindow.addMenuBar()
Returns the status line manager for this window (if it has one).
the status line manager, or null ifthis window does not have a status line See Also:ApplicationWindow.addStatusLine
Returns the symbolic font name of the font to be
used to display text in this window.
This is not recommended and is included for backwards
compatability.
It is recommended to use the default font provided by
SWT (that is, do not set the font).
the symbolic font name
Returns the tool bar manager for this window (if it has one).
the tool bar manager, or null ifthis window does not have a tool bar See Also:ApplicationWindow.addToolBar(int)
Returns the tool bar manager for this window (if it has one).
the tool bar manager, or null ifthis window does not have a tool bar See Also:ApplicationWindow.addToolBar(int) since: 3.2
This implementation of IRunnableContext#run(boolean, boolean,
IRunnableWithProgress) blocks until the runnable has been run,
regardless of the value of fork.
It is recommended that fork is set to
true in most cases. If fork is set to false,
the runnable will run in the UI thread and it is the runnable's
responsibility to call Display.readAndDispatch()
to ensure UI responsiveness.
Sets or clears the message displayed in this window's status
line (if it has one). This method has no effect if the
window does not have a status line.
Parameters: message - the status message, or null to clear it
Returns whether to show a top separator line between the menu bar
and the rest of the window contents. On some platforms such as the Mac,
the menu is separated from the main window already, so a separator line
is not desired.
true to show the top separator, falseto not show it since: 3.0