How to create your own plugin?
- Your Plugin must be derived from the abstract class PledPlugin.
- override 3 (-4) methods:
- public String getToolTipText () to display tooltips and
- public String getButtonText () buttontext. You simply return the text.
- public String doCommand (String marked) gets the marked text as parameter, and should do something usefull with it.
The returned result will replace the marked text.
- public ImageIcon getIcon () may be overwritten, if you got an own icon.
This schould be placed in the directory pled/classes/images , where the others are.
getIcon is optional and needn' t been replaced.
Errors at item 2.a to 2.c will be found by the compiler.
- The name of the plugins must end with "Plugin.java".
- The class-file must be put into the directory pled/classes/pled/plugins .
An error in item 2 or 3 will lead to following situation: your plugin is not loaded.
Sample - plugins:
- Simple plugins:
- Txt2HtmlUmlPlugin very simple, shows a Plugin without icon
- UpperCasePlugin changes lowercase letters to uppercase
- CommentPlugin inserts // at linebegin resp. at the start of the marked text
- UnCommentPlugin removes // at linebegin resp. at the start of the marked text
- IndentPlugin moves about one tab to right
- UnIndentPlugin moves about one tab to left
- JavaIndentPlugin simply indents java code to my preferred style (is not customizable to different styles)
- TryCatchBlockPlugin puts a try - catch - block template around marked text with indentation
- more complex plugins: Each calls a Dialog before starting to act on the marked text. Therefor more flexibility is given.
- Keyword2UpperPlugin Changes keywords from a list (found in a file) to lower or uppercase.
- RegexpReplacePlugin Searches regular expressions and replaces them.