PlugIn

David Young

Writing Your Own Plug-In

Coding Your Own Plug-In

Plug-ins for Text Trix can generally be written by overriding just four methods, three of which are trivial. Each plug-in includes methods to manipulate text as well as display icons and descriptive information. Non-graphical plug-ins can be made by extending the class com.textflex.texttrix.PlugIn, and graphical ones can be made by extending com.textflex.texttrix.PlugInWindow. The simplest way to write a plug-in is to start with PlugInWindowTemplate, a template where you can have a plug-in up and running by editing a few variables and adding your text manipulation code in the run method.

Resources:

  • [PlugInWindowTemplate)[https://sourceforge.net/p/texttrix/svn/637/tree/texttrix/trunk/com/textflex/texttrix/PlugInWindowTemplate.java): Also found in the Text Trix source package.
  • View PlugIn.java and PlugInWindow.java as the most pertinent classes.

Packaging Plug-Ins

To compile and package your plug-in, all you need to do is to place it in a certain directory structure, add the name of your plugin to the Makefile, and make all the code.

Text Trix will attempt to load icons for your plug-in, both a normal icon and the rollover icon that replaces the normal one when a mouse rolls over it. A tool tip also flashes when the mouse hangs over the icon for a moment; to customize the tool tip by adding your own text, formatting, and colors, write an HTML-formatted descriptive file.

Files to include:

  • File structure: /plugins/[yourplugin]/com/textflex/texttrix/, where plugins is the one in the Text Trix root directory, and yourplugin is in lower case.
  • YourPlugIn.java: Your source code.
  • (Opt.) desc.html: A description of your plug-in for display as a tool tip.
  • (Opt.) icon.png: An icon for the toolbar button that launches your plug-in.
  • (Opt.) icon-roll.png: An icon for when your mouse hovers over the button.

Resources:

  • plug.sh: texttrix/plug.sh builds and packages all the plugins. Hand-edit the variable "PLUGINS" near the top of the file to include the name of your plug-in (case-sensitive).
  • run.sh: texttrix/run.sh will run Text Trix and your new plug-in!

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks