Modifier and Type | Method and Description |
---|---|
static Shell |
active()
Returns the active shell using the following logic:
|
static Shells |
builder(int style,
Coat coat)
Creates a new Shells for this Coat.
|
static Disposable |
confirmClose(Shell shell,
String title,
String question,
Runnable runOnClose)
Prevents the given shell from closing without prompting.
|
Shells |
dontSetPositionOrSize()
Prevents setting any size or position.
|
Shell |
openOn(Shell parent)
Opens the shell on this parent shell.
|
Shell |
openOnActive()
Opens the shell on the currently active shell.
|
void |
openOnActiveBlocking()
Opens the shell on the currently active shell and blocks.
|
void |
openOnAndBlock(Shell parent)
Deprecated.
for
openOnBlocking(Shell) - same behavior, but name is consistent with the others. |
void |
openOnBlocking(Shell parent)
Opens the shell on this parent and blocks.
|
Shell |
openOnDisplay()
Opens the shell as a root shell.
|
void |
openOnDisplayBlocking()
Opens the shell as a root shell and blocks.
|
Shells |
setAlpha(int alpha)
Sets the alpha for this Shell.
|
Shells |
setBounds(Control control)
Calls
setBounds(Rectangle) to match this control. |
Shells |
setBounds(ControlWrapper wrapper)
Calls
setBounds(Rectangle) to match this control. |
Shells |
setBounds(Rectangle bounds)
Sets the full bounds for this shell.
|
Shells |
setCloseOnEscape(boolean closeOnEscape)
Determines whether the shell will close on escape, defaults to false.
|
Shells |
setDontOpen(boolean dontOpen)
If true, the “openOn” methods will create the shell but not actually open them.
|
Shells |
setImage(Image image)
Sets the title image for this Shell.
|
Shells |
setLocation(Corner corner,
Point position)
Sets the absolute location of the the given corner of this shell.
|
Shells |
setLocation(Point openPosition)
Sets the absolute location of the top-left of this shell.
|
Shells |
setPositionIncludesTrim(boolean positionIncludesTrim)
If true, size and location will set the the “outside” of the Shell - including the trim.
|
Shells |
setRectangle(Rectangle rect)
Calls
setLocation(Point) and setSize(Point) in one line. |
Shells |
setSize(int x,
int y) |
Shells |
setSize(Point size)
Sets the size for this Shell.
|
Shells |
setTitle(String title)
Sets the title for this Shell.
|
public Shells setAlpha(int alpha)
Sets the alpha for this Shell.
public Shells setBounds(Rectangle bounds)
Sets the full bounds for this shell.
Delegates to setRectangle(Rectangle)
and #setPositionIncludesTrim(true)
.
public Shells setBounds(Control control)
Calls setBounds(Rectangle)
to match this control.
public Shells setBounds(ControlWrapper wrapper)
Calls setBounds(Rectangle)
to match this control.
public Shells setRectangle(Rectangle rect)
Calls setLocation(Point)
and setSize(Point)
in one line.
public Shells setSize(@Nullable Point size)
Sets the size for this Shell.
IllegalArgumentException
- if size is non-null and both components are negativepublic Shells setSize(int x, int y)
setSize(Point)
public Shells setLocation(Point openPosition)
Sets the absolute location of the top-left of this shell. If the value is null, the shell will open:
public Shells setLocation(Corner corner, Point position)
Sets the absolute location of the the given corner of this shell. If the value is null, the shell will open:
public Shells setPositionIncludesTrim(boolean positionIncludesTrim)
If true, size and location will set the the “outside” of the Shell - including the trim. If false, it will set the “inside” of the Shell - not including the trim. Default value is true.
public Shells setDontOpen(boolean dontOpen)
If true, the “openOn” methods will create the shell but not actually open them. This is rare and a little awkward, might get changed someday: https://github.com/diffplug/durian-swt/issues/4
public Shells setCloseOnEscape(boolean closeOnEscape)
Determines whether the shell will close on escape, defaults to false.
@Deprecated public void openOnAndBlock(Shell parent)
openOnBlocking(Shell)
- same behavior, but name is consistent with the others.public void openOnBlocking(Shell parent)
Opens the shell on this parent and blocks.
public static Shell active()
Returns the active shell using the following logic:
on Windows and OS X, the active shell is the one that currently has user focus on Linux, the last created shell (even if it is invisible) will count as the active shell
This is a problem because some things create a fake hidden shell to act as a parent for other operations (specifically our right-click infrastructure). This means that on linux, the user right-clicks, a fake shell is created to show a menu, the selected action opens a new shell which uses “openOnActive”, then the menu closes and disposes its fake shell, which promptly closes the newly created shell.
as a workaround, if an active shell is found, but it isn’t visible, we count that as though there isn’t an active shell
we have a similar workaround for no-trim ON_TOP shells, which are commonly used for context-sensitive popups which may close soon after
public Shell openOnActive()
Opens the shell on the currently active shell.
public Shells dontSetPositionOrSize()
Prevents setting any size or position. Does not prevent changing the location and size to ensure that the shell is on-screen.
public void openOnActiveBlocking()
Opens the shell on the currently active shell and blocks.
public Shell openOnDisplay()
Opens the shell as a root shell.
public void openOnDisplayBlocking()
Opens the shell as a root shell and blocks.
public static Disposable confirmClose(Shell shell, String title, String question, Runnable runOnClose)
Prevents the given shell from closing without prompting. Returns a Subscription which can cancel this blocking.