Book Image

Eclipse Plug-in Development Beginner's Guide - Second Edition

By : Alex Blewitt
Book Image

Eclipse Plug-in Development Beginner's Guide - Second Edition

By: Alex Blewitt

Overview of this book

Eclipse is used by everyone from indie devs to NASA engineers. Its popularity is underpinned by its impressive plug-in ecosystem, which allows it to be extended to meet the needs of whoever is using it. This book shows you how to take full advantage of the Eclipse IDE by building your own useful plug-ins from start to finish. Taking you through the complete process of plug-in development, from packaging to automated testing and deployment, this book is a direct route to quicker, cleaner Java development. It may be for beginners, but we're confident that you'll develop new skills quickly. Pretty soon you'll feel like an expert, in complete control of your IDE. Don't let Eclipse define you - extend it with the plug-ins you need today for smarter, happier, and more effective development.
Table of Contents (24 chapters)
Eclipse Plug-in Development Beginner's Guide Second Edition
Credits
Foreword
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – writing the markup parser


First, the format of the markup language needs to be explained. The first line will be a title, and then subsequent paragraphs are blank-line separated. This can be translated into an HTML file as follows.

Minimark source

Translated HTML

This is the title

A paragraph with some text

Another paragraph

<html><head><title>This is the title</title></head><body><h1>This is the title</h1>

<p>
A paragraph with some text
</p>

<p>
Another paragraph
</p></body></html>
  1. Create a class called MinimarkTranslator in the com.packtpub.e4.minimark.ui package as follows:

    public class MinimarkTranslator {
      public static void convert(Reader reader, Writer writer)
       throws IOException {
        BufferedReader lines = new BufferedReader(reader);
        String line;
        String title = String.valueOf(lines.readLine());
        writer.write("<html><head><title>");
        writer...