jEdit: Java Programmer’s Text Editor

转载 2004年07月05日 19:05:00

 <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

 

 

 

 

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 don’t 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 selections 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 explicit fold markers inserted into the text.

·        Markers – edit buffers can have any number of markers that point to specific positions in the file. These markers are persisted when 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 removed 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 literals 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” option displays all matches in a list

·        Incremental search finds occurrence of string as it is being typed in search bar. Typing Enter and Shift-Enter finds the next and previous occurrence.

·        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 creating 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 demonstrates 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 are as 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 contains a mini web browser, but you can also configure it to use an external browser. I use this plugin to view javadoc that I generate with the JDocPlugin or javadoc selected with the JIndex plugin.

  • 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 scrolling.

  • 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 times when 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 navigating 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 not claiming that the above list is the best selection of plugins.  It’s just my selection of plugins and shows how you can transform jEdit into a powerful IDE.

 

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 steps I perform when I create an application with my jEdit. IDE.

 

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 them to the project.

4.

Enter method declarations and compile incrementally with the JCompiler 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 classes 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 common 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/~esr/writings/cathedral-bazaar/

 

 

redisson的理解和使用-调用流程

转载,原文出自:http://www.iflym.com/index.php/code/201503290001.html
  • chuhx
  • chuhx
  • 2016年04月01日 17:28
  • 770

JEdit 使用以及一些设置

缘起 由于使用gedit引起Ubuntu图形系统僵死了,也不是知道是系统问题还是软件问题,总之想找个更好的编辑器工具。然后就看到了JEdit,实用了一下,除了内存占的太多外,其他还是行。自己尝试着设置...
  • xiajian2010
  • xiajian2010
  • 2013年10月04日 17:24
  • 2049

UEditor编辑器的使用

1.首先我们要去官网下载UEditor编辑器,选择语言,这里我用的是php utf-8版本 2.下载完成之后解压文件,将解压的文件放到我们的网站目录里面 3.ueditor/utf8-php目录下...
  • lch901004
  • lch901004
  • 2016年03月29日 12:08
  • 834

struts2 访问国际化资源 <s:text>作为属性

保留全局级国际化信息资源文件。并在message.properteis中增加一个带有参数的国际化信息。  labela = labela in zh_CN     labelb = l...
  • xyw591238
  • xyw591238
  • 2016年07月19日 10:47
  • 1347

github学习使用

(https://pages.github.com/) User or organization site一、A terminal(终端):1、Clone the repository Go to...
  • niqi_123
  • niqi_123
  • 2017年03月03日 09:21
  • 88

Daum Equation Editor(公式编辑器)

对于很多人来说,简单的数学还好,要是涉及到复杂的数学公式,光是想想就觉得头晕目眩,而这些数学公式,一个简单的公式编辑器就可以搞定,Daum公式编辑器可以使无论简单的还是复杂的公式都能够得以迅速容易的编...
  • c1007726825
  • c1007726825
  • 2016年03月21日 11:08
  • 290

2年后,还是放弃了programmer dvorak

写下此文纪念我长达两年的dvorak(以及programmer dvorak)的使用历程,也给想转换到dvorak的童鞋一些参考经验。 具体的开始时间记不清了,应该是大二的某个时候。那时正是喜欢折腾的...
  • liangtb
  • liangtb
  • 2014年11月09日 18:29
  • 2698

今天是程序员节(Programmer’s Day)

程序员节是一个为庆祝并感谢程序员所做工作的节日。该节日在国际上已被众多 IT 企业认可,日期定于每年的第 256 天,也就是平年的 9 月 13 日或闰年的 9 月12 日。 (补充:男程序员经...
  • u010345073
  • u010345073
  • 2013年09月13日 16:15
  • 603

[王垠系列]编辑器与IDE

无谓的编辑器战争 很多人都喜欢争论哪个编辑器是最好的。其中最大的争论莫过于 Emacs 与 vi 之争。vi 的支持者喜欢说:“看 vi 打起字来多快,手指完全不离键盘,连方向键都可以不用。”E...
  • unsv29
  • unsv29
  • 2016年01月07日 09:22
  • 570

Xamarin.Forms 用户界面——控件——Text——Editor

编辑 PDF用于离线使用 下载PDF 示例代码: 文本 相关API: 编辑器API 让我们知道你对此的感受 多行文本输入 该Editor控件用于接受多...
  • pfjgeng
  • pfjgeng
  • 2017年08月29日 09:18
  • 287
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:jEdit: Java Programmer’s Text Editor
举报原因:
原因补充:

(最多只允许输入30个字)