public abstract class JavaTestContextMenu
extends java.lang.Object
getMenuApplication
determines which type
of situations the menu should be presented in. Processing the actual selection
action event for the menu item(s) should be processed as you normally would
with the Swing-provided Action mechanisms.
All methods in this API will be invoked on the GUI event thread.Modifier and Type | Field and Description |
---|---|
static int |
CUSTOM |
static int |
FOLDERS_ONLY |
static int |
TESTS_AND_FOLDERS |
static int |
TESTS_ONLY |
Constructor and Description |
---|
JavaTestContextMenu() |
Modifier and Type | Method and Description |
---|---|
abstract javax.swing.JMenuItem |
getMenu()
Get the actual component for this menu.
|
abstract int |
getMenuApplication()
Determine the contexts in which this menu is applicable.
|
boolean |
isMultiSelectAllowed()
May multiple nodes be selected at one time for this menu item to be
enabled.
|
abstract JavaTestContextMenu |
newInstance()
Create a new instance, based on this instance.
|
void |
updateState(java.lang.String path)
Called upon when a folder is selected by the user.
|
void |
updateState(java.lang.String[] folders,
TestResult[] trs)
Called upon when multiple items have been selected by the user.
|
void |
updateState(TestResult tr)
Called upon when a test is selected by the user.
|
public static final int TESTS_AND_FOLDERS
public static final int TESTS_ONLY
public static final int FOLDERS_ONLY
public static final int CUSTOM
public abstract JavaTestContextMenu newInstance()
public abstract javax.swing.JMenuItem getMenu()
public abstract int getMenuApplication()
CUSTOM
, the system managing the menus assumes that
it is allowed to control the enabled/disabled state of the menu item.TESTS_AND_FOLDERS
,
TESTS_ONLY
,
FOLDERS_ONLY
,
CUSTOM
public boolean isMultiSelectAllowed()
false
, override this method to change.
If you need to enable/disabled based on the composition of the selection,
you should return true
, then override updateState(String[],
TestResult[])
and disable if needed.public void updateState(TestResult tr)
CUSTOM
from
getMenuApplication
will generally override this. This method
is called regardless of what application type the object indicates.
The controlling class will first enable/disable the menu based on the
application type (unless CUSTOM
).
This method will be invoked on the GUI event thread.tr
- The test result object which the users is acting upon.public void updateState(java.lang.String path)
path
- public void updateState(java.lang.String[] folders, TestResult[] trs)
folders
- The test paths which the user is acting upon, only the folders.
The strings are forward slash separated locations within the
test suite, a substring of that which would be returned by
TestDescription.getRootRelativeURL()
. Null if
none.trs
- The tests which the user is acting upon. Null if none.TestDescription.getRootRelativeURL()
Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.