Java Doc for EditPlugin.java in  » Swing-Library » jEdit » org » gjt » sp » jedit » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Swing Library » jEdit » org.gjt.sp.jedit 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.gjt.sp.jedit.EditPlugin

All known Subclasses:   jars.QuickNotepad.QuickNotepadPlugin,  jars.LatestVersion.LatestVersionPlugin,  org.gjt.sp.jedit.EBPlugin,
EditPlugin
abstract public class EditPlugin (Code)
The abstract base class that every plugin must implement. Alternatively, instead of extending this class, a plugin core class can extend EBPlugin to automatically receive EditBus messages.

Basic plugin information properties

Note that in all cases above where a className is needed, the fully qualified class name, including the package name, if any, must be used.

The following properties are required for jEdit to load the plugin:

  • plugin.className.activate - set this to defer if your plugin only needs to be loaded when it is first invoked; set it to startup if your plugin must be loaded at startup regardless; set it to a whitespace-separated list of property names if your plugin should be loaded if at least one of these properties is set. Note that if this property is not set, the plugin will not work with jEdit 4.3final.
  • plugin.className.name
  • plugin.className.version
  • plugin.className.jars - only needed if your plugin bundles external JAR files. Contains a whitespace-separated list of JAR file names. Without this property, the plugin manager will leave behind the external JAR files when removing the plugin.
  • plugin.className.files - only needed if your plugin bundles external files like libraries which MUST reside in the local filesystem. Contains a whitespace-separated list of file names. Without this property, the plugin manager will leave behind the external files when removing the plugin.
  • plugin.className.description - the short description associated with the plugin. The short description is used by the Plugin Manager and on the list pages on Plugin Central.
The following properties are optional but recommended:
  • plugin.className.author
  • plugin.className.usePluginHome - whether the plugin uses the EditPlugin.getPluginHome API or not. Even if the plugin doesn't store any data, this property should be set so that the plugin manager can tell that there is no data stored.
  • plugin.className.docs - the path to plugin documentation in HTML format.
  • plugin.className.longdescription - the path to the long description in XHTML (no fancy stuff here, please - just proper XHTML subset with the basic tags: html, h1, h2, p, li, ul, ol, a href,b ,i, u, br/ )

    The long description is extracted from the plugin at various times, primarily at plugin packaging time to update the data on the plugin detail pages of Plugin Central.

    If this property is left out, the default will be to look in a file called <description.html>.

For the previous two properties, if a relative path is supplied, it should be both

  1. relative to the location of the .props file (when it is in the source tree)
  2. relative to the root of the JAR (when it is packaged in the JAR file)

Both conditions are easily satisfied if the .props file as well as description.html are both located in the root directory of the plugin, as well as the generated JAR.

Plugin dependency properties

Plugin dependencies are also specified using properties. Each dependency is defined in a property named with plugin.className.depend. followed by a number. Dependencies must be numbered in order, starting from zero. This determines the order that dependent plugins get loaded and activated, so order is very important.

The value of a dependency property has one of the following forms:

  • jdk minimumJavaVersion
  • jedit minimumjEditVersion - note that this must be a version number in the form returned by jEdit.getBuild , not jEdit.getVersion . Note that the documentation here describes the jEdit 4.2 plugin API, so this dependency must be set to at least 04.02.99.00 (4.2final).
  • pluginClassName pluginVersion - the fully quailified plugin class name with package must be specified.
  • optional plugin pluginClassName pluginVersion - an optional dependency, indicating that the plugin will work without it, but that the dependency should be loaded before this plugin.

In this example, the ProjectViewer plugin is an optional dependency of the Console, beacause the Console only listens to events from the ProjectViewer. It requires Jedit 4.2 final.

 plugin.console.ConsolePlugin.depend.0=jedit 04.02.99.00
 plugin.console.ConsolePlugin.depend.1=jdk 1.5
 plugin.console.ConsolePlugin.depend.2=plugin errorlist.ErrorListPlugin 1.4
 plugin.console.ConsolePlugin.depend.3=optional plugin projectviewer.ProjectPlugin 2.1.0.92
 

Plugin menu item properties

To add your plugin to the view's Plugins menu, define one of these two properties:

  • plugin.className.menu-item - if this is defined, the action named by this property is added to the Plugins menu.
  • plugin.className.menu - if this is defined, a sub-menu is added to the Plugins menu whose content is the whitespace-separated list of action names in this property. A separator may be added to the sub-menu by listing - in the property.

If you want the plugin's menu items to be determined at runtime, define a property plugin.className.menu.code to be BeanShell code that evaluates to an implementation of org.gjt.sp.jedit.menu.DynamicMenuProvider .

