Building a fully functional code editor based on the JFace Text framework: Part 1th

Source: Internet
Author: User

Introduction

The JFace text framework (JFace text frame, immediately followed by JTF) is an important framework in Eclipse and is one of the cornerstones of other development tools, such as the Java Source Editor in JDT (Java Development Tool), which is the base Developed by it. Anyone who believes in JDT will be impressed by its source code editor, because many of its features allow us to easily edit Java source code, such as syntax highlighting and content hints. All of these features are implemented on a JTF basis, so learning to use this framework is critical to developing a language-editing tool. Even if it is not for this purpose, learning the framework will help to increase awareness of Eclipse as a whole. But JTF itself is indeed a complex framework, not a few words to explain. This series of articles, centered on the features of JTF, describes the concepts and implementations of a particular feature, and gives the appropriate sample program. So as the series progresses, the sample program develops into a fully functional editor. This article is the first of the series, enumerated some of the characteristics of the JTF, and briefly introduced the relevant technology of ANTLR, for the follow-up article to pave the ground. All of the code in this series was raised on the test run in Eclipse 3.3.

The JFace text framework (JFace text frame, immediately followed by JTF) is an important framework in Eclipse and is one of the cornerstones of other development tools, such as the Java Source Editor in JDT (Java Development Tool) Based on what it's developed. Anyone who believes in JDT will be impressed by its source code editor, because many of its features allow us to easily edit Java source code, such as syntax highlighting and content hints. All of these features are implemented on a JTF basis, so learning to use this framework is critical to developing a language-editing tool. Even if it is not for this purpose, learning the framework will help to increase awareness of Eclipse as a whole. But JTF itself is indeed a complex framework, not a few words to explain. This series of articles, centered on the features of JTF, describes the concepts and implementations of a particular feature, and gives the appropriate sample program. So as the series progresses, the sample program develops into a fully functional editor. This article is the first of the series, enumerated some of the characteristics of the JTF, and briefly introduced the relevant technology of ANTLR, for the follow-up article to pave the ground. All of the code in this series was raised on the test run in Eclipse 3.3.

JFace text frame features at a glance

The JFace itself is a more advanced UI library, and the text frame is just one part of it. JFace itself is based on SWT, so the function of the text frame is also subject to SWT, specifically, is subject to the ability of SWT in Styledtext. If you want to simply summarize what JTF is, it can be said that JTF is simply to styledtext some of the functions of packaging is very convenient for you to use it. So do not feel very magical about the function of JTF, all features can find its basis in SWT. Currently, JTF supports the following features:

Syntax Highlight (Syntax highlighting)

Double click (double-click the mouse)

Content Assistant (contents hint)

Text decoration (textual decoration)

Text Hover (textual levitation help)

Annotation Hover (callout suspension help)

Quick Assistant (Fast help)

Hyperlink (HYPERLINK)

Template (Mould edition)

Text formatting (literal formatting)

Text Folding (folding)

All of these features are covered in this series, and the specific concepts of these features will be covered in future articles, as well as some of the features that JTF itself does not support, such as Triple click (Mouse three click). Since both JFace and SWT are evolving, it is possible to mention some of the features not listed above. But JTF itself is a complex framework, so I'm not going to one by one explain the meaning of each line of sample code, just focus on the basic concepts and architecture and core code, and in order to keep the sample code as concise as possible, I don't take into account the performance and many other factors.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.