Common Controls user's guide

Version 1.7.3 (February 16 2014)

Sergey V. Udaltsov

Dirk Moebius

Dirk Moebius

Dale Anson

Matthieu Casanova

Calvin Yu

Marcelo Vanzin

Marcelo Vanzin

Marcelo Vanzin

Dale Anson

Marcelo Vanzin

Marcelo Vanzin

Legal Notice

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no "Invariant Sections", "Front-Cover Texts" or "Back-Cover Texts", each as defined in the license. A copy of the license can be found in the file COPYING.DOC.txt included with jEdit.


Table of Contents

Chapter 1. Purpose

The plugin provides a set of common controls which can be useful for development of various jEdit plugins. Some of them are old and deprecated because they have been replaced by classes which have since been introduced into jEdit or the Java API.

To see the complete list of classes, refer to the javadoc documentation.

The following controls are documented here:

Chapter 2. Description of controls
HelpfulJTable

Author:  Dirk Moebius

An extension of the default Swing JTable, that passes action key events, displays tooltips and autoresizes columns.

In detail, the following features are provided:

  • Fires an ActionEvent, if Enter, Tab or Shift-Tab is pressed.

    Therefore, addActionListener(ActionListener) and removeActionListener(ActionListener) methods are provided.

  • Displays tooltips for partially visible text entries.

    To use this feature, you must use a TableCellRenderer that implements the methods getToolTipText() and/or getToolTipText(MouseEvent), otherwise you won't see any tooltips.

  • utoresizes all columns to the length of its longest content string.

    As a drawback, this HelpfulJTable can only be used to with a String cell renderer, nothing complicated as a JList. (Complex components may be used a CellEditor, however).

Only the default constructor of JTable is provided. Please use setModel(TableModel) to set another model.

JMouseComboBox

Author:  Dirk Moebius

This is a combo-box that allows listeners to be informed of mouse entered and mouse exited events.

Note that other mouse events besides MOUSE_ENTERED and MOUSE_EXITED still do not get delivered. This is because sending a MOUSE_PRESSED, MOUSE_CLICKED or MOUSE_RELEASED event would cause the combo box popup to be hidden immediately after it has been shown, resulting in that it would not be shown at all.

This class was created as a fix/workaround for Swing bug #4144505.

Kappa and Lambda layout managers

Author:  Dale Anson

URL:  http://kappalayout.sourceforge.net/

Advanced layout managers.

VFSPathFileList

Author:  Matthieu Casanova

Nice panel for composing some path ($PATH or $CLASSPATH). Improved version of PathBuilder.

PopupList

Author:  Calvin Yu

The control is a generic popup component that displays a list of items.

Here's a list of potential uses for it:

  • Pop up a list of Templates to apply;

  • Pop up a list of dockables to switch between, much like the fast views concept in Eclipse;

  • Pop up a list of open buffers (yet another buffer switching mechanism);

  • Pop up list of auto-completions.

OkCancelButtons

Author:  Marcelo Vanzin

A panel with two buttons that tie to an instance of jEdit's EnhancedDialog and provide a GUI for the ok() and cancel() methods (aside from the regular enter/esc key bindings). The button label are configurable (defaults to OK and Cancel).

EasyOptionPane

Author:  Marcelo Vanzin

An implementation of jEdit's AbstractOptionPane that is easily configurable by using strings to define the component. Loading and saving of configuration data is handled automatically for the user of the class.

FileTextField

Author:  Marcelo Vanzin

A text field with an "attached" button that opens up a File Chooser so the user can pick up a file or directory.

Blame component

Author:  Dale Anson

This component shows the "blame" panel on the right side of the text area. This is used by the SVN Plugin and the Git Plugin.

See details here.

AtomicOutputStream

Author:  Marcelo Vanzin

An output stream that uses a temporary file to write the data, and only overwrites the target file at close time.

WorkerThreadPool

Author:  Marcelo Vanzin

A thread pool for executing non-GUI related tasks in a separate thread, avoiding blocking the GUI.

The pool working by adding "requests", which are instances of java.lang.Runnable, which are then picked up by the running worker threads and executed asynchronously. By adding a collection of requests instead of a single request the user forces the pool to create enough threads to handle all the requests simultaneouslty, so that tasks that need this functionality (such as reading from forked processes) can be easily run using this mechanism.

Normally plugins use the "single request" add method, which means that only one worker thread will be created. The caller can force new threads to be created by first calling the class's "ensureCapacity(int)" method, which will guarantee that at least the number of requested worker threads are running.

This is a simplified version of Java 5's ThreadPoolExecutor, and also provides a simplified version of the "Future" class (called "WorkRequest"). Callers can use the WorkRequest instances returned by the pool to control when the requests are finished.

Appendix A. Change log
  • Version 1.7.3. 

    German Language Update

    Enhanced FileTextField with setEnabled() and setToolTip()

  • Version 1.7. 

    Fix #3615050 SmartOpen only lets me type one letter on MacOS L&F.

    Added the Blame component.

  • Version 1.1. 

    Added CloseableTabbedPane, a Java 5 version of a Java 6 feature added to JTabbedPane.

  • Version 1.0. 

    Added a Java 5 version of SwingWorker.

  • Version 0.9.4. 

    Add a few new classes: EasyOptionPane, FileTextField, ModalJFileChooser and AtomicOutputStream.

  • Version 0.9.2. 

    Small change to pathbuilder so it uses File.getPath() instead of getCanonicalPath() filenames returned from the file browser.

  • Version 0.9.0. 

    Adds a worker thread pool, fixes jEdit 4.3 compatibility for PopupList.

  • Version 0.8.1. 

    Uses deferred loading with jEdit 4.2.

  • Version 0.8. 

    Some fixes and improvements inHelpfulJTable. Now it can use the width of the headers in autoresize mode. Also, autoresizing does not exclude manual resizing any more.

  • Version 0.7. 

    The version of Kappa and Lambda layout managers is updated.

  • Version 0.6. 

    More stuff in PopupList.

  • Version 0.5. 

    Some additions to PopupList.

  • Version 0.4. 

    PopupList added

  • Version 0.3. 

    Kappa and Lambda layout managers added

  • Version 0.2. 

    PathBuilder package added

  • Version 0.1. 

    First release.