To add your plugin to the file system browser's Plugins menu, define one of these two properties:

  • plugin.className.browser-menu-item - if this is defined, the action named by this property is added to the Plugins menu.
  • plugin.className.browser-menu - if this is defined, a sub-menu is added to the Plugins menu whose content is the whitespace-separated list of action names in this property. A separator may be added to the sub-menu by listing - in the property.

In all cases, each action's menu item label is taken from the actionName.label property. View actions are defined in an actions.xml file, file system browser actions are defined in a browser.actions.xml file; see ActionSet .

Plugin option pane properties

To add your plugin to the Plugin Options dialog box, define one of these two properties:

  • plugin.className.option-pane=paneName - if this is defined, a single option pane with this name is added to the Plugin Options menu.
  • plugin.className.option-group=paneName1 [paneName2 paneName3 ...] - if this is defined, a branch node is added to the Plugin Options dialog box whose content is the whitespace-separated list of paneNames in this property.
Then for each option paneName, define these two properties:

Inner Class :public static class Broken extends EditPlugin
Inner Class :public static class Deferred extends EditPlugin

Field Summary
 PluginJARjar
    


Method Summary
final public  JMenuItemcreateBrowserMenuItems()
     Called by the filesystem browser when constructing its Plugins menu.
final public  JMenuItemcreateMenuItems()
     Called by the view when constructing its Plugins menu.
public  voidcreateMenuItems(Vector menuItems)
    
public  voidcreateOptionPanes(OptionsDialog optionsDialog)
    
public  StringgetClassName()
     Returns the plugin's class name.
public  FilegetPluginHome()
     Returns the home of your plugin. the plugin home.
public static  FilegetPluginHome(Class<? extends EditPlugin> clazz)
    

Returns the home of the specified plugin.

Since the first parameter is a reference to the Class instance for the plugin, this method requires the plugin to be activated.

See EditPlugin.getPluginHome(EditPlugin) method, as an alternate, for when the plugin doesn't need to be activated, or when you do not have the Class instance available.


Parameters:
  clazz - the class of the plugin the plugin home.
public static  FilegetPluginHome(EditPlugin plugin)
    

Returns the home of the specified plugin.

This method doesn't need the plugin to be activated.

public  PluginJARgetPluginJAR()
     Returns the JAR file containing this plugin.
public static  OutputStreamgetResourceAsOutputStream(Class<? extends EditPlugin> clazz, String path)
    

Returns an output stream to the specified resource, or null if access to that resource is denied.

Since the first parameter is a reference to the Class instance for the plugin, this method requires the plugin to be activated.

See EditPlugin.getResourceAsOutputStream(EditPlugin,String) method, as an alternate, for when the plugin doesn't need to be activated, or when you do not have the Class instance available.


Parameters:
  clazz - the plugin class
Parameters:
  path - The path to the resource to be returned, relative tothe plugin's resource path.
public static  OutputStreamgetResourceAsOutputStream(EditPlugin plugin, String path)
    

Returns an output stream to the specified resource, or null if access to that resource is denied.

This method doesn't need the plugin to be activated.

public static  InputStreamgetResourceAsStream(Class<? extends EditPlugin> clazz, String path)
    

Returns an input stream to the specified resource, or null if none is found.

Since the first parameter is a reference to the Class instance for the plugin, this method requires the plugin to be activated.

See EditPlugin.getResourceAsStream(EditPlugin,String) method, as an alternate, for when the plugin doesn't need to be activated, or when you do not have the Class instance available.


Parameters:
  clazz - the plugin class
Parameters:
  path - The path to the resource to be returned, relative tothe plugin's resource path.
public static  InputStreamgetResourceAsStream(EditPlugin plugin, String path)
    

Returns an input stream to the specified resource, or null if none is found.

This method doesn't need the plugin to be activated.

public static  FilegetResourcePath(Class<? extends EditPlugin> clazz, String path)
    

Returns the full path of the specified plugin resource.

Since the first parameter is a reference to the Class instance for the plugin, this method requires the plugin to be activated.

See EditPlugin.getResourcePath(EditPlugin,String) method, as an alternate, for when the plugin doesn't need to be activated, or when you do not have the Class instance available.


Parameters:
  clazz - the plugin class
Parameters:
  path - The relative path to the resource from the plugin'sresource path.
public static  FilegetResourcePath(EditPlugin plugin, String path)
    

Returns the full path of the specified plugin resource.

This method doesn't need the plugin to be activated.

public  voidstart()
     jEdit calls this method when the plugin is being activated, either during startup or at any other time.
public  voidstop()
     jEdit calls this method when the plugin is being unloaded.

Field Detail
jar
PluginJAR jar(Code)





Method Detail
createBrowserMenuItems
final public JMenuItem createBrowserMenuItems()(Code)
Called by the filesystem browser when constructing its Plugins menu. See the description of this class for details about how the menu items are constructed from plugin properties.
since:
   jEdit 4.2pre1



