|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectprojectviewer.PVActions
A collection of actions accessible through jEdit's Action mechanism, and other utility methods that may be interesting for interacting with the plugin.
Constructor Summary | |
PVActions()
|
Method Summary | |
protected static void |
cleanup(org.gjt.sp.jedit.PluginJAR jar)
Used internally to clean up resources when unloading other plugins. |
static void |
closeAllProjectFiles(org.gjt.sp.jedit.View view)
If a project is currently active, close all its files. |
static byte[] |
decodeBase64(java.lang.String data)
Decodes a Base64-encoded string into a byte array. |
static byte[] |
encodeBase64(byte[] data)
Encodes a byte array into a base64-encoded byte array. |
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 VPTProject |
getCurrentProject(org.gjt.sp.jedit.View view)
Deprecated. Use ProjectViewer.getActiveProject(View) instead. |
static void |
launchCurrentBuffer(org.gjt.sp.jedit.View view)
Tries to launch the current buffer in the configured browser for project viewer. |
static java.util.Collection |
listToObjectCollection(java.lang.String list,
org.gjt.sp.jedit.PluginJAR jar,
java.lang.Class base)
Creates a collection of instances from a comma-separated list of class names. |
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 java.util.Collection |
prune(java.util.Collection c,
org.gjt.sp.jedit.PluginJAR jar)
Iterates through the objects in the given collection, removing any objects that were loaded from the given plugin. |
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 java.lang.String |
serialize(java.lang.Object o)
|
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PVActions()
Method Detail |
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 VPTProject getCurrentProject(org.gjt.sp.jedit.View view)
ProjectViewer.getActiveProject(View)
instead.
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 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 java.util.Collection listToObjectCollection(java.lang.String list, org.gjt.sp.jedit.PluginJAR jar, java.lang.Class base)
list
- Comma-separated list of class names of which to create instances.jar
- The plugin JAR that provides the class loader for the classes.base
- The minimal base class to accept for the created objects.public static java.util.Collection prune(java.util.Collection c, org.gjt.sp.jedit.PluginJAR jar)
listToObjectCollection(String,PluginJAR,Class)
, so that
the relationship class -> pluginJAR is registered.
protected static void cleanup(org.gjt.sp.jedit.PluginJAR jar)
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 byte[] encodeBase64(byte[] data)
Note by Marcelo Vanzin: I know about Jakarta Commons Codec. In fact, I used it when my first implementation was not working well. But I don't want to add another jar to the plugin, and I don't want to add a dependency on the Jakarta Commons plugin (and add Codec there) either.
public static byte[] decodeBase64(java.lang.String data)
java.lang.IllegalArgumentException
- If the string length is not a multiple
of 4 (generally, lack of padding).
java.lang.ArrayIndexOutOfBoundsException
- If an unrecognized character is
found in the stream.public static java.lang.String serialize(java.lang.Object o)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |