public class SnapUtils extends Object
The following methods can be used to dynamically add/remove actions and action references to/from the SNAP Desktop application:
TheaddAction()
methods all return "file objects" which live in the NetBeans
Platform's virtual file system.
These object can be used to create references to the actions they represent in various places
such as menus and tool bars:
To open a new window in the SNAP Desktop application, the following methods can be used:
Constructor and Description |
---|
SnapUtils() |
Modifier and Type | Method and Description |
---|---|
static org.openide.filesystems.FileObject |
addAction(Action action)
Adds an action into the folder
Menu/Tools of the SNAP Desktop / NetBeans file system. |
static org.openide.filesystems.FileObject |
addAction(Action action,
String path)
Adds an action into the folder given by
path of the SNAP Desktop / NetBeans file system. |
static org.openide.filesystems.FileObject |
addAction(Action action,
String path,
Integer position)
Adds an action into the folder given by
path of the SNAP Desktop / NetBeans file system at the given position . |
static org.openide.filesystems.FileObject |
addActionReference(org.openide.filesystems.FileObject instanceFile,
String path,
Integer position)
Adds an action references into the folder given by
path of the SNAP Desktop / NetBeans file system at the given position . |
static void |
openWindow(org.openide.windows.TopComponent window)
Opens a new window in SNAP Desktop in the "explorer" location.
|
static void |
openWindow(org.openide.windows.TopComponent window,
boolean requestActive)
Opens a new window in SNAP Desktop in the "explorer" location.
|
static void |
openWindow(org.openide.windows.TopComponent window,
String location)
Opens a new window in SNAP Desktop at the given location.
|
static void |
openWindow(org.openide.windows.TopComponent window,
String location,
boolean requestActive)
Opens a new window in SNAP Desktop.
|
static boolean |
removeAction(org.openide.filesystems.FileObject actionFile) |
static boolean |
removeActionReference(org.openide.filesystems.FileObject actionReferenceFile) |
public static org.openide.filesystems.FileObject addAction(Action action)
Menu/Tools
of the SNAP Desktop / NetBeans file system.action
- The action.public static org.openide.filesystems.FileObject addAction(Action action, String path)
path
of the SNAP Desktop / NetBeans file system.action
- The action.path
- The folder path.public static org.openide.filesystems.FileObject addAction(Action action, String path, Integer position)
path
of the SNAP Desktop / NetBeans file system at the given position
.action
- The action.path
- The folder path.position
- The position within the folder. May be null
.public static org.openide.filesystems.FileObject addActionReference(org.openide.filesystems.FileObject instanceFile, String path, Integer position)
path
of the SNAP Desktop / NetBeans file system at the given position
.
The following are standard folders in SNAP Desktop/NetBeans where actions and action references may be placed to
become visible:
Menu/*
- the main menuToolbars/*
- the main tool barinstanceFile
- The file object representing an action instance.path
- The folder path.position
- The position within the folder. May be null
.public static boolean removeAction(org.openide.filesystems.FileObject actionFile)
public static boolean removeActionReference(org.openide.filesystems.FileObject actionReferenceFile)
public static void openWindow(org.openide.windows.TopComponent window)
window
- The window which must must be an instance of TopComponent
.openWindow(TopComponent, String, boolean)
public static void openWindow(org.openide.windows.TopComponent window, boolean requestActive)
window
- The window which must must be an instance of TopComponent
.requestActive
- true
if a request will be made to activate the window after opening it.openWindow(TopComponent, String, boolean)
public static void openWindow(org.openide.windows.TopComponent window, String location)
window
- The window which must must be an instance of TopComponent
.location
- The location where the window should appear when it is first opened.openWindow(TopComponent, String, boolean)
public static void openWindow(org.openide.windows.TopComponent window, String location, boolean requestActive)
window
- The window which must must be an instance of TopComponent
.location
- The location where the window should appear when it is first opened.
Possible docking areas are
"explorer" (upper left), "navigator" (lower left), "properties" (upper right),
"output" (bottom). You may choose "floating" to not dock the window at all. Note
that this mode requires explicitly setting the window's position and size.requestActive
- true
if a request will be made to activate the window after opening it.Copyright © 2014–2015 European Space Agency (ESA). All rights reserved.