createMenuItems
final public JMenuItem createMenuItems()(Code)
Called by the view when constructing its Plugins menu. See the description of this class for details about how the menu items are constructed from plugin properties.
since:
   jEdit 4.2pre1



createMenuItems
public void createMenuItems(Vector menuItems)(Code)



createOptionPanes
public void createOptionPanes(OptionsDialog optionsDialog)(Code)



getClassName
public String getClassName()(Code)
Returns the plugin's class name. This might not be the same as the class of the actual EditPlugin instance, for example if the plugin is not loaded yet.
since:
   jEdit 2.5pre3



getPluginHome
public File getPluginHome()(Code)
Returns the home of your plugin. the plugin home. It can be null if there is no settings directory
since:
   4.3pre10
See Also:   EditPlugin.getResourceAsStream
See Also:   EditPlugin.getResourceAsOutputStream
See Also:   EditPlugin.getResourcePath



getPluginHome
public static File getPluginHome(Class<? extends EditPlugin> clazz)(Code)

Returns the home of the specified plugin.

Since the first parameter is a reference to the Class instance for the plugin, this method requires the plugin to be activated.

See EditPlugin.getPluginHome(EditPlugin) method, as an alternate, for when the plugin doesn't need to be activated, or when you do not have the Class instance available.


Parameters:
  clazz - the class of the plugin the plugin home. It can be null if there is nosettings directory
since:
   4.3pre10
See Also:   EditPlugin.getPluginHome(EditPlugin)
See Also:   EditPlugin.getResourceAsStream
See Also:   EditPlugin.getResourceAsOutputStream
See Also:   EditPlugin.getResourcePath



getPluginHome
public static File getPluginHome(EditPlugin plugin)(Code)

Returns the home of the specified plugin.

This method doesn't need the plugin to be activated. You can pass an EditPlugin.Deferred instance that you get from jEdit.getPlugin(String) or jEdit.getPlugins() if the plugin in question is not activated yet and this method doesn't cause the plugin to get activated. If you have a reference to the plugins Class instance available, consider using the Class method.


Parameters:
  plugin - the plugin the plugin home. It can be null if there is no settings directory
since:
   4.3pre10
See Also:   EditPlugin.getPluginHome(Class)
See Also:   EditPlugin.getResourceAsStream
See Also:   EditPlugin.getResourceAsOutputStream
See Also:   EditPlugin.getResourcePath



getPluginJAR
public PluginJAR getPluginJAR()(Code)
Returns the JAR file containing this plugin.
since:
   jEdit 4.2pre1



getResourceAsOutputStream
public static OutputStream getResourceAsOutputStream(Class<? extends EditPlugin> clazz, String path)(Code)

Returns an output stream to the specified resource, or null if access to that resource is denied.

Since the first parameter is a reference to the Class instance for the plugin, this method requires the plugin to be activated.

See EditPlugin.getResourceAsOutputStream(EditPlugin,String) method, as an alternate, for when the plugin doesn't need to be activated, or when you do not have the Class instance available.


Parameters:
  clazz - the plugin class
Parameters:
  path - The path to the resource to be returned, relative tothe plugin's resource path. An output stream for the resource, or null.
since:
   4.3pre10
See Also:   EditPlugin.getPluginHome
See Also:   EditPlugin.getResourceAsOutputStream(EditPlugin,String)
See Also:   EditPlugin.getResourceAsStream
See Also:   EditPlugin.getResourcePath



getResourceAsOutputStream
public static OutputStream getResourceAsOutputStream(EditPlugin plugin, String path)(Code)

Returns an output stream to the specified resource, or null if access to that resource is denied.

This method doesn't need the plugin to be activated. You can pass an EditPlugin.Deferred instance that you get from jEdit.getPlugin(String) or jEdit.getPlugins() if the plugin in question is not activated yet and this method doesn't cause the plugin to get activated. If you have a reference to the plugins Class instance available, consider using the Class method.


Parameters:
  plugin - the plugin
Parameters:
  path - The path to the resource to be returned, relative tothe plugin's resource path. An output stream for the resource, or null.
since:
   4.3pre10
See Also:   EditPlugin.getPluginHome
See Also:   EditPlugin.getResourceAsOutputStream(Class,String)
See Also:   EditPlugin.getResourceAsStream
See Also:   EditPlugin.getResourcePath



getResourceAsStream
public static InputStream getResourceAsStream(Class<? extends EditPlugin> clazz, String path)(Code)

Returns an input stream to the specified resource, or null if none is found.

Since the first parameter is a reference to the Class instance for the plugin, this method requires the plugin to be activated.

See EditPlugin.getResourceAsStream(EditPlugin,String) method, as an alternate, for when the plugin doesn't need to be activated, or when you do not have the Class instance available.


Parameters:
  clazz - the plugin class
