public abstract class IOProvider extends Object
IOProvider.getDefault().getIO("MyTab", false)
(pass true if there may be an existing tab with the same name and you want
to write to a new tab).Modifier | Constructor and Description |
---|---|
protected |
IOProvider()
Subclass constructor.
|
Modifier and Type | Method and Description |
---|---|
static IOProvider |
get(String name)
Gets IOProvider of selected name or delegates to getDefault() if none was found.
|
static IOProvider |
getDefault()
Get the default I/O provider.
|
InputOutput |
getIO(String name,
Action[] actions)
Gets a named instance of InputOutput with actions displayed in the
toolbar.
|
InputOutput |
getIO(String name,
Action[] actions,
IOContainer ioContainer)
Gets a named instance of
InputOutput . |
abstract InputOutput |
getIO(String name,
boolean newIO)
Get a named instance of InputOutput, which represents an output tab in
the output window.
|
InputOutput |
getIO(String name,
boolean newIO,
Action[] actions,
IOContainer ioContainer)
Gets a named instance of
InputOutput . |
String |
getName()
Gets name (ID) of provider
|
abstract OutputWriter |
getStdOut()
Support writing to the Output Window on the main tab or a similar output device.
|
public static IOProvider getDefault()
Normally this is taken from Lookup.getDefault()
but if there is no
instance in lookup, a fallback instance is created which just uses the
standard system I/O streams. This is useful for unit tests and perhaps
for standalone usage of various libraries.
public static IOProvider get(String name)
name
- ID of providerpublic abstract InputOutput getIO(String name, boolean newIO)
name
- A localised display name for the tabnewIO
- if true, a new InputOutput
is returned, else an existing InputOutput
of the same name may be returnedInputOutput
instance for accessing the new tabInputOutput
public InputOutput getIO(String name, Action[] actions)
name
- A localized display name for the tabactions
- array of actions that are added to the toolbar, Can be empty array, but not null.
The number of actions should not exceed 5 and each should have the Action.SMALL_ICON
property defined.InputOutput
instance for accessing the new tabIOProvider
and implementing its abstract classes, you are encouraged to override
this method as well. The default implementation falls back to the getIO(name, newIO)
method, ignoring the actions passed.InputOutput
public InputOutput getIO(String name, Action[] actions, IOContainer ioContainer)
InputOutput
. Corresponding IO tab will be placed
in parent container corresponding to provided IOContainer
.name
- A localized display name for the tabactions
- array of actions that are added to the toolbar, Can be empty array, but not null.
The number of actions should not exceed 5 and each should have the Action.SMALL_ICON
property defined.ioContainer
- parent container accessorInputOutput
instance for accessing the new tab
InputOutput
objects need to be
properly closed. Ensure that InputOutput.closeInputOutput()
is
called when returned object is no longer needed, otherwise allocated
memory and other resources will not be freed.IOProvider
and implementing its abstract classes, you are encouraged to override
this method as well. The default implementation falls back to the getIO(name, actions)
method, ignoring the ioContainer passed.InputOutput
@NonNull public InputOutput getIO(@NonNull String name, boolean newIO, @NonNull Action[] actions, @NullAllowed IOContainer ioContainer)
InputOutput
. Corresponding IO tab will be placed
in parent container corresponding to provided IOContainer
.name
- A localized display name for the tabnewIO
- if true, a new InputOutput
is returned, else an existing InputOutput
of the same name may be returnedactions
- array of actions that are added to the toolbar, Can be empty array, but not null.
The number of actions should not exceed 5 and each should have the Action.SMALL_ICON
property defined.ioContainer
- parent container accessorInputOutput
instance for accessing the new tab
InputOutput
objects need to be
properly closed. Ensure that InputOutput.closeInputOutput()
is
called when returned object is no longer needed, otherwise allocated
memory and other resources will not be freed.IOProvider
and implementing its abstract classes, you are encouraged to override
this method as well. The default implementation falls back to the getIO(name, actions)
method, ignoring the ioContainer and newIO passed.InputOutput
public String getName()
IOProvider
you should override this method. The default implementation returns ""public abstract OutputWriter getStdOut()