/usr/share/doc/libantelope-java/manual/bk01ch11s02.html is in libantelope-java-doc 3.5.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>API for jEdit Plugin Developers</title><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="index.html" title="Antelope Users Guide"><link rel="up" href="bk01ch11.html" title="Chapter 11. For Developers"><link rel="prev" href="bk01ch11.html" title="Chapter 11. For Developers"><link rel="next" href="bk01ch12.html" title="Chapter 12. Frequently Asked Questions"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">API for jEdit Plugin Developers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01ch11.html">Prev</a> </td><th width="60%" align="center">Chapter 11. For Developers</th><td width="20%" align="right"> <a accesskey="n" href="bk01ch12.html">Next</a></td></tr></table><hr></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="jedit"></a>API for jEdit Plugin Developers</h2></div></div></div>
@style@
<p>
Antelope can be used from other jEdit plugins that may desire to run Ant targets. The public API is described here, plus some examples of how to use this API from other plugins. You can also use this API from a beanshell macro, see the <a class="link" href="bk01ch12.html" title="Chapter 12. Frequently Asked Questions">FAQ section</a>.
</p><p>
</p><pre class="programlisting">
public static File getBuildFile(View view);
</pre><p>
This method returns a reference to the current build file.
</p><p>
</p><pre class="programlisting">
public static String[] getTargetList(File buildFile);
</pre><p>
This method returns a list of the target names in the given build file.
</p><p>
</p><pre class="programlisting">
public static void executeTarget( View view, File buildFile, String target );
</pre><p>
This method executes a target. Since the execution is through Antelope, output will be to the Console plugin and errors will be displayed in the ErrorList plugin. The AntelopePlugin will attempt to find an instance of Antelope for the given view, then execute the target. The target must exist in the given build file.
</p><p>
</p><pre class="programlisting">
public static void setBuildFile(View view, File buildFile);
</pre><p>
This method sets the current build file for the Antelope instance in the given view. Antelope will reload itself to reflect the new build file.
</p><p>
Following are some examples of calling these methods from your plugin. Notice that you do not need the Antelope source or classes to compile or run your plugin, so you do not need to make Antelope a dependency for the PluginManager. The examples only work if Antelope is actually installed as a jEdit plugin and do nothing otherwise. The best place to put these examples is in your plugin's Plugin class. These examples are suitable for copy and paste into your plugin's source code. You will need to import: org.gjt.sp.jedit.EditPlugin, org.gjt.sp.jedit.jEdit, org.gjt.sp.jedit.View, and java.io.File.
</p><p>
This simply returns "true" if Antelope is installed. It is convenient to call this method prior to calling the others.
</p><pre class="programlisting">
public static boolean isAntelopeAvailable() {
EditPlugin ep = jEdit.getPlugin( "ise.antelope.plugin.AntelopePlugin" );
return ep != null;
}
</pre><p>
</p><p>
This method returns a reference to the current build file or null if Antelope is not installed or on any other error.
</p><pre class="programlisting">
public static File getBuildFile(View view) {
if (view == null){
return null;
}
if ( !isAntelopeAvailable() ) {
return null;
}
EditPlugin ep = jEdit.getPlugin( "ise.antelope.plugin.AntelopePlugin" );
try {
Class c = ep.getClass();
java.lang.reflect.Method m = c.getDeclaredMethod( "getBuildFile",
new Class[]{View.class} );
if ( m == null ) {
return null;
}
return (File)m.invoke( null, new Object[]{view} );
}
catch ( Throwable e ) {
}
return null;
}
</pre><p>
</p><p>
This method returns a list of targets in the given build file or null if Antelope is not installed or on any other error.
</p><pre class="programlisting">
public static String[] getTargetList(File buildFile) {
if (buildFile == null || !buildFile.exists()){
return null;
}
if ( !isAntelopeAvailable() ) {
return null;
}
EditPlugin ep = jEdit.getPlugin( "ise.antelope.plugin.AntelopePlugin" );
try {
Class c = ep.getClass();
java.lang.reflect.Method m = c.getDeclaredMethod( "getTargetList",
new Class[]{File.class} );
if ( m == null ) {
return null;
}
return (String[])m.invoke( null, new Object[]{buildFile} );
}
catch ( Throwable e ) {
}
return null;
}
</pre><p>
</p><p>
This method will execute an Ant target via Antelope.
</p><pre class="programlisting">
public static void executeAntTarget(View view, File buildFile, String target) {
if (view == null || buildFile == null || target == null)
return;
if ( !isAntelopeAvailable() ) {
return;
}
EditPlugin ep = jEdit.getPlugin( "ise.antelope.plugin.AntelopePlugin" );
try {
Class c = ep.getClass();
java.lang.reflect.Method m = c.getDeclaredMethod( "executeTarget",
new Class[]{View.class, File.class, String.class} );
if ( m == null ) {
return;
}
m.invoke( null, new Object[]{view, buildFile, target} );
}
catch ( Throwable e ) {
}
}
</pre><p>
</p><p>
This method will cause Antelope to load the given build file.
</p><pre class="programlisting">
public static void setAntelopeBuildFile(View view, File buildFile) {
if (buildFile == null || !buildFile.exists()){
return;
}
if ( !isAntelopeAvailable() ) {
return;
}
EditPlugin ep = jEdit.getPlugin( "ise.antelope.plugin.AntelopePlugin" );
try {
Class c = ep.getClass();
java.lang.reflect.Method m = c.getDeclaredMethod( "setBuildFile",
new Class[]{View.class, File.class} );
if ( m == null ) {
return;
}
m.invoke( null, new Object[]{view, buildFile} );
}
catch ( Throwable e ) {
}
}
</pre><p>
</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01ch11.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="bk01ch11.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01ch12.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 11. For Developers </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 12. Frequently Asked Questions</td></tr></table></div></body></html>
|