Parameters:
  path - The path to the resource to be returned, relative tothe plugin's resource path. An input stream for the resource, or null.
since:
   4.3pre10
See Also:   EditPlugin.getPluginHome
See Also:   EditPlugin.getResourceAsStream(EditPlugin,String)
See Also:   EditPlugin.getResourceAsOutputStream
See Also:   EditPlugin.getResourcePath



getResourceAsStream
public static InputStream getResourceAsStream(EditPlugin plugin, String path)(Code)

Returns an input stream to the specified resource, or null if none is found.

This method doesn't need the plugin to be activated. You can pass an EditPlugin.Deferred instance that you get from jEdit.getPlugin(String) or jEdit.getPlugins() if the plugin in question is not activated yet and this method doesn't cause the plugin to get activated. If you have a reference to the plugins Class instance available, consider using the Class method.


Parameters:
  plugin - the plugin
Parameters:
  path - The path to the resource to be returned, relative tothe plugin's resource path. An input stream for the resource, or null.
since:
   4.3pre10
See Also:   EditPlugin.getPluginHome
See Also:   EditPlugin.getResourceAsStream(Class,String)
See Also:   EditPlugin.getResourceAsOutputStream
See Also:   EditPlugin.getResourcePath



getResourcePath
public static File getResourcePath(Class<? extends EditPlugin> clazz, String path)(Code)

Returns the full path of the specified plugin resource.

Since the first parameter is a reference to the Class instance for the plugin, this method requires the plugin to be activated.

See EditPlugin.getResourcePath(EditPlugin,String) method, as an alternate, for when the plugin doesn't need to be activated, or when you do not have the Class instance available.


Parameters:
  clazz - the plugin class
Parameters:
  path - The relative path to the resource from the plugin'sresource path. The absolute path to the resource or null if there is no plugin home.
since:
   4.3pre10
See Also:   EditPlugin.getPluginHome
See Also:   EditPlugin.getResourceAsOutputStream
See Also:   EditPlugin.getResourceAsStream
See Also:   EditPlugin.getResourcePath(EditPlugin,String)



getResourcePath
public static File getResourcePath(EditPlugin plugin, String path)(Code)

Returns the full path of the specified plugin resource.

This method doesn't need the plugin to be activated. You can pass an EditPlugin.Deferred instance that you get from jEdit.getPlugin(String) or jEdit.getPlugins() if the plugin in question is not activated yet and this method doesn't cause the plugin to get activated. If you have a reference to the plugins Class instance available, consider using the Class method.


Parameters:
  plugin - the plugin
Parameters:
  path - The relative path to the resource from the plugin'sresource path. The absolute path to the resource or null if there is no plugin home.
since:
   4.3pre10
See Also:   EditPlugin.getPluginHome
See Also:   EditPlugin.getResourceAsOutputStream
See Also:   EditPlugin.getResourceAsStream
See Also:   EditPlugin.getResourcePath(Class,String)



start
public void start()(Code)
jEdit calls this method when the plugin is being activated, either during startup or at any other time. A plugin can get activated for a number of reasons:
  • The plugin is written for jEdit 4.1 or older, in which case it will always be loaded at startup.
  • The plugin has its activate property set to startup, in which case it will always be loaded at startup.
  • One of the properties listed in the plugin's activate property is set to true, in which case it will always be loaded at startup.
  • One of the plugin's classes is being accessed by another plugin, a macro, or a BeanShell snippet in a plugin API XML file.
Note that this method is always called from the event dispatch thread, even if the activation resulted from a class being loaded from another thread. A side effect of this is that some of your plugin's code might get executed before this method finishes running.

When this method is being called for plugins written for jEdit 4.1 and below, no views or buffers are open. However, this is not the case for plugins using the new API. For example, if your plugin adds tool bars to views, make sure you correctly handle the case where views are already open when the plugin is loaded.

If your plugin must be loaded on startup, take care to have this method return as quickly as possible.

The default implementation of this method does nothing.
since:
   jEdit 2.1pre1




stop
public void stop()(Code)
jEdit calls this method when the plugin is being unloaded. This can be when the program is exiting, or at any other time.

If a plugin uses state information or other persistent data that should be stored in a special format, this would be a good place to write the data to storage. If the plugin uses jEdit's properties API to hold settings, no special processing is needed for them on exit, since they will be saved automatically.

With plugins written for jEdit 4.1 and below, this method is only called when the program is exiting. However, this is not the case for plugins using the new API. For example, if your plugin adds tool bars to views, make sure you correctly handle the case where views are still open when the plugin is unloaded.

To avoid memory leaks, this method should ensure that no references to any objects created by this plugin remain in the heap. In the case of actions, dockable windows and services, jEdit ensures this automatically. For other objects, your plugin must clean up maually.

The default implementation of this method does nothing.
since:
   jEdit 2.1pre1




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.