PluginHolder plugin |
By Kevin A. Burton burton@relativity.yi.org, André Kaplan kaplaan@hotmail.com |
PluginHolder lets you dock plugins at the north, east, south and west of each jEdit's View.
For now, you can decide for each plugin whether it docks north, east, south, west or it doesn't dock.
Developing Holdable Plugins is very easy and requires little extra work
provided your main plugin panel is in a separate class and extends
javax.swing.JPanel
PluginHolder will not only dock your plugins, but it will also create your plugin menus at startup.
Her, we assume you're developing a plugin named Foo. Among your plugin classes,
you have a FooPlugin
class (main plugin class)
and a FooPanel
class (main plugin panel) which extends
javax.swing.JPanel
.
Also, the main plugin action is labelled foo-open
.
Now, you can make your plugin holdable in two steps.
In FooPlugin.java
you must add:
import net.sourceforge.jedit.pluginholder.*;Then in the
start method
of the FooPlugin.java
, you
must register your plugin. The createMenuItems
method is no longer
needed.
public class FooPlugin extends EditPlugin { public void start() { PluginHolder.registerPlugin("FooPanel", "foo-open"); ... } ... // createMenuItems no longer needed (PluginHolder creates menus for you) // public void createMenuItems(View view, Vector menus, Vector menuItems) { // JMenuItem menuItem = GUIUtilities.loadMenuItem(view, "foo-open"); // menuItems.addElement(menuItem); // } ... }Also note that if you define a menu of actions instead of a single action, the label you pass to
registerPlugin
must contain -menu
(e.g. foo-menu).
Make your main panel holdable
In FooPanel.java
:
- import PluginHolder main package
FooPanel
should extend HoldablePlugin
- Create a default public constructor
- Create a
public void init(Config config)
method with all
initialization code. For more info see Config
class.
FooPanel.java
should look like:
import net.sourceforge.jedit.pluginholder.*;
public class FooPanel extends HoldablePlugin // was JPanel
{
public FooPanel() {
...
}
public void init(Config config) {
super.init(config);
... Panel initialization code goes here ...
}
...
}
ChangeLog
- 0.0.5 - Jul 09 2000
Released by André Kaplan.
- Valid Property file
- OptionPane API fixed
- Plugin Icon not loaded fixed
- Docking code fixed: JEditTextArea is now encapsulated into EditPane
or JSplitPane
- Docked QuickFile taken into account
- Documentation
- 0.0.4 to 0.0.5 beta
No version released by Kevin A. Burton.
- 0.0.3
First released version by Kevin A.Burton
License
The source code is distributed under the GPL. Please see
http://www.fsf.org/copyleft/gpl.html
Feedback
The preferred way to send bug reports or feature requests is to use the
Sourceforge Bug Tracker.
Alternatively, you can write any feedback to:
- André Kaplan <kaplaan@hotmail.com>;
- Kevin A. Burton <burton@relativity.yi.org>;
- or jEdit-users mailing-list <jedit-users@lists.sourceforge.net>;
- or jEdit-devel mailing.list <jedit-devel@lists.sourceforge.net>.