public final class PVActions
extends java.lang.Object
Part of Project Viewer api should not be used from outside Project Viewer, although it is public in java sense. Some methods are considered internal and their public signature comes only from the layout of packages. Many of those methods have javadoc remarks, that forbids outside usage. But there may still be a lot of methods, which are not marked, but it's better not to use them. Improper usage of those methods may lead to data corruption or application failures. From the other side they may change and break other plugins. To be safe it's best to limit the public api to the following list:
ProjectManager.getInstance()
ProjectManager.getProjects()
ProjectViewer.getActiveProject(org.gjt.sp.jedit.View)
ProjectViewer.getViewer(org.gjt.sp.jedit.View)
PVActions
- all
ImportUtils.getImportFilterId(projectviewer.vpt.VPTProject)
ImportUtils.setImportFilterId(projectviewer.vpt.VPTProject, java.lang.String)
projectviewer.vpt
- simple methods from the package
Constructor and Description |
---|
PVActions() |
Modifier and Type | Method and Description |
---|---|
static void |
addCurrentBuffer(org.gjt.sp.jedit.View v) |
static void |
browseProjectRoot(org.gjt.sp.jedit.View view)
Show project root dir in the VFS Browser
|
static java.lang.String |
clipText(java.lang.String base,
int maxWidth,
java.awt.FontMetrics metrics,
boolean clipEnd)
Returns a string that fits in the given bounds based on the
given metrics.
|
static void |
closeAllProjectFiles(org.gjt.sp.jedit.View view)
If a project is currently active, close all its files.
|
static VPTProject |
createProject(VPTGroup parent)
Opens project creation dialog.
|
static VPTProject |
createProject(VPTGroup parent,
int flags)
Opens project creation dialog, like in "Add project" action, but
it does not depend on currently selected node.
|
static VPTProject |
createProject(VPTProject proj,
VPTGroup parent,
int flags)
Opens project creation dialog, like in "Add project" action, but
it does not depend on currently selected node.
|
static void |
editCurrentProject(org.gjt.sp.jedit.View v,
java.lang.String startupPane)
Opens project properties pane for the active project or for the
project pointed by the selected node.
|
static void |
editProject(VPTProject proj,
java.lang.String startupPane)
Opens project properties pane for a given project.
|
static boolean |
focusActiveBuffer(org.gjt.sp.jedit.View v,
VPTNode where)
Check the current active node in the given view and see if
a node representing the current active buffer is a descendant
of that node.
|
static void |
focusProjectViewer(org.gjt.sp.jedit.View view)
If a project viewer window is open in the current view, make sure it's
visible and them focus the active tree; if it's not open, open it and
then focus the active tree.
|
static void |
launchCurrentBuffer(org.gjt.sp.jedit.View view)
Tries to launch the current buffer in the configured browser for
project viewer.
|
static void |
newFile(org.gjt.sp.jedit.View v) |
static org.xml.sax.XMLReader |
newXMLReader(org.xml.sax.helpers.DefaultHandler handler)
Returns a new SAX 2.0 parser; convenience method that catches
all exceptions and prints a log message in case they occur
(returning null).
|
static void |
openAllProjectFiles(org.gjt.sp.jedit.View view)
If a project is currently active, open all its files.
|
static void |
openParentGroup(org.gjt.sp.jedit.View v) |
static void |
pvActionWrapper(Action a,
org.gjt.sp.jedit.View v,
boolean force)
Used to execute a PV action from the jEdit action mechanism.
|
static void |
removeAllProjectFiles(org.gjt.sp.jedit.View view)
Removes all the children from the project active in the view.
|
static void |
requestFocus(java.awt.Component c)
Requests the focus for the given component.
|
static void |
searchInProject(org.gjt.sp.jedit.View view) |
static void |
setActiveFromSelectedNode(org.gjt.sp.jedit.View v) |
static java.lang.String |
stripSeparator(java.lang.String path)
Strips the trailing file separator from a path, if it exists.
|
static void |
swingInvoke(java.lang.Runnable r)
Invokes the given runnable in the AWT Event Dispatcher Thread.
|
static void |
writeXML(java.lang.String str,
java.io.Writer out)
Writes the given String to the output, taking care to escape any
caharcters that need escaping.
|
public static void openAllProjectFiles(org.gjt.sp.jedit.View view)
public static void closeAllProjectFiles(org.gjt.sp.jedit.View view)
public static void removeAllProjectFiles(org.gjt.sp.jedit.View view)
public static void focusProjectViewer(org.gjt.sp.jedit.View view)
public static void requestFocus(java.awt.Component c)
public static void browseProjectRoot(org.gjt.sp.jedit.View view)
public static void launchCurrentBuffer(org.gjt.sp.jedit.View view)
public static boolean focusActiveBuffer(org.gjt.sp.jedit.View v, VPTNode where)
v
- The view to ask for the active buffer.where
- Where to look for the node (null will start the
search at the active node for the given view).public static void newFile(org.gjt.sp.jedit.View v)
public static void setActiveFromSelectedNode(org.gjt.sp.jedit.View v)
public static void openParentGroup(org.gjt.sp.jedit.View v)
public static void addCurrentBuffer(org.gjt.sp.jedit.View v)
public static void editCurrentProject(org.gjt.sp.jedit.View v, java.lang.String startupPane)
startupPane
- The name of the pane is declared in
OptionPane's constructor, for example
"projectviewer.auto_reimport_props".
Possible null
.public static void editProject(VPTProject proj, java.lang.String startupPane)
startupPane
- The name of the pane is declared in
OptionPane's constructor, for example
"projectviewer.auto_reimport_props".
Possible null
.public static VPTProject createProject(VPTProject proj, VPTGroup parent, int flags)
proj
- A new VPTProject
object, with some
fields set by the caller. May be null
.parent
- A parent group. If null
, root node
assumed.flags
- AddProjectAction.NO_IMPORT
or
AddProjectAction.NO_FLAGS
null
if user cancelled the dialog.public static VPTProject createProject(VPTGroup parent, int flags)
parent
- A parent group. If null
, root node
assumed.flags
- AddProjectAction.NO_IMPORT
or
AddProjectAction.NO_FLAGS
null
if user cancelled the dialog.public static VPTProject createProject(VPTGroup parent)
createProject(VPTGroup, int)
, but with no flags.public static void pvActionWrapper(Action a, org.gjt.sp.jedit.View v, boolean force)
Used to execute a PV action from the jEdit action mechanism. This is
meant to be called from beanshell code in the action.xml file. It
will check if the action accepts the current selected tree nodes
before executing it by using the
prepareForNode()
method and then
checking the visibility of the component returned by
getMenuItem()
, unless the "force" parameter
is set to true. When forcing the execution, no checks are made, so it
may be the case that the viewer doesn't exist yet and there's no
active project for the current view.
When executing the action, a null is passed as the event in the actionPerformed method, so this won't work for actions that expect a proper event notification.
public static void writeXML(java.lang.String str, java.io.Writer out) throws java.io.IOException
java.io.IOException
public static void swingInvoke(java.lang.Runnable r)
public static org.xml.sax.XMLReader newXMLReader(org.xml.sax.helpers.DefaultHandler handler)
public static java.lang.String clipText(java.lang.String base, int maxWidth, java.awt.FontMetrics metrics, boolean clipEnd)
base
- The base string.maxWidth
- Width within which the string should fit.metrics
- Font metrics to use.clipEnd
- true if should clip the end of the string.public static void searchInProject(org.gjt.sp.jedit.View view)
public static java.lang.String stripSeparator(java.lang.String path)
path
- The path.