Jedit: Java Programmer's Text Editor

zhaozj2021-02-12  195

Jedit: Java Programmer's Text Editor

By Robert Swarr

Agoralogos, LLC

February 3, 2003

Copyright? 2003 Robert Swarr, Agoralogos, LLC

This paper is distributed under the Terms of the GNU Free Documentation license.

Introduction

The overview on the jEdit website homepage (http://www.jedit.org) states that "jEdit is a programmer's text editor written in Java ..." While this description is accurate, it understates jEdit's capabilities. JEdit is more than a text editor, for you can install plugins that transform jEdit into a powerful IDE rivaling the likes of NetBeans and Eclipse. The following sections in this paper elaborate on these two points. First, jEdit is a feature-rich text editor. Secondly, plugins transform Jedit Into a Powerful Ide.

Feature-Rich Text Editor

jEdit contains all of the features, both basic and advanced, you would expect to find in a text editor, and then some more. Yet, despite being feature-rich, jEdit has a easy learning curve. You can use the basic features before learning . the advanced ones The advanced features do not get in your way when you first start to use jEdit because they are implemented unobtrusively -. you can discover them gradually as you become more familiar with jEdit For example, you can search a file by clicking on the binocular icon at the top of the display, and then as you become more proficient you can use the keyboard shortcuts and regular expressions to perform advanced search and replace operations on multiple files within a directory.

JEDIT Provides an abundance of features as shown in the following list:

Text-editing features

Multiple and Split Edit Windows

· Keyboard Shortcuts for All Commands

. · Keyboard commands for manipulating words, lines or paragraphs · Abbreviations - saves typing time for commonly used strings For example, in Java mode, the abbreviation "sout" is defined to expand to "System.out.println ()", so. To INSERT "System.Out.println ()" in A Java Source File, You Only Need to Type "Sout" Followed by The Control Key Together with A SEMICOLON.

Copy and Paste with an unlimited Number of Clipboards

· Unlimited undo / redo.

Soft and Hard Word Wrap.

· Multiple Selection and Rectangular Selection - You CAN Select Multiple Areas of Text OR A Vertical Box of Text.

· Indent and marker based folding - lets you selectively hide and show sections of a source code file, replacing hidden sections with a single line that serves as an "overview" of that section Folding can be performed on either leading white space on a line. Or expected fold markers inserted INTO the text.

MARKERS - Edit Buffers CAN Have Any Number of Markers That Point To Specific Positions in The File. The File Is Saved.

· Auto-indentation of source code -. The auto-indent feature inserts the appropriate number of tabs or spaces at the beginning of a line Auto indent behavior is mode-specific so that in Java curly brackets and language statements are taken into account and indent Is Added and remoded as necessary.

· Syntax highlighting - jEdit provides syntax highlighting for more than 80 file types including those of particular interest to Java programmers, notably Java, XML, and JSP Comments and different syntax elements are displayed in different colors and fonts, improving the readability of file syntax. . · Intelligent Bracket matching - jEdit provides assistance with one of the common problems in writing Java code -. mismatched curly braces Positioning the cursor after a bracket will highlight the corresponding closing or opening bracket jEdit uses intelligent bracket matching in that it only checks syntax. Tokens with the Same Type As The Original Bracket for Matches and Ignores Curly Braces in String Litrals and Comments.

Powerful Search and Replace

· Literal and Regular Expression Search and Replace

· Multiple File Search and Replace - Search The Current File, Multiple Files or A Whole Directory

· "Hypersearch" OPTIONS All Matches in A List

.

Beanshell Replace - The Search String is replaced with the return value of a beanshell script.

File management

· Any Number of Files Can Be Opened Concurrently

· Custom File Browser - Used IN Open and Save Dialog Boxes Supports DELETING AND RENAMING FILES AND CREANG DIRECTORIES.

· Character encoding - jEdit supports extensive character encodings It uses the operating system's native default;. MacRoman on the MacOS, Cp1252 on Windows, and 8859_1, but also support Unicode, UTF8 and international character sets such as KOI8_R for Russian text, Big5 and GBK for Chinese, and SJIS for Japanese in fact, it can use any character encoding supported by the Java platform.Comprehensive online help - all jEdit features are well documented in the online help The online help displays quickly when selected with the F1 key for from. The Toolbar.

Customization

· Editor Settings Can Be Configured On A Global OR File Basis

· Configurable edit modes and syntax highlighting - the syntax tokens of a file type are defined in XML files contained in the jEdit settings directory The color and font of syntax tokens can be configured with an options setting..

· Built-in Macro Language (Beanshell) Allows Automating Complex Editing Tasks. Macros Can Be Recorded from User Actions.

Beanshell

BeanShell merits a digression to explain its importance. First, it is a vigorous open source project in its own right. Pat Niemeyer wrote it while developing the examples for the O'Reilly book, Learning Java. The program and source code is included with the book (by the way, I would recommend this book for those learning Java). BeanShell is distributed under dual licensing terms, the Sun Public License and the Lesser Gnu Public License. It is used in other open source projects such as Ant. Check the BeanShell website (http://www.beanshell.org) for more information. Secondly, BeanShell plays an important role in the jEdit plugin architecture. It is the "glue" that binds plugins to jEdit. The actions.xml file provides the main interface between a plugin and jEdit. The actions contained in this file are short BeanShell scripts that execute plugin methods. jEdit executes these BeanShell scripts when the corresponding plugin menu items are selected. The fact that BeanShell plays such an Important Role in Jedit Demonstrate The Vitality of The Open Source Model. One Open Source Project Builds on Another.plugins Transform Jedit Into a Powerful IDE

The most salient feature of jEdit's design is the extensible plugin architecture. The jEdit Plugin API provides an implementation-neutral framework for hosting a full range of applications from a Java compiler to a unit testing framework. For the record, a plugin is an application that loads and runs as part of JEdit and supplements jEdit's features. plugins can be downloaded and installed from within jEdit using the plugin manager feature that performs these tasks online with a point and click interface. Currently, the jEdit website lists more than 80 plugins that can be downloaded and installed. These plugins can transform jEdit into a full-featured IDE that can compile, debug, and unit test an application. and because you're using plugins to add IDE functionality, you can customize your IDE based on your programming requirements And Personal Preferences.an Example: My JEDIT IDE

To make myself more effective I try to automate all of the tasks that I have to execute repeatedly during the development process. These tasks include compiling Java files, generating javadoc, building an application composed of multiple classes and packages, archiving the class files into a jar file, running unit tests, and so on. So, I've installed plugins that automate all of these tasks with a point-and-click interface within jEdit. with my personalized jEdit IDE I can move efficiently through the development process concentrating on The Programming Rather Than Entering Commands.

To create My Jedit Ide I Downloaded Approximately A Dozen of The Plugins Listed At Jedit Plugin Central (http://plugins.jedit.org). The Plugins I Downloaded and Installed Area Follows:

AntFarm - The AntFarm plugin allows developers to build projects from within jEdit using Apache's Ant utility, displaying any errors in ErrorList I use this plugin to execute Ant build scripts within jEdit.InfoViewer -.. InfoViewer is a replacement for the built-in jEdit HelpViewer . IT..................................

JavaStyle - The JavaStyle plugin encapsulates functions for formatting and beautifying Java source code I use this plugin to provide consistent formatting for my Java files and generate javadoc comment stubs, saving some keystrokes..

JBrowse - The JBrowse plugin allows for easy navigation of Java source code by providing a highly customizable tree-view of a file's classes, fields, and methods I use this plugin to get a "macro" view of an individual Java source file and to. Navigate Through The File - IT Saves a Lot of Scroling.

JCompiler - The JCompiler Plugin Allows for In-Process Compiling of Java Source Files and Packages. I Use this plugin to incrementally Compile A Java Class While I'm Writing IT.

JDocPlugin -The JDocPlugin provides configuration and persistance of Javadoc command line arguments and execution of the utility within jEdit (I'm the author of this one). I use this plugin to generate javadoc as I'm writing the javadoc comments. Then, I View the generated javadoc within jedit using the infoviewer plugin.

JIndex -. The JIndex plugin enables jEdit to show the Javadoc API html documentation for the currently selected word, with a single key press, in a browser of your choice The Java API is so large that remembering all of the classes, methods and arguments is . an impossible task I need to refer to the Java API javadoc frequently This plugin allows you to quickly view the API javadoc of a method within jEdit (InfoViewer plugin) .JSwatPlugin -.. The JSwatPlugin integrates the JSwat Java debugger into jEdit Includes JSwat 2.8 IN Plugin Version 1.2 or Higher; Jswat 1.4 in Earlier Versions. I Use this plugin for those Timeshen you need to step THROUGH The code.

ProjectViewer - The ProjectViewer plugin provides an interface for managing a "project", i.e. a related group of source files I use this plugin to get a "macro" view of a project, load files, and build a project with an Ant script..

XML -. The XML plugin provides features for editing XML and HTML files, such as validation against a DTD, display of the element tree in a dockable window, and tag and entity completion I edit XML files frequently and I have trouble matching begin and end Tags. The XML Plugin Helps with Editing and Navigate Through XML Files.

In addition to the above list there are some dependent code plugins that are used such as Console, ErrorList, and Common Controls. If you use the Plugin Manager to download the plugins, it will take care of these dependencies for you. If you download the Plugins manually and miss one of the dependencies, Jedit Will Handle The Error GraceFully and Notify You of the Missing Plugin with a popup dialog. no problem. Good design.

Just in case you're wondering, performance with the above installed plugins is snappy. When you press a key something happens (other than display of the hourglass). Program load times are quick for a full-featured IDE. As a matter of fact , the performance is positively snappy when you compare it to the load times of other IDEs like NetBeans. Faster processors, Swing improvements, Hotspot technology, and good design have ameliorated the performance problems of Java user interfaces of a few years ago.I'm .

My Typical Project Scenario

Now, How do I use all of the plugins? The following is a synopsis of My Typical Project Scenario. These Are the Typical Sequence of Stes I Perform When i create an application with my jedit. Identical.

1.

Create a project using the projectviewer plugin.

2.

Create a Java Source File and add it to the project.

3.

Create XML Configuration Files, View Them with the xml plugin, and add.

4.

Enter Method Declarations and Compile Increme Plugin. View Errors on The Console Plugin, and Correct Errors and Recompile.

5.

Reformat The Java Source File and Add Javadoc Stubs with the JavaStyle Plugin. Write the Javadoc Comments for the class and methods.

6.

GENERATE JAVADOC with the Javadoc Plugin, And View The Generated Html with The InfoViewer Plugin.

7.

ENTER CODE WITHIN METHODS, Compile with JCompiler, And Correct Syntax Errors.

8.

Write a Junit Test Class and Run The Junit Test with the junit plugin.

9.

Repeat The Above for All of the class and packages in the project.

10.

Create An Ant Build Script for the project and place it at the root level of the project.11.

Build The Application with the Antfarm Plugin.

12.

Run the application. If Necessary, Debug It with the jswat plugin.

13

Refactor, Refactor, And Refactor: Navigate Through The Java Source Files in The Project Viewer Interface and Pull Code Into New Classes (Go Back to Step 2).

Conclusion

You can use jEdit as a programmer's text editor, and it is rich with text editor features. The performance is snappy, and it is as at least as reliable as proprietary commercial editors. If you want something more than a text editor, then you can download the appropriate plugins and transform it into a powerful IDE that allows you to compile, document, debug, build and test within jEdit. Add a handful of plugins and It becomes much more than a programmer's text editor.

What is more, jEdit demonstrates the vitality of the open source model. It has a healthy community of well over three thousand users that support its ongoing development. Its development is rapid, and the software is both sophisticated and reliable. As Eric Raymond states it SO Well, "Many Eyeballs Tame Complexity".

Resources

Jedit Website: http://www.jedit.org

Jedit 4.0 User's Guide: JEDIT Download Page

Beanshell Website: http://www.beanshell.org

The cathedral and the bazaar, Eric raymond: http://www.catb.org/~ssr/writings/cathedral-bazaar/

转载请注明原文地址:https://www.9cbs.com/read-7200.html

New Post(0)