PathEditor component for editing CLASSPATH or PATH

Here is a simple PathEditor component that can be used to edit classpath-like structures i.e. Java CLASSPATH or PATH environment variable.

The label shows the name of the path being edited. The list shows the entries - one entry per row.

Usage

Actions:

  • Delete - delete the selected entries
  • Clear - delete all entries
  • Move up - move slected entry up
  • Move down - move selected entry down
  • Copy - copy the current path to system clipboard
  • View - view the current path (allows copying). The path is shown in a textarea in a dialog. The text is preselected text for easy copying.
  • Edit - copy the selected entries from the list to the textfield for editing. Replace action can be used to replace the edited entries.
    • Double clicking on the list copies the selected entry to the textfield
  • Replace - Replace selected entries with entries in the text field.
  • Add - add new entries to the end of the list or after the last selected entry (if any)
    • Typing ENTER in the textfield adds the entries in the text field
  • Select - browse and select entries using file chooser

Toolbar (hidden at the bottom of split pane). This is an advanced usage.

  • : - use : as the path separator
  • ; - use ; as the path separator

To Run

Simply download the PathEditor.jar and execute:

> java -jar PathEditor.jar

Programatic Usage

PathEditor pe = new PathEditor();
PathEditor pe = new PathEditor("CLASSPATH", "c:\\lib\\classes;");
PathEditor pe = new PathEditor("PATH", "c:\\bin;c:\\usr\\bin", PathEditor.PATH_TYPE.PATH);
// show it in some UI
String classpath = pe.getClassPath();

To Hack

PathEditor Netbeans Project

TODO

  • Drag and Drop editing
  • I18N
  • Publish JavaDoc
  • java.net project

DISCLAIMER: This code is experimental. So no guarantees. Use the code at your own risk.

Comments:

Yes! I remembered this one. I think I will use it. Thanks.

Posted by Ramon on November 27, 2007 at 01:46 AM PST #

Post a Comment:
Comments are closed for this entry.
About

sandipchitale

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today