You are on page 1of 99

Integrated

Development
Environment for
Java
Final Report
May 2003

By: Fahd Shariff

Supervisor: Graham Knight

This report is submitted as part requirement of the BSc Degree in
Mathematics and Computer Science at University College London. It
is substantially the result of my own work except where explicitly
indicated in the text. The report may be freely copied and distributed
provided the source is explicitly acknowledged.
Abstract

Abstract
Software development requires the aid of many tools to accomplish a variety of tasks.
Java development tools are a dime a dozen, but finding a good Integrated
Development Environment (IDE) is rare.

The purpose of this project is to design and develop a free, handy IDE to the Java
community that can be used by both amateur and professional software engineers to
write Java programs quickly and efficiently.

The system uses an intuitive Graphical User Interface with dockable toolbars and
workspace windows. It provides an editor with syntax highlighting and allows easy
navigation through source code with the help of a single tree. It also has a code
palette, which enables code templates, ranging from classes and applets to simple
statements, to be inserted at the click of a button.

The project also explores the area of Source Code In Database (SCID) and moves
on to the design and implementation of a tool that parses source code and stores
useful information (such as classes, interfaces, fields, methods and their locations) in
a conventional SQL database which is accessible to user queries. The inability to
locate a piece of information that you know is out there somewhere, but you cannot
find it, can be extremely frustrating. SCID can ameliorate this problem.

Finding errors has been made very easy, since the application has both a parser and
compiler. The parser alerts users to syntax and lexical errors before compiling. This
means that the compiler only returns semantic errors and the number of times the
compiler has to be run is significantly reduced. All errors are linked to the source
code, so users can jump right to the problem and correct it.

i
Acknowledgments

Acknowledgements
I wish to thank Mr Graham Knight, my project supervisor for his help, encouragement
and advice throughout the year. Thanks must also go to my friends and colleagues for
their useful comments and suggestions in the early stages of the project and also to all
those who were kind enough to feign enthusiasm for my demonstrations.

I would also like to thank my family and friends for their support, especially my
brother for his professional proofreading.

Finally, I would also like to thank the developers of the various tools and libraries that
I have used and the Java community in general.

ii
Contents

Contents
Abstract i

Acknowledgements ii

Contents iii

Chapter 1 - Introduction 1
1.1 What is an Integrated Development Environment? 1
1.2 Motivation 1
1.3 Features 2
1.4 The Database 2
1.5 Intended Audience 3
1.6 Structure of the Report 3
1.7 Summary 4

Chapter 2 - Background 5
2.1 General Area 5
2.2 Existing Tools 5
2.3 Tools and Libraries 6
2.4 Source Code in Database (SCID) 7
2.5 Implementation Language 7
2.6 Summary 8

Chapter 3 - Requirements Gathering 9
3.1 General Requirements of the System 9
3.2 The Requirements Table 9
3.3 Use Cases 12
3.3.1 Actor Specification 12
3.3.2 Use Case Specification 12
3.4 Use Case Diagram 14
3.5 Scenarios 15
3.6 Summary 16

iii
Contents

Chapter 4 - Analysis & Design 18
4.1 The Process 18
4.2 Identifying System Modules 18
4.3 Identifying Candidate Classes 20
4.3.1 The Editor 20
4.3.2 The Output Window 20
4.3.3 The Java Parser 20
4.3.4 The Database 21
4.3.5 Class Browser 21
4.3.6 Code Palette 22
4.3.7 Options 22
4.3.8 Printer 23
4.3.9 Pretty Printer 23
4.4 Class Diagrams 23
4.5 Activity Diagrams 27
4.6 Designing the GUI 29
4.7 Summary 31

Chapter 5 - Database Design 32
5.1 Kinds of Databases 32
5.2 Choosing a DBMS 32
5.3 Identifying What Goes in the Database 33
5.4 Data Flow Diagram 33
5.5 Entity Relation Diagram 34
5.6 Relations 35
5.7 Summary 35

Chapter 6 – Implementation 36
6.1 Choosing an Implementation Language 36
6.2 Package Hierarchy 36
6.3 The Parser 37
6.4 The Database 39
6.5 Executing System Commands 45
6.6 API Viewer 46
6.7 Code Palette 48
6.8 Class Browser 49
6.9 File Explorer 50

iv
Contents

6.10 The Editor 50
6.11 User Options 52
6.12 Printing 53
6.13 Pretty Printing 54
6.14 Toolbars 54
6.15 Menus 55
6.16 Implementing Shared Actions 56
6.17 Window Management 57
6.18 Summary 57

Chapter 7 - Testing 58
7.1 Testing Strategy 58
7.2 Testing the Parser 58
7.3 Testing the Database 59
7.4 Unit Testing 60
7.5 Testing the GUI 61
7.6 Usability Testing 61
7.7 Testing Platform Independence 61
7.8 Summary 62

Chapter 8 - Conclusions 63
8.1 Evaluation 63
8.2 Performance 63
8.3 Further Work 64
8.3.1 Extending the Database 64
8.3.2 Extending the Code Palette 64
8.3.3 More Options 64
8.3.4 Code Completion 65
8.3.5 UML Visualisation 65
8.3.6 Refactoring 65
8.3.7 Wizards 65
8.4 Summary 66

v
Contents

Chapter 9 - Endmatter 67
A System Manual 68
B User Manual 70
C Test Results 77
D Code Listing 81
E Project Plan 95
F Interim Report 100
G Bibliography 103
H Table of Figures 106
I Glossary 107

vi
Chapter 1 Introduction

Chapter 1
Introduction
An apprentice carpenter may want only a hammer and saw, but a master
craftsman employs many precision tools. Computer programming likewise
requires sophisticated tools to cope with the complexity of real applications,
and only practice with these tools will build skill in their use.
Robert L. Kruse, Data Structures and Program Design

This project is about developing an Integrated Development Environment for Java. It
not only has a great set of tools for writing programs, but also stores source code in a
database. The project promises to deliver a handy, open-source and free IDE to the
Java development community. It is entirely implemented in Java for excellent
platform interoperability and performance on Windows®, Linux®, Solaris™ and any
operating system that fully supports the Java 2 SDK 1.4.x.

1.1 What is an Integrated Development Environment?
An Integrated Development Environment (IDE) is a collection of tools that allow you
to do many common development tasks with a common interface. Most program
development tasks involve:

• Editing source code
• Compiling source code to create executable applications
• Executing applications
• Debugging applications.

Microsoft Visual C++ and JCreator are examples of popular IDEs.

1.2 Motivation
Until recently, computer programs were written using simple text editors (e.g.
Notepad and vi). They were compiled in external console windows and if there were
any compilation errors, programmers would have to switch back to their editors, find
the specified line and correct the error. After a successful compilation, programs
would then be executed in the console window.

The problem with this process is that amateur programmers face the daunting task of
learning how to use their editors and learning obscure compile and execute
commands.

Another problem frequently encountered by programmers is the inability to find a
particular programming construct such as a field or method. This gets worse as the
number of files in a project increases. The programmer then has to inspect every file

1
Chapter 1 Introduction

for the missing construct. Storing the main constructs of a program into a database
can solve this problem. Constructs can be found by querying the database.

The primary aim of this project is to tie all these tools together in one nice package
with a common interface. This will aid both amateur and professional software
engineers and programmers in developing software.

1.3 Features
The system uses an intuitive Graphical User Interface with dockable toolbars and
workspace windows. As you might expect, it provides an editor with syntax
highlighting. Syntax highlighting is the display of programming language tokens
using different fonts and colors. This makes code easier to follow and errors such as
misplaced quotes easier to find.

Errors detected during compilation are linked to the source code, so users can jump
right to the problem and correct it. It allows easy navigation through source code with
the help of a single tree. It also allows code writing using templates and a
documentation generator and viewer.

The functionality of the system is extensible so other tools can be added at a later
date. For example, a future final year project could involve extending the system to
allow drag-and-drop GUI creation.

The current breed of IDEs simply store source code in files. This system is also
connected to a database as explained in the next section.

1.4 The Database
The inability to locate a piece of information that you know is out there somewhere
but you cannot find it can be extremely frustrating; particularly if you know you have
seen it before. Databases can ameliorate this problem.

In addition to storing source code in files, the system also parses java source files and
stores important information in a database. Any errors during parsing are highlighted
in the source code, so that users can fix them immediately. This significantly reduces
the number of times users have to compile, since the program is already syntactically
valid. After a successful parse, the following information is recorded in the tables of
the database:

• Classes
• Interfaces
• Methods
• Fields

This has several advantages:

• Since the locations of these constructs are also stored, you can easily find the
declaration of any language construct.

2
Chapter 1 Introduction

• Programmers can concentrate on what they are editing instead of figuring out
which file to edit and where the construct in question exists in that file.
• Programs can be displayed in a variety of ways.

1.5 Intended Audience
This project is intended for students in Computer Science and for amateur and
professional software engineers and programmers. It has much to offer for anyone
interested in java programming. The powerful and easy to use tools that it provides
are designed specifically to increase software development productivity.

1.6 Structure of the Report
Chapter 2 Describes what research has been done in the field of IDEs, databases
and programming. It also reviews existing work in the IDE field. This
provides motivation for the requirements gathering stage of the project.

Chapter 3 Describes the requirements of the system to be developed and
classifies them according to priorities. Also discusses how users will
interact with the system, with the help of use cases and scenarios.

Chapter 4 Describes the analysis and design phase of the project. It starts by
analysing the requirements and splitting the system up into modules
and classes. It also describes why particular decisions in the design
were made. This chapter also illustrates the overall system structure.

Chapter 5 Describes the design of the database. In particular it discusses why this
kind of database was chosen and the structure of the tables in the
database schema.

Chapter 6 Discusses the implementation of various components that were
designed in Chapter 4. Key parts are described with code details.

Chapter 7 Describes how the implementation was tested using a variety of
methods such as unit testing and usability testing. Results can be found
in the appendix.

Chapter 8 Analyses the system that has been presented and evaluates the work
that has been done in this project. Also describes how the work could
be taken further.

Chapter 9 Contains other bits and pieces of information such as the appendices
and bibliography.

• System Manual: Includes technical details about the code and
installation instructions.

• User Manual: Includes information for using the system designed.

3
Chapter 1 Introduction

• Test Results: Results of testing the code.

• Code Listing: Key code details.

• Bibliography

• Glossary

Since each chapter builds on the preceding one, it is recommended that these chapters
be read sequentially from start to finish.

1.7 Summary
This chapter discussed some of the problems with existing IDEs and demonstrated the
need of having a database to store source code. The structure of the report was also
presented.

4
Chapter 2 Background

Chapter 2
Background
This chapter presents an overview of the research done in the areas of programming,
databases and Integrated Development Environments. The research was carried out by
means of books, the Internet, newsgroups and conversations with both amateur and
professional programmers and members of the java community in general.

The aim of this research was to answer the following questions:

• What IDEs exist and what is their functionality?
• What makes a good IDE?
• What existing tools and libraries can be used to build a good IDE?
• Source Code In Database (SCID)

2.1 General Area
Over the years, systems have become increasingly complex. In order to handle large
projects and reduce the time taken to write programs, many integrated development
environments have been developed. However, there are still quite a few problems
with existing IDEs:

• They are expensive.
• Slow to run.
• Complexity increased by trying to integrate multiple tools and functions.
• Locked into a single vendor's proprietary strategy.
• Developer's learning curve focused on terminology and feature location.

This project aims to solve these common problems by developing a handy, open-
source and free IDE, which is extensible so other tools can be added at a later date.
The user interface will be designed to be similar to existing applications, in terms of
buttons, menus and shortcuts, in order to reduce the learning curve associated with a
new application. It will be designed to run on multiple platforms and will be multi-
threaded for quicker user response.

2.2 Existing Tools
Several good IDEs have emerged recently. All of them provide the usual functionality
of compiling, running and browsing projects. As part of the research for this project,
some of the most prominent have been evaluated. The results are given below:

• Sun’s Forte for Java [1]: This IDE is implemented completely in Java and so
runs on all platforms. It is open source and free. Has a nice auto-update feature
and one of the best help facilities. However, the coding paradigm and overall

5
Chapter 2 Background

feel of Forte is not as high-level as other popular development tools. The
major problem with Forte is the speed. Launching it can take up to a minute,
so its safe to say that its pretty slow. Works well on a fast computer (500MHZ
and 256MB RAM). A real resource hog.

• Microsoft Visual J++ [2]: Has some nice features if you are using it just for
editing; however, if you use its visual tools, COM tools, database (like RDO),
or J/Direct, you will be stuck with a Windows only Java program. According
to the java community, Microsoft feels threatened by Java's platform-
independent features, and is designing tools such as Visual J++ and Internet
Explorer in such a way as to sabotage its platform-independence.

• JBuilder [3]: This IDE provides a broad variety of components and is highly
customizable. It includes the Open Tools API that allows a development team
to customize the IDE and add additional features not packed with it.
According to research and personal use it was found that after extended use
(around four or five hours), memory seems to increase out of control. At this
point, you simply have to shut down JBuilder and restart; otherwise, typing
becomes a tedious process, with constant "delays" every couple of lines.

This evaluation reiterates the need for a lightweight, inexpensive IDE that runs on a
variety of platforms.

2.3 Tools and Libraries
There are many tools and libraries available which might be useful in this project. If
libraries are available to perform a particular task it is usually better to try to build on
these libraries rather than re-implement them from scratch.

One specific area in which use of an external library is important is that of parsing the
Java source code itself. For this a parser generator is required.

Parser Generator: A parser generator is a tool that reads a grammar specification
and converts it to a Java program that can recognize matches to the grammar. The
following parser generator tools were evaluated:

• ANTLR [4]: ANother Tool for Language Recognition (ANTLR) is a parser
generator, which has grammars for several languages including Java. It is one
of the more well-known and well-developed parser systems, especially since it
has grammars for many different languages.

• SableCC [5]: This is another parser generator library for Java. It is quite
widely used in the Java community, and also has grammars for several
different languages.

• JavaCC [6]: This is the most popular parser generator library for Java. In
addition to the parser generator itself, JavaCC provides other standard
capabilities related to parser generation such as tree building (via a tool called
JJTree included with JavaCC), actions, debugging, etc. JavaCC was used in

6
Chapter 2 Background

this project because it is easily available and comes with a javaCC grammar
repository containing example grammars.

Advantages of a Parser: Whenever the parser encounters any “interesting” tokens
such as class name, fields or methods, these can be stored in the database and at the
same time a tree can be built representing the structure of what is being parsed. An
additional advantage of the parser is that it can be used to detect errors in code. There
are three types of errors that a compiler detects [7]: lexical, syntax and semantic
errors. The first two types can be detected using a parser. This is easier from the point
of view of the programmer, who only has to invoke the compiler to check for
semantic errors.

Another external resource that is important to this project is that of editing text.
Clearly, the system must provide an effective text editor with basic word processor
functions such as opening files, saving, cut, copy and paste, find and replace etc. To
implement these features code samples were taken from the famous WordProcessor
example in "Swing, 2nd Edition" by Robinson and Vorobiev [8].

2.4 Source Code In Database (SCID)
"I mean, source code in files; how quaint, how seventies!"
Kent Beck, regarding Source Code In Database (SCID)

The concept of SCID was first developed by Roedy Green in the early 1970s [9].
Since then a lot of research has been done in this field and SCID-think is gradually
catching on. The concept has not yet been implemented in full in any existing IDE.

The basic idea is to pre-parse source code and put it in a database. This eventually
leads to the elimination of java files, since all source code is stored exclusively in the
database. This is an important step away from thinking of programs strictly as linear
streams of ASCII characters. It would allow a GUI-based data entry system with all
sorts of point and click features, extreme data validation, and ability to reuse that data,
view it in many ways, and search it by any key.

There are many possible kinds of data structures that could be used for this purpose.
These include, but are not limited to, parse trees, xml files and traditional SQL
databases.

This is a very vast field. This project explores the idea of storing only important
information extracted from source code, such as classes, fields and methods, in the
form of rows and columns in an SQL database. Research was carried out in defining
what tables would be required and normalizing them.

It was decided to use MySQL [10]; the most popular open source database also
available on departmental machines. Driver classes (package org.gjt.mm.mysql)
had to be downloaded from the Internet [11].

2.5 Implementation Language

7
Chapter 2 Background

To implement the system a programming language had to be chosen. According to
research, previous IDEs have been written in a variety of languages from LISP to
C++. The choice was narrowed down to object-oriented languages since they allow
modularity, modifiability and maintainability.

The object-oriented language chosen was Java, mainly because it enjoys "write once
run anywhere" flexibility and is highly secure, open and robust [12].

Java can tend to be quite slow. In order to match the speed of applications written in
other languages, code must be optimised. A lot of research was done, in the different
ways used to speed up Java [13]. The following ways were identified:
• Compile using optimizations turned on (e.g., javac -O)
• Optimize algorithms, especially those involved in string manipulation (use a
string buffer instead)
• Improve performance by multi-threading

2.6 Summary
After reviewing the work that has been done already, one can conclude that it is
within the scope of this project to create an IDE that not only provides basic functions
but also stores source code in a database.

There are several tools and libraries that might be employed to avoid re-implementing
work which has already been done and allow the project to progress more quickly.
Research has highlighted several points where decisions must be made about how a
particular part of the framework should be implemented. The merits of the various
options have been examined and decisions will be made in the design section later in
the report.

8
Chapter 3 Requirements Gathering

Chapter 3
Requirements Gathering
To develop software projects on time and budget there is nothing more important than
gathering and clearly defining the requirements. This chapter describes the
requirements workflow of the system. To gather requirements, the functionality of
existing systems and how they could be improved was studied, in order to determine
the following:

• Functionality: the essential things that the system must do.
• Interaction: how the system should work from the user's point of view.
• Other Needs: time, space, performance, scalability, security, and disaster
recovery needs.

After exploring and analysing the requirements, these were then articulated in the
form of a Requirements Specification Document, which provides a common
vocabulary, and understanding of the problem space and the desired system
behaviour.

3.1 General Requirements of the System
The main task is to build a fully functional Integrated Development Environment for
Java. The system will allow java source code to be edited and will display it in a
multi-coloured manner (Colours are representative of the different control constructs
and keywords that can be found in the source code file.) It will parse, compile and
execute java source files.

The system will store source code in a MySQL database, which will allow searching.
This will be implemented as a plug-in, so that users, who do not have MySQL
installed on their computers, can still benefit from other features that the system
provides.

In addition, the system will speed up code writing by using templates and a point-and-
click interface. It will also allow users to navigate through source code, by displaying
it in the form of a single tree in which fields and methods are defined as nodes of the
tree.

3.2 The Requirements Table
The Requirements Table below sets out, in a bit more detail, the functional and non-
functional requirements of the system. Each requirement is assigned a priority using
the MoSCoW criteria [14]:

9
Chapter 3 Requirements Gathering

• M- must have (mandatory). These include the most import requirements such
as editing code, the database for storing and searching code, parser and java
features (compiling and running programs)
• S – should have. These include a file explorer and class navigator.
• C – could have (optional) such as a help system
• W – would have (these can wait), such as UML diagrams, an API Viewer etc

Priorities are used to distinguish user needs (features that are critical to the system's
success) and user wants (features that would be nice to have but are not essential).

ID Requirements Priority

General

1 Platform Independent. M
Engaging user interface with switchable look-and-feel and theme
2 S
support.
3 Support for application, applet and web application development M
4 Users should not have to leave the IDE at any stage. S
5 Built in file browser. S
6 Dockable toolbars and sidebars. S
7 Help system. C

Editor

8 Multi file editing S
9 Configurable syntax highlighting for Java M
Display the program using different fonts, font sizes, styles and
10 C
alignments.
11 Search and replace M
12 Parentheses matching M
13 Auto indentation M
14 Line indicator M
15 Printing with Print Preview M

Output Window

16 Compile and execute java programs. M
17 The Javadoc command automates the generation of Javadoc. M
18 Run the applet viewer. M
19 Invoke custom commands of the user. C

10
Chapter 3 Requirements Gathering

Compilation and Error Detection

20 Both Parser and Compiler error detection M
Hyper linking of errors in the output window to positions in the
21 M
source files.
22 Setting compiler options such as classpath etc. M

Database

23 Parse source code and insert important items into a database. M
Record locations of these important items so that they can be
24 M
edited.
Find all declarations of methods, fields, classes or interfaces
25 M
throughout a project
26 Search using special criteria such as access modifiers, types etc. M
Provide the user with the option of executing SQL queries directly
27 C
instead of using the search dialog.

Class Browser

28 Display class information in a tree structure. S
Allow easy navigation for finding class, field and method
29 S
declarations.
Classify Java source file member information such as method and
30 S
fields by access levels (public, private, protected).

Coding Tools

Quick code insertion e.g. surrounding selected code with a try-
31 M
catch clause.
Templates for easily writing classes, applets, desktop applications
32 M
and web applications.
33 Comment and Uncomment blocks of selected code. M
Tight integration with JUnit, designed specifically to run and
34 S
automate unit tests.

Java API Viewer

Browse java documentation for either specific project or the
35 W
complete online API.
Search for the documentation of a specific class or interface using
36 W
wildcards.

11
Chapter 3 Requirements Gathering

UML Code Visualization

37 Generate UML code diagrams for entire projects. W
38 Navigate in browser fashion through UML class diagrams. W

3.3 Use Cases
Use case diagrams describe what a system does from the standpoint of the user. The
emphasis is on what a system does rather than how. The diagrams produced are used
during the analysis phase of the project to identify and partition system functionality.
Items in use case models are linked to items in the requirements document, which
enables requirements traceability.

A use case diagram separates the system into actors and use cases.

3.3.1 Actor Specification
Actors represent roles that are played by users of the system and must be external to
the system. They could be humans or even other software systems.

The actors of this system (i.e. the IDE) are programmers who could be either
professionals or amateurs. They make use of the system for writing Java programs. In
addition they can browse through class files, insert code templates, search the
database and execute commands such as compiling and running.

3.3.2 Use Case Specification
Use cases describe the behaviour of the system when an actor sends a particular
stimulus. This system has a number of use cases. The ones that are vital to the system
are listed below:

Use Case 1: Open a File

1. User selects a file from the file chooser and clicks Open.
2. The system parses the file and updates the Database.
3. At the same time, it also creates a tree view of the class structure of the file and
displays it in the Class Browser.
4. The file is then opened in a new editor window.

Error Case 1: File not found
Error Case 2: File is not a valid java file.
Error Case 3: File is already open.

If after step 1, any of the above occur, the system informs User and returns.

Use Case 2: Save a File

12
Chapter 3 Requirements Gathering

1. User presses Save or Ctrl-S.
2. If the file has not been saved before, the system prompts User to enter the
filename to save in.
3. The system then writes to the specified file.
4. The system re-parses the file.
5. The system updates the database and Class Browser.
6. File has been saved.

Error case 1: Parse Error
If after step 4, there is an error while parsing, the system highlights the error location,
informs User and returns.

Use Case 3: Compiling a File

1. User clicks on the Compile button.
2. The system runs the compile command on the specified file and displays any
errors.
3. The system adds hyperlinks to the errors to link them to the source code.

Use Case 4: Add file(s) to the Database

1. User selects the Add File option from the Database menu.
2. User then selects a file or directory to add to the database.
3. The system parses the file or directory recursively and adds items (fields, methods
etc) to the database.

Use Case 5: Search the Database

1. User selects Search Database from the menu.
2. User then enters what is being searched for and also enters any additional criteria
such as the type, parameters or modifiers.
3. The system builds an SQL query based on this input.
4. The system then returns a table with the results.

Use Case 6: Insert Code

1. User writes a block of code into the editor.
2. User selects this code.
3. User clicks on the required code to be inserted e.g. while loop
4. The selected block of text is surrounded by the required text i.e. by a while loop.

Use Case 7: Launch Java API Viewer

1. User clicks on the API Viewer button.
2. The system connects to the directory, which contains the API or Javadoc files.
3. The system parses the documentation files, which are in HTML format.
4. The system displays all the information in a new window.
5. User enters the class they are looking for in the search box.
6. The system displays the documentation for that class.

13
Chapter 3 Requirements Gathering

Error Case 1: If, after step 5, the class does not exist, the system informs the user and
returns.

Use Case 8: Modify Options

1. User selects Options from the Edit menu.
2. The system displays the options in a table.
3. User modifies options e.g. compiler command
4. User clicks Apply.
5. The system updates the options.
6. System writes the new options to the configuration file.

3.4 Use Case Diagram
Below is an overall Use Case diagram for user's possible interactions with the system.

System
Open File

Save File

«extends» Compile

«extends»
Execute Commands Run

«extends»

Generate Javadoc
Insert Code

Launch API Viewer

User
Modify Options

Add/Remove File(s)

Database Operations

Search Database
Change Look and
Feel

Figure 1 – Use Case Diagram

14
Chapter 3 Requirements Gathering

3.5 Scenarios
A scenario is an instance of a use case and corresponds to a possible interaction
between the system and its actors. Some scenarios of key use cases are listed below:

Use Case 1: Open a File

Scenario 1: John presses Ctrl-O and selects Program1.java from the file chooser.
A new editor window pops up and displays the file. The file is added to the Class
Browser tree, and John clicks on the items in tree to view the file’s structure.

Scenario 2: John presses Ctrl-O and selects Program1.java from the file chooser.
He gets a message that the file is already open.

Scenario 3: Chris clicks on the Open button on the toolbar and enters Hello as the
filename. He gets a message that it is not a valid java file. He tries again, but this time
he types Hello.java. The file is displayed in a new window.

Scenario 4: Sam clicks on the Open button on the toolbar and selects a directory. She
gets a warning that the file he selected is a directory. She tries again.

Use Case 2: Add file(s) to the Database

Scenario 1: Peter has just installed this system. He wishes to continue work on an
existing project and wants to upload all the classes in this project to the Database. He
selects Add/Remove Files from the Database menu. A window is displayed which
lists all the files currently in the Database. He clicks on the Add button and selects his
project directory and clicks Ok. He watches, as all the files in his project are
recursively added to the Database. Consequently the list grows. He receives a
message that all the files have been successfully added to the Database.

Use Case 3: Search the Database

Scenario 1: Adam is working on a school-programming project. He has written a
number of classes. He creates a new Object of class Person but cannot remember
whether the method he wishes to call on that object is called getName or
getFullName. He opens the Database Search Dialog and types “get%Name” in the
method box and “Person” in the class box. He presses submit and the results show
that the method he was looking for is called getFullName and the method returns a
String.

Scenario 2: James Gosling is working on a massive project. Fortunately, all his files
are stored in the database. He is writing a subclass and wants a list of all the methods
of the super class so that he can override them. He selects Search Database from the
Database menu and selects method search. He enters the name of the super class and
finally hits Search. A results table appears which shows him all the methods in the
super class; their names, return types and parameters. He copies them into the
subclass and overrides them.

15
Chapter 3 Requirements Gathering

Use Case 4: Compile a File

Scenario 1: Jim presses the Compile button on the toolbar. An output window pops
up with the compile command. Unfortunately, Jim finds he has forgotten a semicolon
at the end of a statement on line 70. He clicks on the hyperlinked error in the output
window and line 70 is highlighted. He adds the semicolon and recompiles.

Scenario 2: Bob is writing his first program. He presses the Compile button and holds
his breath. The output window does not display any errors. He sighs with relief.

Use Case 5: Insert Code

Scenario 1: Joe wishes to write a web application that makes use of servlets. He
clicks New to open a blank editor. He then types the name of the servlet class, which
he has chosen to be MyServlet. He then highlights this name and chooses Servlet
from the Code Palette. A class containing the standard Servlet template, with the
doGet and doPost methods, is displayed in the editor. He just fills it up.

Scenario 2: Fatima thinks that a method in her program is redundant. To test her
theory, she highlights the method and clicks on Comment in the Code Palette. Her
method is commented out. She then saves the file and compiles. No errors are
detected. She concludes that the method serves no purpose and so deletes it from the
program.

Use Case 6: Navigate Through Classes

Scenario 1: Harry is working on a program, which has a few 100 lines of code so far.
There are lots of fields and methods. He wants to view the code of a particular method
called drawDiagram. He is pleased that he does not need to scroll up a 100 lines to
find the method declaration. He simply scans the class tree and clicks on the node that
says drawDiagram. Automatically, the method declaration is highlighted in the
editor.

Use Case 7: Modify Options

Scenario 1: Ahmed wishes to use jikes instead of javac for compiling his
programs. He selects Options from the Edit menu and changes the existing compile
command. He then clicks Apply. After editing his program, he presses Compile on the
toolbar and the jikes compiler is used. The next day he starts up the system again
and is pleased to see that the change he made has been saved.

3.6 Summary
Requirements are bound to change during the course of the project. Unmanaged
changes, however, can be harmful to the project. They can cause delays, increase cost,
decrease quality, or outright kill the project. Only with rigorous requirements
definition and management is it possible to finish your project on time and on budget.

16
Chapter 3 Requirements Gathering

This chapter outlined the requirements workflow of the system. Each requirement had
an associated priority in order to distinguish the important features from the less
important ones. Key use cases and example scenarios for the system were outlined.
These will be very useful in the analysis and design phase for partitioning the
functionality of the system.

17
Chapter 4 Analysis & Design

Chapter 4
Analysis and Design
This chapter describes the analysis and design of the system. It is about refining and
structuring the requirements to get a better understanding of them. It also seeks to
explain the reasoning behind the decisions made and assess their effectiveness in
solving the problems involved. An object-oriented (OO) approach has been used since
it offers a more natural way of conceptualizing and developing software systems.
Unified Modelling Language (UML) has been used as the means of expressing OO
concepts.

4.1 The Process
The system was designed in a spiral-like fashion, such that it was specified, designed,
implemented and tested initially, then the process was repeated in a second phase to
review the overall process and cater for any refinements required. It was not found to
be necessary to continue the process beyond a second phase, as most of the
improvements required were discovered during the implementation of the first phase.

Each stage of the design process began before the previous stage was entirely
complete, and as such resulted in alterations being made to the previous stage, such
that some design decisions resulted in a slight change to the specification, and so on.

4.2 Identifying System Modules & Responsibilities
The requirements set out in the previous chapter were analysed and the system was
split the system into several parts or modules, which are as independent of each other
as possible. Modularity is a way of coping with complexity. For each module, its
responsibilities (what it does) and its collaborations (relationships with other modules)
were identified and are as follows:

• Editor: Plays the role of a word processor. It is responsible for displaying files
on the screen for handling edit commands such as cut, copy, paste, undo, redo,
find and replace etc. It highlights source code according to syntax, matches
parentheses and displays line numbers.

• Output Window: Is responsible for displaying the results of commands
executed by the user. Commands include compiling, running, generating
Javadoc, launching the applet viewer or any other custom command. It links
compilation errors to the correct position in the editor.
Collaborator: Editor

18
Chapter 4 Analysis & Design

• Java Parser: Parses java source files and highlights any errors that occur
during parsing. It sends tokens (information about the file being parsed) to the
Database and Class Browser, which are consequently updated.
Collaborators: Database, Class Browser

• Database: Maintains a record of class information such as fields and methods.
This information is sent by the parser. Also returns results of user searches.
Collaborator: Java Parser

• Class Browser: Displays class information in the form of a tree. How the tree
is built depends on the information is sent by the parser. The nodes of tree are
coloured according to the access level of the item at that node.
Collaborator: Java Parser

• Code Palette: Is responsible for code insertion.
Collaborator: Editor

• Options: Stores user preferences such as name, compile commands etc.
Collaborators: Editor, Output Window

• Printer: Is responsible for printing files and for print previewing.
Collaborator: Editor

• Pretty Printer: Parses java files and converts them into HTML. These files
can then be viewed as web pages.
Collaborator: Editor

With these responsibilities and collaborations in mind, a basic system model can be
drawn:

Options
Printer

Output Window Editor Code Palette

Parser Pretty Printer

Class Browser Database

Figure 2 – Basic System Model

19
Chapter 4 Analysis & Design

4.3 Identifying Candidate Classes
Each module described above was analysed and split further to give a set of possible
classes and interfaces.

4.3.1 The Editor
The following classes were identified for the editor module:

• LineNumber: A component used to display line numbers on the left hand side
of the editor window.
• SyntaxDocument: The document on which text is written. It is responsible for
inspecting words and highlighting them if they are keywords, strings or
comments. Also responsible for indentation and parenthesis matching.
• CustomTextPane: A special text pane, which contains the Syntax Document
and Line Number component. It is responsible for editing operations such as
cut, copy, paste, undo, redo etc.
• JavaEditor: Provides a window for containing all of the above. It listens for
window events. For example, it checks if a file has been saved when the
window is closed. Is also responsible for file operations such as opening,
closing, saving etc.

4.3.2 The Output Window
The following classes were identified for the output window module:

• OutputFrame: Provides a window for displaying results after a command has
been executed. In the case of compiling, it displays compilation errors and
links them to their position in the source code.

4.3.3 The Java Parser
JavaCC was used to generate a parser for the Java language. It provides the most
popular parser generator library [15] for Java. In addition to the parser generator
itself, JavaCC provides other standard capabilities related to parser generation such as
tree building (via a tool called JJTree included with JavaCC), actions, debugging, etc.
It was decided to use JavaCC because it is easily available and comes with a JavaCC
grammar repository containing example grammars.

Java1.4.jj is a grammar specifically used to generate java parsers using JavaCC.
This grammar was modified, so that tokens (such as class names, interfaces, field
names and types, method names, types and parameters) were sent to the Database and
added to the Class Browser tree structure. JavaCC was then used to generate a parser
for this extended grammar. The tool produced the following classes:

• JavaParser: The tool that does the actual parsing. It also informs the user of
any errors during parsing and updates the Database and Class Browser.

20
Chapter 4 Analysis & Design

• ASCII_UCodeESC_CharStream
• ParseException
• JavaParser
• ParserManager Generated by JavaCC
• JavaParserConstants
• Token
• JavaParserTokenManager
• TokenMgrError

4.3.4 The Database
This part of the system uses JDBC to pass SQL statements to the Database
Management System (DBMS), which in this case is MySQL. To connect to the
database, a user needs to have a valid username, password, database driver and URL.

The following classes were identified in the Database module:

• DBManager: Is responsible for connecting to the DBMS and executing SQL
commands. All other modules must go through the DBManager to examine or
update the database.
• DBInserter: Inserts information into the Database. It receives this information
from the parser.
• DBExtracter: Extracts information from the Database and returns resultsets.
• DBConnection: The database connection. Maintains information such as the
database driver name, URL etc.
• DBStatement: Provides methods for executing general SQL commands such
as select, update and delete.
• AddRemoveDBDialog: A dialog for adding and removing files from the
Database.
• DBMenu: A menu allowing user interaction with the Database such as adding
and removing files and searching.

4.3.5 Class Browser
This is useful for navigating through classes. The following classes were identified:

• TreeBuilder: The parser sends information about any class and the
TreeBuilder is responsible for building a tree depicting the structure of the
class. Items in the tree are coloured according to the access level. For example,
private fields are coloured red whereas public ones are green.
• ClassBrowser: Provides a panel for displaying the tree built by the
TreeBuilder. It is also responsible for handling tree events, so for instance, if a
method node is clicked, the corresponding method is highlighted in the editor.

21
Chapter 4 Analysis & Design

4.3.6 Code Palette
This module is responsible for code insertion. There were a few options for designing
this feature. Code could have been inserted on the fly i.e. while the user types.
Alternatively, a toolbar could have been designed containing buttons for different
code templates. The first option was discarded because it meant having to analyse
every word that the user entered which would slow the system down. The second one,
if carried out, would have resulted in an unmanageable toolbar because of the large
number of buttons.

In the end it was decided to display code templates in the form of a tree. This way
different code items can be classified appropriately. For example, the tree would have
a branch containing loop constructs such as while, for and do-while and
another branch containing statements such as if, if-else and switch etc. Users
can therefore expand only those branches that they are interested in.

The code constructs and templates that were to be inserted had to be stored
somewhere. It was decided to store them in XML format. An XML file can then be
parsed using an XML DOM parser (part of the java swing library) [16] and the tree
built during parsing. This is a flexible approach since more templates and constructs
can be added at a later date. The user can also edit the existing file to change the
layout (such as brace placing) of the code. An extract of the file is shown below:

<codetype name="Comments">
<code name="//">//|</code>
<code name="/* */">/*|*/</code>
</codetype>

<codetype name="Loops">
<code name="do" >do\n{\n|\n}\nwhile();</code>
<code name="while" >while()\n{\n|\n}</code>
<code name="for" >for( ; ; )\n{\n|\n}</code>
</codetype>

(\n refers to the new line character)

Only one class called CodePalette seemed necessary for this feature. This class
creates a new window, parses the XML file, builds the code tree and listens for user
selections. It then inserts the selected template into the editor and highlighted by the
syntax highlighter.

4.3.7 Options
It was decided, for the sake of simplicity, to store user preferences in a simple text
file. When the system is started up, this file is read and all of the system variables are
initialised using the file data. If a user decides to change their options, this module
updates the file. An extract of the options file is below:

NAME:Fahd Shariff
COMPILECMD:javac -classpath .:<dir> <filepath>

The following classes were identified to handle the options module:

22
Chapter 4 Analysis & Design

• OptionsDialog: A dialog allowing users to change their preferences.
• Options: Stores the user’s preferences.

4.3.8 Printer
This module is responsible printing. It also allows print previewing. The following
classes were identified to carry out the responsibilities of this module.

• Printer: Handles user’s requests for printing or print previewing.
• PrintPreview: A component capable of displaying the results of printing
before actual printing occurs.
• PrintView: A view for the printed pages.

4.3.9 Pretty Printer
This module allows users to be able to save their code as a web file (in HTML format)
in which code has been coloured according to its syntax. This is similar to the editor’s
syntax highlighting feature.

This module has been taken from the author’s previous year group project, in which it
was implemented as a web application using JSP and Java Servlets. It parses java
code and marks it up in HTML. It has the following classes:

• HTMLCompiler: Compiles Java Source code into HTML code.
• Options: Determine how the code is displayed.
• Token: Represents a token with a type and value.
• HTMLEmitter: Emits HTML Code.
• SourceBufferReader: Reads a String Buffer containing the source code.
• TokenType: The type of the token.
• Lexer: Converts syntactically correct Java code into tokens.
• SymbolTable: Used by the Lexer for looking up symbols.

4.4 Class Diagrams
Once all the modules and classes and their responsibilities have been identified, UML
Class Diagrams for the system can be drawn. They represent the static structure of the
system to be built and provide a way of recording conceptual capabilities and
relationships independent of implementation. It is from these diagrams that the code
will eventually be written. It is therefore possible to "virtually code the application"
without having to be concerned with the specific details of the language.

Some of the diagrams are shown below:

23
Chapter 4 Analysis & Design

Figure 3 – Package Dependencies

Fig 3 shows the associations between different packages in the system. It also lists all
the classes that each package contains.

It can be seen that the database communicates with the parser and is also connected
with the options package in order to read the user’s database configuration. All
packages are connected to the GUI in order to provide feedback to the user.

24
Chapter 4 Analysis & Design

Figure 4 – Database Class Diagram

The class diagram for the database package is shown above.

The DBManager class manages all operations of the database and liaises with the
parser in order to receive information. The AddRemoveDialog class needs to know
what files are in the database and is therefore connected to the extracter class.

25
Chapter 4 Analysis & Design

Figure 5 – Parser Class Diagram

The class diagram for the parser package is shown above.

Some classes are generated from the grammar using JavaCC so it is not very
important to include their attributes and methods. The ParserManager class manages
all parsing operations that are mainly carried out by the JavaParser. The
JavaParser communicates with the external classes, DBInserter and TreeBuilder
in order to keep the database and class browser up-to-date.

Other class diagrams such as those of the Graphical User Interface, are not very
important from the point of view of the reader since they just show how components
are associated with each other.

26
Chapter 4 Analysis & Design

4.5 Activity Diagrams
Activity diagrams show dependencies between activities and therefore describe how
activities are coordinated. There are many activities in the system. We are interested
in what activities must be carried out in order to update the database. The two main
activities are opening a file and saving a file.

Figure 6 - Open File Activity Diagram

The figure above shows the sequence of activities taking place when a user wishes to
open a file. If the file is a valid java file, then it is parsed and if there are no errors, the
database and class browser are updated concurrently.

27
Chapter 4 Analysis & Design

Figure 7 - Save File Activity Diagram

This is another activity that updates the database. When the user saves a file, the
system first checks to see whether there have been any changes to the file since the
last time it was saved. If there are no changes then there is no need to reparse the file
and update the database since the results of these operations would not make any
difference. However is there have been changes, these are saved by writing the code
to the file. The database and browser are updated to reflect these changes. (More
about this in the implementation section).

28
Chapter 4 Analysis & Design

Figure 8 - Search Database Activity Diagram

The diagram above shows the sequence of activities that take place when the user
wants to search for an item in the database. The user’s search information is converted
into an SQL query and executed. If there are no results, the user is informed about this
via a dialog. If results are found, they are displayed to the user.

4.6 Designing the GUI
A growing problem with today’s interfaces is that the display that is provided to the
user is overly complex. As applications become more powerful and acquire more and
more options, programmers have attempted to make the various options more
convenient to use by placing more and more icons and buttons on the screen. For
example, the default layout of Microsoft Word includes over fifty icon buttons and
over one hundred and fifty menu items [17]. Users are often at a loss to find the one
of interest for any particular task, especially when they are somewhat unfamiliar with
the system.

A good well-designed interface plays a major role in the success of any application.
The application's interface should operate smoothly and as predicted, anticipating
what the user will do next.

29
Chapter 4 Analysis & Design

The interface of this system is designed to follow common sense. This means that the
interface will interact with the user in a natural way that will meet the user’s
expectations. It is also designed to be consistent with other applications by using the
standard menu and windowing tools, button names and locations, dialog boxes, and so
forth.

Figure 9 – Initial GUI Design

As seen in the figure, the GUI has been made as intuitive as possible i.e. symbols and
styles the user knows [18].

The interface will be designed to allow multiple look and feels. In this way, users can
choose the look and feel that they feel most comfortable with.

In order to avoid a cluttered interface, it was decided to use Tabbed Panes to contain
the file explorer, class browser and code palette. These three features are represented
as trees and so require sufficient height to expand. They were therefore placed on the
extreme left of the main window.

It is important that the system responds quickly when a user clicks a mouse button or
types on the keyboard. If there is only one thread, when the system is busy (e.g.
compiling etc), it ignores user actions, giving the user the impression that the system
has crashed. In order to avoid this problem, it was decided to use multi-threading i.e.
have one or more threads managing the user interface while others perform different
background tasks.

30
Chapter 4 Analysis & Design

It seemed a good idea to have two separate toolbars: one for formatting and the other
for standard operations. In this way buttons can be categorised for easy identification
and selection. Users have the option of removing the toolbar that they do not use
frequently. Familiar icons were used on all buttons.

Windows covered up by others can lead to “out of sight, out of mind” [19]. To allow
multi-file editing and efficient window management a virtual desktop was designed.
This is essentially a large panel holding multiple editors (as internal frames), which
allows easy window management.

4.7 Summary
This chapter described the Analysis and Design workflow of the system. It analysed
the requirements gathered earlier and broke the system down into modules and then
into classes according to their responsibilities and collaborations. In particular, the
generation of a parser using JavaCC, the initial design of the database using JDBC
and SQL and the design of the Code Palette using XML were discussed. A class
diagram was presented that showed the association between classes. The next chapter
focuses on the design of the database in totality.

31
Chapter 5 Database Design

Chapter 5
Database Design
The design of the database is one of the key ingredients to a successful
implementation. This chapter describes how the database was designed from the point
of choosing a suitable database to the actual logical design.

5.1 Kinds of Databases
A database is a collection of organized data (information). There are three main kinds
of databases [20]:

• Flat: Store data in one big table. An example would be a phone book.
• Relational: Instead of a single table, data is stored in many tables that relate to
each other.
• Object-oriented: Support objects and classes. They allow structured sub
objects; each object has its own identity, or object-id (as opposed to a purely
value-oriented approach) and provide support for methods and inheritance.

It was decided to use a relation database for the purpose of this project. Relational
databases are the dominant paradigm for new applications, and have been used for
most applications developed within the past decade. (Object-oriented databases are
fading in the marketplace, so are only used for compelling situations in which they
clearly surpass relational databases. For example, some engineering and multimedia
applications can benefit from an object-oriented database [21].) The information we
wish to store would fit well in a relational database too.

5.2 Choosing a DBMS
A Database Management System (DBMS) is the program used to define, store and
retrieve data in a database. The DBMS chosen to control a database is dependent on
several factors, which includes the data model being used and how the data is to be
entered and retrieved. A relational database is required for this project, which would
make use of SQL to execute queries.

There are a number of DBMSs suitable for managing relational databases. There are
proprietary DBMSs, which are commercial products e.g. Microsoft’s SQL Server and
Oracle’s Oracle 8i. There are also Open Source DBMSs, which are free of charge,
normally under the GNU General Public License e.g. Interbase and MySQL.

There was no other alternative but MySQL since it is readily available and installed
on departmental machines. However, MySQL does not support stored procedures or
nested statements.

32
Chapter 5 Database Design

5.3 Identifying What Goes in the Database
The main aim at this stage is to identify what needs to be stored in the database. In
other words we need to provide a clear view of why the database is used by the
system.

The purpose of the database is to store information about java source code. Since Java
is a vast language and programs are becoming increasingly complex, it must be
decided what information the tables in the database will hold. The initial database can
then be extended at a later date to incorporate other information.

It seemed appropriate to store the following pieces of information in the database:
• Classes (names, super classes, implementing interfaces and modifiers) Types
• Interfaces (names, modifiers)
• Fields (names, types and modifiers)
• Methods (names, return types, parameters, exceptions and modifiers)

5.4 Data Flow Diagram
A data flow diagram shows how information is passed between the users and
subsystems of the system. The data flow diagram for this system is shown below:

Highlight in
Editor

Open File

User Save File Parser Parse File ClassBrowser

Store in
Add File to
Database

Get Location of
Database
Item

Search
Search in
Database

Return results

Figure 10 - Data Flow Diagram

33
Chapter 5 Database Design

The diagram shows that:
• Data is stored into the database when a file is parsed by the Parser. This
happens whenever a user opens a new file, saves a file or explicitly adds a file
to the database.
• The database provides results of search queries executed by the user.
• The Class Browser also uses the database to lookup locations of items that the
user clicks on. The database returns the specified location and this is
highlighted by the ClassBrowser in the editor.

5.5 Entity Relation Diagram
An Entity Relation Diagram (ER Diagram) shows the data entities of the system and
the relations between these entities. It is shown below:

Figure 11 - Entity Relation Diagram

The diagram above illustrates the tables used to store information in the database.
Each table consists of columns. PK is the primary key of the table.

34
Chapter 5 Database Design

5.6 Relations
The relations used in the database can be read off from the ER-diagram above. All
relations have to be normalized. Normalization is used to eliminate repeating groups
by placing the repeating data in a separate relation. For example, a field can have
zero, one or more modifiers. Instead of duplicating field information (such as name,
type etc) in every row, a new relation is created called FieldModifiers, which contains
the field identifier (FieldID) and the approporiate modifier (ModifierID). This
minimizes duplication of data i.e. reduces storage space required and speeds up
queries.

The relations for the database in third normal form (3NF) are:
• Modifier (ModifierID, ModifierName): contains modifiers e.g. public, static…
• Type (TypeID, TypeName): contains primitive types, classes & interfaces
• Filepath (TypeID, Filepath): contains a list of files that are in the database
• TypeModifiers (*TypeID, ModifierID)
• Class (ClassID, ExtendsClassID, Location)
• Interface (InterfaceID, Location)
• ClassInterfaces (ClassID, InterfaceID)
• Field (*FieldID, FieldName, TypeID, ClassID, Location)
• FieldModifiers (*FieldID, ModifierID)
• Function (FunctionID, ClassOrInterfaceID): this is a method or constructor
• Method (MethodID, MethodName, ReturnTypeID, Location)
• Constructor (ConstructorID, Location)
• FunctionModifiers (*FunctionID, ModifierID)
• FunctionExceptions (FunctionID, ExceptionName)
• FunctionParameters (FunctionID, ParamName, ParamTypeID)

(The primary and foreign keys have been underlined. Where there are no foreign
keys, the primary key is the one with the star (*) prefix.)

Some relations also have a column called “Location”. This is used by the
ClassBrowser to navigate quickly to where the item is located in the file. For example,
if the user clicks on a particular method in the browser, the browser looks up its
location in the Database and then jumps to that location in the editor window.

5.7 Summary
This chapter described the design of the database. A suitable data structure i.e. a
relational database was chosen followed by a suitable DBMS (MySQL). The items
that needed to be stored in the database were identified. A data flow diagram was
designed to inspect how different parts of the system would interact with the database.
Finally, an ER diagram was created to show the entities and relations between them.

35
Chapter 6 Implementation

Chapter 6
Implementation
This chapter describes the implementation of the design models developed in the
Design phase. The goal is to produce source code and ultimately the executable
system.

6.1 Choosing an Implementation Language
It was decided to implement the system using the Java programming language for
excellent platform interoperability and performance on Windows®, Linux®,
Solaris™ and any operating system that fully supports the Java 2 SDK 1.4.x.

Another advantage of Java is that it contains JDBC technology, which allows it to
connect to any kind of DBMS using a driver. There is also the java.sql package,
which makes writing database applications easy.

Apart from the above reasons, Java is free, flexible, robust and very popular in the
programming community.

6.2 Package Hierarchy
Java uses a package mechanism that allows the classes making up a software system
to be arranged in directories called packages. This mechanism can be used to give the
IDE system a logical structure, by separating classes according to their functionality.
This can be achieved using a hierarchy such as the following, where the system is
placed in a top-level package app:

Figure 12 - System Package Hierarchy

36
Chapter 6 Implementation

The packages are:
• app: top level (root) package
• app.gui : contains user interface classes
• app.gui.prettyprinter: the java to html converter
• app.gui.print: for printing files in color and for print previewing
• app.gui.themes: contains different themes and look and feels
• app.parser: contains the classes required for parsing
• app.database: the database classes
• app.database.dbsearcher: the classes needed for searching the database
• app.options: user preferences classes

The following sections describe how the design of each part of the system was
transformed into an implementation in Java. Only the most important and interesting
aspects will be discussed.

6.3 The Parser
The parser is responsible for parsing java files and storing important information in
the database. As mentioned previously, JavaCC was used to generate the parser. It
works by converting a grammar into source code.

A complete Java grammar was obtained from an online grammar repository [15]. This
was edited so that whenever any important tokens were encountered, they were sent to
the database. At the same time, they were also sent to the class browser to be added to
the tree representation of the class. The user would be informed of any errors during
parsing. Since the parser also informs the user of syntax and lexical errors, the user
only has to run the compiler to check for semantic errors.

The three main aspects of parsing that we are interested in are: parsing class
declarations, field declarations and method declarations.

Parsing Class Declarations: The class declaration is usually the first line of the
program and contains information such as the class name, modifiers, super class and
implementing interfaces. An example is:

public abstract class Student extends Person implements MouseListener

In this example: public, abstract – modifiers
Student – class name
Person – super class
MouseListener – interface

The Java grammar contains the following method for parsing class declarations:

void UnmodifiedClassDeclaration() :
{
“class” <IDENTIFIER> [ “extends” Name() ][ “implements” NameList()]
ClassBody()
}

37
Chapter 6 Implementation

This is edited so that tokens are passed to the database. The code added is shown in
bold:

void UnmodifiedClassDeclaration() :
{
Token type ; //the class token
Token extendToken=null; //superclass
ArrayList interfaces = new ArrayList() ; //a list for interfaces
}
{
“class” type=<IDENTIFIER> [ “extends” extendToken=Name() ]
[“implements” interfaces =NameList() ]
{
try{
String className = type.toString() ;
String extendsName ;
if(extendToken == null) extendsName = “Object” ;
else extendsName = extendToken.toString() ;
dbInserter.clearOldData(className) ;
dbInserter.addClass(className,
extendsName,
filepath,
getLocation(type)) ;
dbInserter.addClassInterfaces(interfaces,className) ;

}catch(Exception e){System.out.println(e) ;}
}
ClassBody()
}

In the code above, the values of tokens are stored in variables and then sent to the
database using the appropriate methods of the dbInserter object.

Parsing Field Declarations:
An example field declaration is: private int var = 0 ;
In this example: private – modifier
int – field type
var – field name

The Java grammar contains the following construct for parsing fields:

void FieldDeclaration() :
{}
{
(“public” | “protected” | “private” | “static” | “final” |
“transient” | “volatile” )*
Type() VariableDeclarator() ( “,” VariableDeclarator() )* “;”
}

The grammar is edited so that information such as modifiers, name and type can be
extracted and put in the database. This is similar to class declarations and the full code
can be found in the code listing.

38
Chapter 6 Implementation

Parsing Method Declarations:
An example method declaration is:

public static Person getPerson (String name) throws SQLException

In this example: public, static – modifiers
Person – return type
getPerson – method name
SQLException – exception name
name – method parameter1name
String – method parameter1 type

The Java grammar contains the following construct for parsing methods:

void MethodDeclaration() :
{}
{
(“public” | “protected” | “private” | “static” | “abstract” |
“final” | “native” | “synchronized” )*
ResultType() MethodDeclarator() [ “throws” NameList() ]
( Block() | “;” )
}

This construct is edited so that ResultType(), MethodDeclarator() and
NameList() are stored in variables and then added to the database using the
addMethod method. The code listing shows this in detail.

Once the grammar has been edited in this way, JavaCC is used to generate the source
code for the parser.

Running the parser: The ParserManager class is responsible for sending files to the
parser. This process is implemented in the following way:

try{
FileInputStream in = new FileInputStream(filepath) ;
if(parser == null ) parser = new JavaParser(in)
else parser.ReInit(in) ;

parser.setFilePath(filepath) ;//adds the file to the parser
parser.settings(addToDB,buildTree) ;//tells the parser that the
//database,tree must be updated
parser.CompilationUnit();//does the parsing
}catch(ParseException e){//highlight error and warn user}

The user is informed of any errors during parsing.

6.4 The Database
The database receives information from the parser and stores it in tables using SQL.
This section describes:
• Establishing a connection
• Inserting information

39
Chapter 6 Implementation

• Adding/removing files
• Searching

Establishing a connection: The first thing that needs to be done (before SQL
statements can be executed) is to establish a connection with the DBMS, in this case,
MySQL. This involves two steps:
• Loading the driver
• Making the connection

The DBConnection class is responsible for this. It reads the database settings, which
include driver name, database URL, username and password from the configuration
file and establishes a connection in the following way:

Class.forName(driverName);
Connection con = DriverManager.getConnection(url, username, passwd);

The default driver name is: org.gjt.mm.mysql.Driver
A possible database URL is: jdbc:mysql://localhost:17149/mydatabase

Without establishing a connection, the database cannot be accessed. Once connected,
SQL statements are used to store information into the database.

Creating Tables: The relations designed previously in the ER diagram were turned
into tables using the SQL CREATE TABLE statement.

In the Modifiers table, java modifiers had to be inserted and in the Types table, java
primitive types were inserted. This was done using the INSERT INTO statement. The
type of data that the columns can contain was declared, such as INT or VARCHAR etc
and primary keys were defined.

The statements used to create the tables are in an SQL script file. This file is executed
when the system is first set up. The following statements set up all the required tables
in the database, in accordance with the design plan.
CREATE TABLE Modifier (
ModifierID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
ModifierName VARCHAR(255)
);

INSERT INTO Modifier (ModifierName) VALUES
(“abstract”),
(“final”),
(“native”),
(“private”),
(“protected”),
(“public”),
(“static”),
(“strictfp”),
(“synchronized”),
(“transient”),
(“volatile”) ;

CREATE TABLE Filepath(
TypeID INT NOT NULL PRIMARY KEY,

40
Chapter 6 Implementation

Filepath VARCHAR(255)
);

CREATE TABLE Type (
TypeID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
TypeName VARCHAR(255)
);

INSERT INTO Type (TypeName) VALUES
(“boolean”),
(“ char”),
(“ byte”),
(“ short”),
(“ int”),
(“ long”),
(“ double”),
(“ float”) ;

CREATE TABLE TypeModifiers (
TypeID INT NOT NULL REFERENCES Type(TypeID),
ModifierID INT NOT NULL REFERENCES Modifier(ModifierID),
Location VARCHAR(255) NOT NULL
);

CREATE TABLE Class (
ClassID INT NOT NULL PRIMARY KEY REFERENCES Type(TypeID),
ExtendsClassID INT REFERENCES Class(ClassID),
Location VARCHAR(255) NOT NULL
);

CREATE TABLE Interface (
InterfaceID INT NOT NULL PRIMARY KEY REFERENCES Type(TypeID),
Location VARCHAR(255) NOT NULL
);

CREATE TABLE ClassInterfaces (
ClassID INT NOT NULL REFERENCES Class(ClassID),
InterfaceID INT NOT NULL REFERENCES Interface(InterfaceID)
);

CREATE TABLE Field (
FieldID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
FieldName VARCHAR(255),
TypeID INT NOT NULL REFERENCES Type(TypeID),
ClassID INT NOT NULL REFERENCES Class(ClassID),
Location VARCHAR(255) NOT NULL
);

CREATE TABLE FieldModifiers (
FieldID INT NOT NULL REFERENCES Field (FieldID),
ModifierID INT NOT NULL REFERENCES Modifier(ModifierID),
Location VARCHAR(255) NOT NULL
);

CREATE TABLE Function (
FunctionID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
ClassOrInterfaceID INT NOT NULL REFERENCES Type(TypeID)
);

CREATE TABLE Method (
MethodID INT NOT NULL PRIMARY KEY REFERENCES

41
Chapter 6 Implementation

Function(FunctionID),
MethodName VARCHAR(255) NOT NULL,
ReturnTypeID INT REFERENCES Type(TypeID),
Location VARCHAR(255) NOT NULL
);

CREATE TABLE Constructor (
ConstructorID INT NOT NULL PRIMARY KEY REFERENCES
Function(FunctionID),
Location VARCHAR(255) NOT NULL
);

CREATE TABLE FunctionModifiers (
FunctionID INT NOT NULL REFERENCES Function(FunctionID),
ModifierID INT NOT NULL REFERENCES Modifier(ModifierID),
Location VARCHAR(255) NOT NULL
);

CREATE TABLE FunctionParameters (
FunctionID INT NOT NULL REFERENCES Function(FunctionID),
ParamName VARCHAR(255) NOT NULL,
ParamTypeID INT NOT NULL REFERENCES Type(TypeID),
Location VARCHAR(255) NOT NULL
);

CREATE TABLE FunctionExceptions (
FunctionID INT NOT NULL REFERENCES Function(FunctionID),
ExceptionName VARCHAR(255),
Location VARCHAR(255) NOT NULL
);

Inserting Data: The class that is responsible for inserting information is called
DBInserter. It contains the following methods to add data into the database:

addInterface(String interfaceName, String filepath, String location)
addClass(String className, String extendsName, String filepath,
String location)
addFilePath(String filePath, int typeID)
addClassInterfaces(ArrayList interfaces, String className)
addTypeModifiers(ArrayList modifiers, String typeName)
addField(String ieldname, String className, String fieldType)
addFieldModifiers(ArrayList modifiers, String ieldname)
addFunction(String typeName)
addMethod(String methodName, String returnType, String
typeName,String location)
addConstructor(String typeName,String location)
addFunctionModifiers(ArrayList modifiers, String typeName)
addFunctionParameters(ArrayList parameters, String typeName)
addFunctionExceptions(ArrayList exceptions, String typeName)
clearOldData(String typeName)
clearEverything()

For example, adding a method is:

INSERT INTO Method (MethodID, MethodName, ReturnTypeID, Location)
VALUES (id, methodName, returnType, location)

To clear everything in the database:

Delete from Type ;

42
Chapter 6 Implementation

Delete from Class ;
Delete from Method ;
Delete from Field ;
and so on …

Other SQL statements are executed in a similar way.

Searching the Database: A database search dialog was implemented which enables
users to search the database by either filling in their search criteria into a form or by
executing SQL statements directly. In the former case, user’s search criteria is
converted by the system into complex SQL queries and executed. A result set is
returned in the form of a table. The dialog is shown in the figure below:

Users enter information into the slots in the table. In this case, the user is looking for
all fields that have been declared private and contain the string name. Hence the user
enters “%name%” as the Field Name and chooses “private” from the drop down menu
under Access Modifiers. The user then presses Field Search.

Figure 13 - Database Search Dialog
The information is converted into an SQL statement. In this case, the statement
generated is:

SELECT Field.FieldName, T2.TypeName AS FieldType, T1.TypeName
AS Class, Modifier.ModifierName
FROM Field, Type T1, Type T2, Modifier, FieldModifiers
WHERE Field.FieldName LIKE "%name%"
AND Field.ClassID = T1.TypeID
AND T1.TypeName LIKE "%"
AND Field.TypeID = T2.TypeID
AND T2.TypeName LIKE "%"
AND Field.FieldID = FieldModifiers.FieldID
AND FieldModifiers.ModifierID = Modifier.ModifierID
AND (Modifier.ModifierName = "private")

43
Chapter 6 Implementation

In the query above, various the Field, Type, FieldModifiers and Modifier tables are
joined using their primary keys. ‘%’ is used as a wildcard. After the statement is
executed the following results are displayed:

Figure 14 - Database Search Results
The results table above has returned all fields that contain “name” and are “private”. It
also returns the type of the field (in this case all of them are strings) and the class
where they were found (firstName and lastName belong to the Person class,
whereas name and courseName belong to Student). Other searches can be carried out
in a similar way.

Adding/Removing File(s) from the Database: A dialog was needed to show the user
what files the database contains, so that the user can remove and add more files. The
following dialog was created:

Figure 15 - Add/Remove File(s) Dialog
When this dialog is first loaded a query is executed in order to get all the files in the
database:

SELECT Filepath FROM Filepath

The file list is displayed in the dialog. Users can click on any item in the list and then
click Remove. A sequence of DELETE statements is then executed to remove it and all
of its references from every table in the database. This means that all its fields and
methods are removed too.

Remove All clears all the tables in the database, except the Modifiers table and the
Primitive Types. The statements used are shown below:

44
Chapter 6 Implementation

DELETE FROM Type WHERE TypeID>8 //leave the primitive types
DELETE FROM Class
DELETE FROM ClassInterfaces
DELETE FROM TypeModifiers
DELETE FROM Interface
DELETE FROM Field
DELETE FROM FieldModifiers
DELETE FROM Function
DELETE FROM Method
DELETE FROM FunctionModifiers
DELETE FROM FunctionExceptions
DELETE FROM FunctionParameters
DELETE FROM Constructor
DELETE FROM Filepath

Finally, the dialog has an Add button. This button displays a JFileChooser, which
allows users to select a file or directory to add to the database. If a directory is
selected, all the files in it are recursively added. For example, in the figure above, the
directory called “dbsearcher” was selected, which resulted in all the java files within it
being parsed and added to the database.

6.5 Executing System Commands
One of the requirements of the system is that it should be able to compile, run and
generate javadoc for programs written by the user. To do this, commands such as
javac, java and javadoc needed to be executed from within the application.

This task was designated to the OutputFrame class. It uses the java Runtime classes
to execute commands that belong to the operating system, in the following way:

Process proc = Runtime.getRuntime().exec(command);

(command is any system command such as javac.)

The results of executing a command are then displayed by using:

InputStream istr = proc.getInputStream() ; //or proc.getErrorStream()
BufferedReader br = new BufferedReader(new InputStreamReader(istr));
String str ;
while ((str = br.readLine()) != null)
{
if(compiling) parseError(str) ;
else append(s,outputPane) ;
}

In the code above, the input stream of the process (or the error stream if compiling) is
obtained (which contains the results of the process) and a buffered reader put on it. A
while loop is used to append each line onto the output window. If the command being
executed was a compile command such as javac, then the error is parsed and is
displayed in the form of hyperlinks.

All compiler errors are of the general form:

Filepath “:” linenumber ”:” error description

45
Chapter 6 Implementation

For example when compiling a file called Hello.java the following errors were
displayed:

Hello.java:36: ';' expected
}

Since all errors have a fixed format, they can be parsed easily and can be broken
down into the file path, line number and description. The file path and line number are
displayed in the form of hyperlinks:

Hello.java:36: ';' expected
}

Users can click on these links to jump to the correct line in the source code. The error
is highlighted in red. In this way the user can avoid delving through lots of lines of
code looking for the error.

Figure 16- Ouput Window
6.6 The API Viewer
The API Viewer enables users to browse through Java documentation. The
documentation that can be viewed could either be the “API specification for the Java
2 Platform, Standard Edition” [22] which contains information about all the
packages; classes and interfaces in the java libraries or the user could specify a
different project.

Documentation about classes is usually stored in a particular directory or URL. For
example, the Java API reference at UCL is located at:

http://www.cs.ucl.ac.uk/teaching/java/javadoc/api/index.html

Base URL

The URLs for the packages and classes can be derived from the base URL by
appending the following:

Packages: http://www.cs.ucl.ac.uk/teaching/java/javadoc/api/overview-frame.html
Classes: http://www.cs.ucl.ac.uk/teaching/java/javadoc/api/allclasses-frame.html

46
Chapter 6 Implementation

The API Viewer connects to all the URLs given above and parses the HTML files. It
builds a hash map, which maps all the classes, packages and interfaces to their
corresponding URLs. It then displays a list of all the items on the screen. When an
item is clicked, its URL is looked up in the hash map and the page corresponding to
the URL is displayed.

Users can change the main URL of their documentation in the options window. In this
way they can view the documentation of different projects with ease.

The API Viewer has a search box in which users can search for specific items.
Wildcards are matched too. This means that users do not need to scroll down a long
list of classes to find the one that they are looking for (which is the case when viewing
documentation via a web browser). So, for example, if the user enters “String*” into
the search box, a list of possible matches is displayed including String, StringBuffer,
StringContent and so on. The user can then choose the one s/he wishes to view.

The code for matching wildcards is shown below:
/**
* Finds all matching words
* @param text what we want to match e.g XML*
*/
public void findMatches(String text)
{
//create a new Pattern object and a vector to hold matches
Pattern p = Pattern.compile(text) ;
Vector v = new Vector(10) ;

//we have to check for a match in the typeslist
for(int i = 0 ; i< allTypes.size() ;i++){
//compare each type in the list to the pattern
String s = (String)allTypes.get(i) ;
Matcher m = p.matcher(s) ;
if(m.matches()){
v.add(s) ; //if it matches add to vector
}
}…
}
Figure 17 - API Viewer

47
Chapter 6 Implementation

6.7 The Code Palette
This is a tool for inserting code into the editor quickly and efficiently. It is displayed
in the form of a JTree, in which different nodes correspond to different code items.
The tree is built by reading an XML file. An extract of the XML file is shown below:

<codetype name="Comments">
<code name="//">//|</code>
<code name="/* */">/*|*/</code>
</codetype>

<codetype name="Loops">
<code name="do" >do\n{\n|\n}\nwhile();</code>
<code name="while" >while()\n{\n|\n}</code>
<code name="for" >for( ; ; )\n{\n|\n}</code>
</codetype>

The XML code above contains a special character ‘|’ in some places. For example, a
print statement is represented as:

<code name="print" >System.out.println(|);<code>

This character is used to indicate where user’s selected text is to be inserted. Hence if
the user selected the string “Hello World” in the editor and then clicked on the print
item in the tree, the character would be replaced by the selection and the following
would be displayed:

System.out.println(“Hello World”) ;

If no text is selected:
System.out.println(); is displayed.

Building the tree: The XML code is parsed
using an XML DOM Parser from the
javax.xml.parsers and org.xml.sax
libraries. A tree is built. A tree listener is
added to the tree so that whenever a node is
clicked, the corresponding item is inserted at
the current position in the editor.

(Example code for this feature was taken
from JAXP Tutorial [23])

Figure 18 - Code Palette

48
Chapter 6 Implementation

6.8 The Class Browser
When a file is opened or saved the Java Parser extracts all the important information
and sends it to the Class Browser (and to the database). The Class Browser provides a
frame for displaying a tree reflecting the structure of the class. The tree itself is built
by a Tree Builder class. The Tree Builder builds a tree according to the information
sent to it and then passes the finished tree to the Class Browser, which displays it on
the screen.

Information is displayed in the form of nodes, which display the file path, class name,
super class, interfaces, methods and fields. Nodes are colored according to the traffic
light scheme; items that are public are green, protected are yellow and private are red.
The tree listens for mouse clicks. When the user clicks on a particular node, an SQL
query is executed to find out the location of the item that was clicked. For example, if
a field was clicked:

String query = "SELECT Location FROM Field, Type WHERE "+
"Field.FieldName = \""+name+"\" AND "+
"Field.TypeID = Type.TypeID AND "+
"Type.TypeName = \""+type+"\" AND "+
"Field.ClassID = "+typeID ;
ResultSet results = dbstmt.executeQuery(query) ;
results.next() ;
return results.getString("Location") ;

This returns the location of the field. If the file is open, the location is highlighted in
the editor. This feature will obviously not work if the database is not connected.

The Class Browser also has a pop up
menu, which appears when the user
clicks with the right mouse button
on the tree. This menu has three
buttons:
• Open file: opens the file for
editing
• Delete: removes this file
from the tree
• Go to: Highlights the
location as described above.

Fig 19 – Class Browser

49
Chapter 6 Implementation

6.9 The File Explorer
The File Explorer is common to many applications. It presents the user’s file store in
the form of a tree and enables them to browse their directories and open files. This is
implemented by starting at the user’s home directory, which is obtained by using the
statement:

System.getProperty("user.home");

This statement returns the root directory, which is then recursively traversed using
methods from the java.io package such as directory.list()(returns a list of all
files in the directory). During this process a tree is built showing the file hierarchy. A
filter is applied so that only directories and files with a “.java” extension are
displayed in the tree. These files are displayed with a special icon so that can be easily
identified.

When a node representing a file is clicked, its path is obtained and the file is opened
in a new editor, provided it is not already open. The file is parsed and the database
and class browser are updated.

The tree also has a pop up menu that is
invoked whenever the user clicks using the
right mouse button. The menu has four
buttons:
• Open File: Opens the file.
• Browse: Adds the file or directory
to the browser.
• Add to Database: Adds the file or
directory to the database.
• Reload: Refreshes the entire file
structure e.g. if the user creates a
new file.

Figure 20 – File Explorer

6.10 The Editor
Java code is typed into the editor. All editing actions such as cut, copy, paste, undo
and redo etc take place in the editor. In addition, the editor also needs to know if the
current file is saved or not, so that files can be closed safely. This was implemented

50
Chapter 6 Implementation

using a VetoableChangeListener, which listens for the window closing event and
then checks to see if the file has been saved.
Syntax Highlighting: The editor holds a SyntaxDocument, which is responsible for
highlighting code as the user types. This is implemented using a document listener.
Whenever a character is inserted into the document, the resulting word is looked up in
a table of keywords and types. If it is found then it is highlighted in accordance with
the keyword color scheme. It is then checked whether it is a String or part of comment
and then colored accordingly.

Line numbers: This is an external component that fits onto the side of the editor and
displays line numbers. It uses a canvas to paint on which the numbers are painted. The
spacing between numbers is determined by the font size of the editor.

Bracket Matching: This was implemented using a CaretListener. Whenever the caret
encountered a bracket it searched for the matching one. The code below shows how
an opening bracket found is found given a closing bracket, the current position and
the string to look in.
/**
* Finds an opening bracket that matches the closing bracket.
*
* @param closeBracket the closing bracket.
* @param pos the position of the closing bracket.
* @param data the string to look in.
* @return the position of the opening bracket.
*/
public static int findOpeningBracket
(char closeBracket, int pos, String data)
{
char openBracket;
//find the opening bracket that matches this one
switch(closeBracket)
{
case ')': openBracket = '(' ; break ;
case '}': openBracket = '{' ; break ;
default: openBracket = '[' ; break ;
}

//now iterate backwards along the string until you find the
//desired bracket
int count = 0 ;
for(int i = pos-2 ; i>=0 ; i--)
{
char c = data.charAt(i) ;

if(c==')' || c=='}' || c==']') count++ ;
else if(c=='(' || c=='{' || c=='[')
{
if(c==openBracket && count == 0 )
{
return i ;
}
else count-- ;
}
}
return -1 ;
}

51
Chapter 6 Implementation

In this way the location of the opening bracket is found. There is a similar method for
finding the closing bracket. Once a matching bracket is found, the region between the
brackets is highlighted.

Popup menu: Like any text editor, this editor has a popup menu, which is triggered
when the user clicks on the text area using the right mouse button.

Figure 21 – Java Editor

6.11 User Options
Options are stored in a configuration file. This file is read before the system starts up.
An extract from the file is shown below:

# IDE Preferences File
# This is a generated file! Do not edit.
NAME:Fahd Shariff
COMPILECMD:javac -classpath .:<dir> <filepath>
RUNCMD:java -classpath .:<dir> <classname>
JAVADOCCMD:javadoc -d <dir> <filepath>
APIURL:http://www.cs.ucl.ac.uk/teaching/java/javadoc/api/
USER:root
PASSWORD:
DRIVER:org.gjt.mm.mysql.Driver
URL:jdbc:mysql://dundas.cs.ucl.ac.uk:17149/jde2

52
Chapter 6 Implementation

The file contains a variety of information including the name of the user, java
commands and database settings. This gives the user freedom to execute different
commands, for example, they can change their classpath in the compile command or
their database URL in order to use a different database.

The options file contains tags such as <dir>, <filepath> and <classname>.
These are determined by the system during execution and refer to the directory, file
name and class name of the java program currently being edited.

Options Dialog: This is a dialog that allows users to change their preferences. It is
built using a JTable.

Fig 22 – Options Dialog
When the Apply button is pressed, all the values in the second column of the table are
written to the options file and the file is saved. Reset changes all the values to their
defaults, which are coded within the system. Cancel closes the window.

6.12 Printing
The system would not be complete without a printing facility. Files can be printed
uses the Java Printing API [24] and syntax highlighting and user fonts are all retained
on the paper version as well. Code for this operation and for print previewing was
adapted from the famous WordProcessor example in "Swing, 2nd Edition" by
Matthew Robinson and Pavel Vorobiev [8]. It had to be modified to work with this
system.

When the Print button is pressed a standard Java Print Dialog is displayed and the file
is then printed.

public void printData()
{
try
{
PrinterJob prnJob = PrinterJob.getPrinterJob();
prnJob.setPrintable(this);
if (!prnJob.printDialog())
return;
prnJob.print();
}

53
Chapter 6 Implementation

catch (PrinterException e)
{System.out.println(e) ;}}

6.13 Pretty Printing
This is used to mark up java code into HTML format, which can then be viewed as a
webpage. This feature had already been implemented as a 2nd year group project using
Mr. John Washbrook’s code. That project, however, had been web-based so a little
work had to be done to plug it into this system.

When the Save As Webpage button is clicked, the user is asked to enter the name of a
web file to save the java file as. The java file is parsed, and HTML tags are emitted
depending on the type of token encountered by the parser.

For example, the statement: public void doSomething();
Becomes:
<html>
<head>
<title>Pretty Printer Results
</head>
<body>
<b>public </b>
<b>void </b>
<font color = “blue”>doSomething() </font> ;
</body>
</html>

This HTML code can now be viewed in a web browser.

6.14 Toolbars
The system has two toolbars located at the top of the screen. They can be removed if
desired. The toolbars are:

Standard Toolbar: This is a conventional toolbar, similar to that found in most
applications. It contains buttons for file operations (open, save) and editing (cut, copy,
paste, undo, redo, find). The extreme right of this toolbar contains buttons for java
operations (compile, run, applet viewer, API viewer, java doc).

It was decided to implement time-consuming tasks, such as opening a file and
compiling, as separate threads. This enables the GUI to remain responsive while such
tasks are being carried out in the background.

For example, compilation takes place in a separate thread in the following way:

outputFrame.setFile(file) ;
Thread runner = new Thread()
{
public void run()
{
try
{
outputFrame.compileCode() ;
}
catch(Exception e) {System.out.println(e) ;}

54
Chapter 6 Implementation

}
};
runner.start() ; //starts the thread

A new thread is created which compiles the file. If a new thread were not created, the
user would have to wait until during the compilation process. This way, the user can
continue working on the file while compilation takes place. Opening a file, saving,
parsing and database operations run in separate threads too.

Formatting Toolbar: This holds buttons for formatting text. Users can change the
font type, size and style of selected text. Text alignment can also be changed.

Once a new item (font name, size, style etc) is selected from a drop down menu, it is
applied to the selected text through the use of an attached ActionListener. The item
is assigned to a SimpleAttributeSet instance using the appropriate method from
the StyleConstants class:

For example, to change the font family:

String fontName = fontCombo.getSelectedItem().toString();
MutableAttributeSet attr = new SimpleAttributeSet();
StyleConstants.setFontFamily(attr, m_fontName);
setAttributeSet(attr);

The setAttributeSet() method is used to assign a given set of attributes to the
currently selected text.

public void setAttributeSet(AttributeSet attr, JTextPane t)
{
int xStart = t.getSelectionStart();
int xFinish = t.getSelectionEnd();
StyledDocument d = t.getStyledDocument();
d.setCharacterAttributes(xStart, xFinish - xStart, attr, true);
}

The setAttributeSet() method first determines the start and end positions of the
selected text. The setCharacterAttributes() method is called to assign the given
set of attributes to the selection.

6.15 Menus
The system has menus that categorize the buttons on the toolbars and also provide
additional features. The menus are similar to those found in other applications. Each
menu item has a mnemonic and accelerator.

For example, the code below creates a new menu item called Open. This is activated
when the user presses Ctrl-O (accelerator) and also if the user presses Alt-O
(mnemonic).

item = new JMenuItem(“Open”) ;
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O,
Event.CTRL_MASK));
item.setMnemonic(KeyEvent.VK_O);

Other menu items were implemented in a similar fashion.

55
Chapter 6 Implementation

6.16 Implementing Shared Actions
There are some actions, which are common to both the standard toolbar and the
menus. For example, the toolbar contains buttons such as New, Open, Save, Cut, Copy
and Paste etc. These are also present in the File and Edit menus.

Instead of implementing these actions twice in the menu and toolbar classes, it was
decided use action objects. Each action has its own class and all the actions are
present in a single java file called AppAction.java. An extract of this file is shown
below:

public abstract class AppAction extends AbstractAction
{
protected AppDesktopPane desktop ;

public AppAction(String name, ImageIcon icon)
{
super(name, icon) ;
//the name and icon to use
desktop = App.getDesktop() ;
}
}

//all actions extends AppAction

/**
* New File Action
* Opens a New Blank Java Editor
*/
class NewAction extends AppAction
{
public NewAction()
{
super("New", new ImageIcon("app/images/New.gif")) ;
}

public void actionPerformed(ActionEvent e){
JavaEditor editor = new JavaEditor() ;
desktop.addInternalFrame(editor) ;
}
}

/**
* Cut Action
*/
class CutAction extends AppAction
{
public CutAction()
{
super("Cut", new ImageIcon("app/images/Cut.gif")) ;
}

public void actionPerformed(ActionEvent e){
JavaEditor selected = desktop.getSelectedEditor() ;
if(selected != null) selected.getCustomTextPane().cut() ;
}}

56
Chapter 6 Implementation

In this way, all actions shared by different components are implemented as individual
actions. Buttons and menu items that use these actions can then be created by:

AppAction newAction = new NewAction() ;
JButton button = new JButton(newAction) ;

This creates a button called New. When the button is pressed the actionPerformed
method of class NewAction is invoked.

6.17 Window Management
Programmers usually have a number of files open at the same time, which can be
confusing. To handle this, a virtual desktop was implemented. This has a list to keep
track of all the files opened so far. This list is updated if a new file is opened or an
existing file is closed. The desktop also provides the facility for arranging (tiling),
minimizing and restoring windows that it contains.

Windows can be arranged horizontally or vertically. This is done by counting the
windows in the desktop and then positioning them using the setLocation(x,y)
method.

6.18 Summary
This chapter described the implementation of the system based on the design given in
previous chapters. In particular it discussed how the parser was implemented from a
grammar using JavaCC and how the database was built. Various other major
components of the system, such as the Code Palette, Class Browser and API Viewer
were implemented. Minor components such as toolbars and menus used by the system
were discussed briefly. The factors taken into account while implementing each
feature were also presented.

As a result of this process, an Integrated Java Development Environment has been
created as intended.

57
Chapter 7 Testing

Chapter 7
Testing
This chapter describes testing phase of the software development cycle. Due to large
number of components, only the important ones have been discussed below. The
different strategies used and any bugs found have also been presented here. Test
results can be found in the appendix.

7.1 Testing Strategy
In order to test that the system behaves as intended, various testing methods have
been employed.

Individual java classes were tested using the JUnit framework [25]. The concept of
using unit testing to drive design has been employed to a limited extent. Every
method in each class of the system was tested for a variety of inputs and expected
outputs. The testing of each part of the system was carried out as each method was
written, so as to save time that would otherwise be used on a specific testing phase.
This process identified several errors in the code mainly NullPointerExceptions.

Throughout the development process, System.out.println() statements were
inserted in different areas of code and results that were printed on the console were
compared with expected values.

GUI components and tools were mostly tested in an interactive fashion. User testing
was carried out as well.

Since, one of the major features of the system is to parse source code and add it to a
database, the parser and database classes had to be tested thoroughly. These have been
explained in some detail below.

7.2 Testing the Parser
The first step is testing the parser. This is important because if the parser extracts the
wrong information from the java source, the database will be affected. Testing a
parser means running it over a challenging set of source files and verifying that the
correct tokens are extracted.

A set of dummy files was created. For thorough testing, each file contained many
different constructs such as a super class, interfaces, exceptions, modifiers, parameters
etc. One of these files is shown below:

public class Test extends SuperTest implements Imp1, Imp2, Imp3
{
private int age ;

58
Chapter 7 Testing

protected static String name, address ;

public Test(String name) throws Exception {}

public synchronized int getAge(String name, String address) {}
private void setName(String n) throws AnotherException {}
}

It is hard and time consuming to automate the testing of a parser, mainly because a
grammar is used which is converted to java code by JavaCC. An alternative was to
insert print statements at vital points in the code. The words printed out to the console
were then compared with what was expected.

Testing whether the correct information is extracted from the Class Declaration is
shown below:

void UnmodifiedClassDeclaration() :
{
Token type ; //the class token
Token extendToken=null; //superclass
ArrayList interfaces = new ArrayList() ; //a list for interfaces
}
{
"class" type=<IDENTIFIER> [ "extends" extendToken=Name() ]
["implements" interfaces =NameList() ]
{
try{
String className = type.toString() ;
String extendsName = extendToken.toString();

System.out.println(“Name:” +className) ;
System.out.println(“SuperClass:” +extendsName) ;
for(int i = 0 ; i < interfaces.size() ; i++)
System.out.println(“Interface:” +interfaces.get(i)) ;

}catch(Exception e){System.out.println(e) ;}
}
ClassBody()
}

In the code above, print statements were inserted to print out the class name, super
class and interfaces. In the same way, they ere inserted into the FieldDeclaration
and methodDeclaration constructs.

7.3 Testing the Database
The next logical step after testing the parser is to test the database. The following
functionality had to be tested:
• Adding a file
• Removing a file
• Removing all files
• Updating a file
• Searching

59
Chapter 7 Testing

Once again a set of dummy java files were created. They were sent to the parser,
where they were parsed and added to the database. The database was then checked
using SQL select statements to see whether items were indeed added in the correct
tables and columns. The files were changed, by adding a new method or changing an
existing file name, and then re-parsed. The database was checked again to ensure that
it had been updated correctly.

Using the system interface, files were removed from the database and the database
was once again checked.

Different combinations of database searches were carried out via the GUI and the
results compared to expected results. Due to the complexity of some of the SQL
queries a few minor bugs were encountered but were ironed out immediately.

7.4 Unit Testing
Where appropriate Unit tests were constructed for all major components of the system
using the JUnit framework. This was mainly used to test methods that made use of
container objects such as Arrays and ArrayLists and those used for String
manipulation.

For example, the StringOperator class has a method for replacing all occurrences of
a substring with another string. This method is shown below:

/**
* Returns a new string resulting from replacing all occurrences of
* "repl" in this string with "with".
*/
public static String replaceString(String text, String repl,
String with)
{
StringBuffer buffer = new StringBuffer(text.length());
int start = 0;
int end = 0;
while( (end = text.indexOf(repl, start)) != -1 ) {
buffer.append(text.substring(start, end)).append(with);
start = end + repl.length();

}
buffer.append(text.substring(start));

return buffer.toString();
}

The method was tested using JUnit. The extract from the JUnit test class is shown
below:

public void testReplaceString()
{
assertEquals(StringOperator.replaceString("computer","put","abc"),
"comabcer");
assertEquals(StringOperator.replaceString("abc","xyz","123"),
"");
}

60
Chapter 7 Testing

Unit testing was useful in identifying errors due to boundary conditions such as
ArrayIndexOutOfBoundsException and NullPointerException.

7.5 Testing the GUI
Unfortunately there are not many commercial tools available for automated GUI
testing. Manual testing of GUI based applications is slow, tedious, error-prone, non-
repeatable and expensive. The main challenge is the great number of combinations
involved. Each user choice opens a number of different options. For example, if the
user clicks on SearchDatabase they can then decide to search for a Class, Field or
Method. If they decide to search for a Field then they must enter the FieldName,
FieldType and modifiers. So the number of different permutations and combinations
is vast.

To handle this problem, testing was carried out in two stages:
• Testing features that represent use case scenarios (described in the design
phase).
• Random testing

As a result of this process, some errors were found and corrected. Errors were mainly
due to action events e.g. tree not responding, errors not highlighted etc.

7.6 Usability Testing
In order to asses the quality and usefulness of the system's user interface, and to
achieve some degree of testing of the system as a whole from a third-party viewpoint,
it was decided that some basic user testing should be carried out. This would provide
information about how users and systems perform in the real world context.

Since the system is intended for programmers, it was decided that a computer science
student at university would be an ideal candidate for user testing. The testing process
involved observing users interacting with the system. Users were requested to open
java files and try out the database, class browser, code palette and compiler. Other
features were also tested in this way.

Due to lack of users, user testing was also carried out by taking on the role of the user
and walking through the system. The system was also used to work on the rest of the
system i.e. to edit its own source code.

Due to its multithreaded nature, the system may crash when carrying out large tasks
e.g. opening a file.

7.7 Testing Platform-Independence
The system has been implemented completely in Java 1.4.1, which enjoys “write once
run anywhere” flexibility. It was still decided to test the system on different
platforms. Since the system had been implemented completely on a UNIX operating
system (in the departmental machines, due to the availability of MySQL), it had to be

61
Chapter 7 Testing

tested whether it worked as expected on Windows. Everything worked as planned but
the system ran slower on Windows.

7.8 Summary
The system was tested using a variety of methods such as JUnit testing, print
statements and inspection. Usability testing was carried out to check whether the
system performed well in the real world context. Any bugs found during testing were
rectified immediately. The system works as expected. It may crash unexpectedly, very
rarely, due to multithreading. In order to avoid this, a single thread could be used for
the entire system, but this will slow things down tremendously.

62
Chapter 8 Conclusions

Chapter 8
Conclusions
The aim of this chapter is to evaluate the key achievements and limitations of the
work undertaken, and to arrive at some conclusion about the overall worth of the
project.

8.1 Evaluation
The following main criteria were specified at the outset to define successful
completion of the project:

• Develop a handy, open-source and free IDE to the Java development
community.
• Explore the area of SCID and create a tool that allows information about the
source code to be stored in a database, which is accessible to user queries.
• Implement a navigation tool to allow easy navigation through source code.
• Build a tool to allow code insertion.
• Allow users to jump to any error in the source code.
• Develop an API Viewer with search capability.
• Create an editor with syntax highlighting.

It can be said that these goals have been broadly achieved and the project does seem
to have been largely successful. A fully working IDE has been produced that satisfies
its goals to a large extent. It was used for further development of the project i.e. to edit
its own source code and worked very well.

The project made use of a number of different libraries and programming
technologies including SQL for the database, JavaCC for generating a parser and
XML for code insertion and tree building. Java was used as the main implementation
language.

MySQL was the only DBMS available in the department. It does not support a
number of features such as stored procedures, transactions and most importantly
nested SELECT statements. As a result, queries involving lots of tables became quite
complex.

8.2 Performance
The final system allows users to write programs quickly and easily. The speed is on
par with (if not faster than) other development environments. This is due to the fact
that tasks requiring lots of resources are started up in new threads. This keeps the
system responsive to user actions. All implementation was performed on UNIX

63
Chapter 8 Conclusions

Solaris Version 8 using Java 1.4.1. The program performed as expected in that
environment but display and speed may differ on other operating systems.

8.3 Further Work
Although the implementation of this project has been broadly successful, there are
some areas, which might be improved upon, and many areas in which further work
could be undertaken. The system is spread over a number of packages and all code is
clearly documented. It is designed so that new components can easily be added at a
later date.

Improvements and extensions to the existing system are outlined below:

8.3.1 Extending the Database
The current database only stores information about classes, interfaces, fields and
methods. This can be extended to record other information such as that about
packages, nested classes, object references, method bodies, where methods are
invoked and so on. The final goal would be to extend the database so that it would
store every single construct contained in a java source file. This would eventually lead
to the extinction of .java files!

One way of doing this would be to create new relations in the database to hold all the
extra information. For example, another table would be created to hold nested classes
and so on. As a result code will not be stored in files, but will be stored exclusively in
the database. This is an important step away from thinking of programs strictly as
linear streams of ASCII characters. This is what SCID hopes to achieve in the future.

Once stored in the database, users can pick whatever information they wish to view
and are not forced to view the whole file. For compiling source code, information
would be extracted from the database, stored in a temporary file which would them be
compiled normally.

8.3.2 Extending the Code Palette
The existing code palette does not contain all the constructs and templates used in
programming. In the future new templates could be added, such as those used in
building swing applications, applets and in web applications like servlets and Java
Server Pages. This could be carried out by simply extending the existing XML file to
include these new templates and constructs.

In addition, users could be given the option of entering information into dialog boxes
when a code item is clicked. For instance, if the user presses the for loop button, then
a dialog would appear prompting the user to enter the initial, terminator and increment
expressions.

8.3.3 More User Options

64
Chapter 8 Conclusions

In the future, the system could enable users to specify their formatting preferences and
automatically format new source code or apply to existing source code. Preferences
include indenting, tab size, braces, spacing, syntax highlighting colours etc. Users
could also be allowed to customise their toolbars and menus.

In addition a more efficient method could be developed for storing options. The
current system uses a text file for this purpose; but in the future options could be
stored in an XML file, perhaps in the following way:

<options>
<name>Fahd Shariff</name>
<compilecommand>javac</compilecommand>
</options>

8.3.4 Code Completion
Many IDEs implement pop-up code completion. As the user types, possible
completions are displayed in a list, allowing the user to select the appropriate one.
This is also implemented in web browsers for completing URLs.

This feature could be implemented by using a Document Listener, which compares
words that the user types to a word list and returns possible matches. This is very
useful and speeds up code writing by a great deal.

8.3.5 UML Visualisation
This feature was set out in the requirements document but was not implemented due
to its complex nature and lack of time. The idea is to create UML diagrams for a set
of classes. The challenging aspect of this feature is layout. Once objects are drawn on
a panel, they will have to be laid out in a “tidy” manner i.e. not overlapping and
making best possible use of the panel in which they are drawn. Users would then be
able to browse source code by clicking on objects in the UML diagrams.

8.3.6 Refactoring
A refactoring is an operation, which modifies code to improve its design without
affecting the meaning of the program [26]. Possible refactorings include: extract a
method, introduce a variable, change a method, surround with try/catch, and
automatically update all references to a package, class, or method being renamed or
moved.

8.3.7 Wizards
Wizards can speed up code writing.

• The New wizard could allow users to fill in information such as class name,
super class, interfaces, fields and methods into a dialog box. Java source
would be generated automatically from this information.

65
Chapter 8 Conclusions

• The JUnit wizard could automatically generate test classes for java source
code.
• The Javadoc wizard could automatically insert documentation above methods
and fields by looking at their declarations.
• The Jar wizard could allow java projects to be zipped up into jar files.

8.4 Summary
This project has achieved its aims – namely to create an Integrated Development
Environment for Java that implements Source Code In Database, allows class and
error navigation, code insertion and increases the productivity of programmers with a
number of other tools.

The project has resulted in the creation of a very useful piece of software with a
database, code navigation, code insertion and error linking. There are many
advantages of the database, which provides more motivation to develop this further in
the future. Individual tools, such as the API Viewer, can be used separately if desired.

The scope for further work on this IDE is immense. This chapter outlined some of the
improvements to the existing system and new features that can be plugged into it. In
particular it was discussed how the extension of the database could lead to the
extinction of source code in files.

66
Chapter 9 Endmatter

Chapter 9
Endmatter
This chapter contains the various appendices, the bibliography and glossary.

Contents
• A System Manual
• B User Manual
• C Test Results
• D Code Listing
• E Project Plan
• F Interim Report
• G Bibliography
• H Table of Figures
• I Glossary

68
Appendix A System Manual

Appendix A
System Manual
This document contains all the technical details such as how the system should be
compiled and run. It also describes where the code is stored, so that it can be modified
in the future.

The official homepage of this project is:
http://www.cs.ucl.ac.uk/students/f.shariff/projects/fyp/
All documents and code may be downloaded from here.

For the purposes of this document, the software will be referred to as JIDE (Java
Integrated Development Environment).

A.1 System Requirements
• This software requires Java 2 version 1.3 or 1.4. Before installing, make sure
you have a compatible Java virtual machine.

• The recommended operating system is Unix.

• You will need approximately 4.5 MB of free disk space to complete the
installation.

• If you wish to use the database feature, you will need MySQL, which can be
downloaded free from: http://www.mysql.com/downloads. You will not need
to download database drivers since they are provided.

A.2 Installation Instructions
1. Create a directory for the software e.g. jide.

2. Copy the jide.zip file from the disk into this directory.

3. Execute the command to extract all the contents of the zip archive. This will
vary according to which tool you use, but the command line format for using
unzip would be: unzip jide.zip

4. The following files and directories are extracted:
• jide.jar
• src/
• ReadMe.txt
• buildDB.txt

69
Appendix A System Manual

5. To install the database, first start up the MySQL daemon by typing:

shell> safe_mysqld&

on UNIX machines.

6. Enter the following command:

shell> mysql –u root –p < buildDB.txt
Enter password: *****

This command uses a batch file to build a database called jide and set up all
the tables.

7. Installation Complete!

A.3 Running the Application
To run the application simply type:

shell> java –jar jide.jar

This command must be executed in the directory containing jide.jar

You will need to set up your preferences (particularly your database configuration) in
the Options menu.

A.4 For Developers
The src directory contains all the source code (including test classes) and
documentation of the application. It also contains the following batch files:

• compileapp: used for compiling the application.
• runapp: used for running the application.
• doc: used for generating java documentation for the application.

Simply type the name of the batch file at the command prompt to execute it.

70
Appendix B User Manual

Appendix B
User Manual
This document attempts to provide help and assistance to programmers using this
Integrated Java Development Environment. There are many advantages to using this
IDE over other editors, although the biggest, may be that source code is parsed and
information about classes, methods and fields are stored in a database. This has
proven to be very useful when searching for something that you know is out there
somewhere, but you don't know where.

The application has a class browser for easy navigation through classes. It also has a
code palette, which enables code templates ranging from classes and applets to simple
statements to be inserted at the click of a button.

Finding errors is very easy, since the application has both a parser and compiler. The
parser alerts you to syntax and lexical errors (which make up approx 80% of errors)
before you press the compile button. This means that the compiler only returns
semantic errors and the number of times the compiler has to be run is significantly
reduced. All errors are linked to the source code via hyperlinks so that they can be
rectified easily.

The sections below cover basic usage of the different features provided by the IDE.

B.1 Working with Java Files
This section describes basic file commands such as Open, Save, Save As Webpage,
Print and Print Preview. It also describes in more detail, how the file explorer is used
and how files can be added to the browser and/or database.

1 Creating New Files
Menu: File>New
Toolbar: New button
Shortcut: Ctrl-N
This opens a new, empty editor.

2 Opening Files
Menu: File>Open
Toolbar: Open button
Shortcut: Ctrl-O
File Explorer: Popup>Open File
This displays a file chooser dialog box and loads the specified file into a new
editor. Alternatively, a file can be selected from the File Explorer. By default,
opening a file also adds it to the class browser and to the database.

71
Appendix B User Manual

3 Saving Files
Menu: File>Save
File>Save As
Toolbar: Save button or Save As button
Shortcut: Ctrl-S
This saves the current file to disk. If Save As is used, then the current file is
saved to the new specified location. Saving a file, updates the class browser
and the database.

4 Saving Files As WebPages
Menu: File>Save As Webpage
This saves the current file into a coloured HTML format, which can be viewed
in any standard web browser.

5 Printing and Previewing Files
Menu: File>Print or File>Print Preview
Shortcut: Ctrl-P
This prints the current file by displaying a Page Setup dialog first. The Print
Preview feature can be used to preview the file before printing. Printing
preserves syntax highlighting.

6 File Explorer
This is located on the extreme left of the application. The tab is named File
Explorer and contains a list of all the files in the system in the form of a tree.
The explorer can be closed by clicking on the X button in the top right hand
corner. It can be viewed as a floating frame by clicking on the Pop button. It
can be docked back into the main application by using the Dock button.

To browse a directory double-click it. Java files are displayed with a ‘cup’
symbol. Unopened Java files can be displayed by double-clicking them.

Clicking a file or directory with the right mouse button displays a popup menu
containing various commands. The Open File button simply opens the file and
is equivalent to clicking on the file. The Browse button adds the files to the
class browser. The Add To Database button adds the selected file to the
database. The Reload button refreshes the file explorer to show any new files
or whether any files have been deleted from the system.

7 Closing Files and Exiting the Application
Menu: File>Close or File>Quit
Shortcut: Ctrl-W or Ctrl-Q
The Close button closes the current file. If it has unsaved changes, you will be
prompted if they should be saved first. The Quit button will completely exit
the application.

B.2 Using the Database
This section describes how the database is to be used in terms of adding/removing
files and searching.

72
Appendix B User Manual

1 Connecting to the Database
Menu: Database>Connect
All the features of the database will remain disabled until the Connect button
is pressed. If your database is configured correctly, then you will see the
message “Connected” on the console. If there is an error displayed, make sure
that you have MySQL installed and that your server is running. (If it is not,
type safe_mysqld& to start it) and check your options to make sure that you
have entered the correct URL for the Database, which is of the form
jdbc:mysql://hostname:17149/jide

Once connected, you can disconnect from the database by pressing
Database>Disconnect. This will close the connection and all other
functionality will be disabled.

2 Adding and Removing Files from the Database
Menu: Database>Add/Remove File
File Explorer: Popup>Add To Database
A dialog is displayed that lists all the files currently in the database. To add
more files to the database, click Add File(s) on the toolbar and select the file
or directory you wish to add. If a directory is selected, all java files under that
directory are added recursively to the database. The status bar displays what is
currently being added. The list is refreshed to show the new files that ere
added. Alternatively, files can also be added by right clicking on a file or
directory in the file explorer and selecting Add to Database from the popup.

To remove a file, select it from the list and press Remove. To remove
everything in the database press Remove All. This will clear the database.

3 Searching the Database
Menu: Database>Search
A search dialog is displayed. Search information is filled in the slots provided.
The wildcard character is ‘%’. The Access Modifiers slot has a pull down
menu from which the appropriate modifier can be selected. Other Modifiers
must be comma separated. After filling in the search criteria, the appropriate
search button on the toolbar should be pressed. The results are displayed in the
Results tab in the form of a table.

The SQL Search tab allows you to execute SQL queries on the database.

B.3 Navigating Source Code
The class browser displays the structure of java files in the form of a tree and allows
code navigation. It is present as a tab attached to the extreme left of the application.
The browser can be shown in a floating window by pressing the Pop button and can
be docked back again by using the Dock button.

4 Adding a File to the Browser
By default, whenever a file is opened via the file explorer, menus or toolbars,
it is added to the browser. Files may also be added by selecting a file or
directory in the file explorer and selecting Browse from the pop up menu. If a

73
Appendix B User Manual

directory is selected, all the java files under it are added to the browser
recursively.

5 Refreshing the Browser
The browser is automatically refreshed whenever a file is saved, to reflect any
changes in the file.

6 Navigating Source Code
The first line in the structure is the complete file path. When this is expanded,
the name of the class, super class (if any) and implementing interfaces are
shown. There is a collapsed node for Fields and another for Methods. These
can be expanded to reveal all the fields and methods. For methods parameters
and exceptions are displayed too.

Items are displayed in different colours depending on what they are. The
traffic light scheme has been used where green refers to all items that are
public, red are private and yellow are protected.

If the database is connected, clicking on an item will highlight where that item
occurs in the source, provided the source file is open. This feature does not
work if there is no database connection.

7 Deleting a File from the Browser
A popup menu is displayed when the browser is right clicked on. If the delete
button is pressed and the file path to be deleted is selected then the file is
removed from the browser.

8 Using the Popup Menu
The browser’s popup menu has an Open File button to open the selected file,
Delete File button to the delete the selected file and a Go To button to jump to
where the item occurs in the source provided the source is open and the
database is connected.

B.4 Inserting Code Templates and Constructs
The code palette is used to insert code templates and constructs into an editor. It is
present as a tab attached to the extreme left of the application. The palette can be
shown in a floating window by pressing the Pop button and can be docked back again
by using the Dock button.

Code has been categorised according to what it is e.g. loops, statements, comments
etc. Code can be inserted by clicking on the desired node in the tree, which is inserted
at the current caret position in the active file. Alternatively, code typed in the editor
can be highlighted and then an item selected from the tree. This way the highlighted
text is embedded within the code template.

74
Appendix B User Manual

B.5 Compiling and Executing Programs
1 Compiling Programs
Toolbar: Compile button
This compiles the current file using javac. An output frame displays the
errors during compiling. Click on the errors do jump to the problem in the
source code, provided the source file is open. The compile command can be
changed in the options dialog.

2 Running Programs
Toolbar: Run button
This compiles the current file using java. An output frame displays the results
of executing the program. The run command can be changed in the options
dialog.

3 Executing Custom Commands
Output Frame Menu>New Command
Enter your new command in the dialog box and press Enter. The command is
executed and results are displayed in the output frame. To run the same
command again, select it from the menu in the output frame.

4 Running Applets
Toolbar: Applet Viewer
This will ask you to enter the URL of the applet. The applet is displayed using
the applet viewer in a new window.

5 Generating Documentation
Toolbar: Javadoc button
This generates documentation for the current file using javadoc. An output
frame displays the results of executing the command.

B.6 Viewing Online API or Other Java Docs
Clicking on the View API button on the standard toolbar starts the API Viewer. A
new window appears, which displays the documentation. There is a drop down menu
for browsing packages and a list of classes on the left hand side of the window.
Clicking on any class in the list, displays its documentation in the window on the
right. To see the documentation for a specific class or interface, enter its name in the
search box below. Alternatively, to see the documentation for a set of classes (e.g. all
classes beginning with “XML”), enter a pattern in the search box using ‘*’ as the
wildcard character. This search box remembers previously entered strings.

To view documentation of a different source (such as your own project), go to
Edit>Options and change the API URL (e.g. to file: ~/project/docs/). Start the API
Viewer again and now you can browse other documentation.

75
Appendix B User Manual

B.7 Working with Text
Editing text takes place in the editor and is the same as other applications such as
Notepad. Common editing functionality is present in the Edit menu and on the
standard toolbar. They include:
• Cut (Ctrl-C), Copy (Ctrl-C), Paste (Ctrl-V), Select All (Ctrl-A)
• Undo (Ctrl-Z), Redo (Ctrl-Y)
• Find (Ctrl-F), Replace (Ctrl-H), Go To Line (Ctrl-G)]

The editor has line numbers along the left hand side of the window. It also highlights
syntax while you type.

The title bar of the editor contains the name of the file. If the file has unsaved
changes, the title will have the word “(modified)” appended to it. This disappears
when the file is saved.

Bracket Matching: Positioning the caret immediately before or after a bracket will
highlight the corresponding closing or opening bracket (assuming it is visible) and all
the text within it. In this way it is easier to the bounds of, say loops.

Formatting Text: The formatting toolbar contains buttons for changing the font face,
style and size and for aligning text.

The Popup Menu: The editor has an associated popup menu, which is invoked
whenever the right mouse button is clicked on the editor. The menu contains simple
text editing commands such as cut, copy and paste.

B.8 Setting Preferences
Select Edit>Options. An options dialog appears which contains information about
various commands and database configuration. After making any changed click
Apply. Your changes are saved and will be used from this point onwards. Reset sets
all the options back to their default values as set by the system vendor.

The following tags may be used when specifying options:
• <filepath> - e.g. ~/project/Program.java
• <dir> - e.g. ~/project/
• <classname> - e.g. Program

B.9 The Status Bar
The Status Bar displays messages to inform you of what the system is doing. It is
present at the bottom of the application and also has the time and date. The status of
any task and any errors are displayed here.

76
Appendix B User Manual

B.10 Managing Windows
Multiple files can be edited in separate editors, which are internal to the main
application. There is a virtual desktop that holds all the editors. The Window menu
has commands used for arranging all the editors, to avoid cluttering.

• Window>Cascade: overlaps windows
• Window>Tile Horizontal: arranges windows horizontally
• Window>Tile Vertical: arranges windows vertically
• Window>Minimise All: minimises all the windows
• Window>Restore All: restores all minimised windows
• Window>Close All: closes all windows

B.11Customising the GUI
The View menu contains buttons for adding and removing toolbars and the sidebar.
For example, if you do not wish to use the Formatting toolbar, uncheck the formatting
toolbar checkbox and the toolbar will disappear.

The Look and Feel menu allows you to change the look and feel of the application.
The default is the Metal Look and Feel. You can only select those that are supported
by the system. This means that UNIX machines will not allow you to set a Windows
look and feel. The Themes sub-menu allows you to change the colour coding of the
toolbars, buttons and menus. Themes will only take effect if the Metal Look and Feel
is selected.

77
Appendix C Test Results

Appendix C
Test Results
This document contains the actual results of the tests carried out in the Testing Phase
of the development process. In particular it contains the test results of the database
and parser. Other classes were tested using JUnit and all tests were successful. The
major part of the project is GUI based and hence there are no test results.

C.1 Dummy Files
A set of challenging dummy files was created in order to test the parser and database.

One of these is shown below:

public class Dummy extends Parent implements Imp1, Imp2, Imp3
{
private final int field1 ;
private String s1, s2, s3 ;

public Dummy(int f) throws Exception
{
field1 = f ;
}

public Dummy()
{
}

public synchronized void method()
{
}

protected String getName()
{
return s1 ;
}

public void setVars(int i, String s) throws SQLException
{
}
}

The source code above is challenging since it contains all the constructs of the java
language that we are interested in. It has a super class, interfaces, two kinds of field
declarations, two constructors and methods with parameters and exceptions.

78
Appendix C Test Results

C.2 Results of Testing the Parser
The parser was able to extract all of the important information from the file above:

Class: Dummy
Super class: Parent
Implementing Interfaces: <Imp1, Imp2, Imp3>
Class Modifiers: <public>

Fields:
field1, int, <private, final>
s1, String, <private>
s2, String, <private>
s3, String, <private>

Methods:
method, void, <public, synchronized>
getName, String, <protected>
setVars, void, <public>, <i:int, s:String>,<SQLException>

Constructors:
<public><f:int><Exception>
<public>

Parsing successful.

C.3 Results of Testing the Database
Dummy files were sent to the parser, which added information to the database. The
file above gave the following results:

+--------+----------+
| TypeID | TypeName |
+--------+----------+
| 1 | boolean |
| 2 | char |
| 3 | byte |
| 4 | short |
| 5 | int |
| 6 | long |
| 7 | double |
| 8 | float |
| 9 | Dummy |
| 10 | Parent |
| 11 | Imp1 |
| 12 | Imp2 |
| 13 | Imp3 |
| 14 | String |
| 15 | void |
+--------+----------+
+---------+----------------+-----------+
| ClassID | ExtendsClassID | Location |
+---------+----------------+-----------+
| 9 | 10 | 2,14,2,18 |
+---------+----------------+-----------+

79
Appendix C Test Results

+--------+---------------------------------+
| TypeID | Filepath |
+--------+---------------------------------+
| 9 | ~/jide/src/app/tests/Dummy.java |
+--------+---------------------------------+
+---------+-------------+
| ClassID | InterfaceID |
+---------+-------------+
| 9 | 11 |
| 9 | 12 |
| 9 | 13 |
+---------+-------------+
+--------+------------+----------+
| TypeID | ModifierID | Location |
+--------+------------+----------+
| 9 | 6 | 2,1,2,6 |
+--------+------------+----------+
+-------------+-----------+
| InterfaceID | Location |
+-------------+-----------+
| 11 | 2,46,2,49 |
| 12 | 2,52,2,55 |
| 13 | 2,58,2,61 |
+-------------+-----------+
+---------+-----------+--------+---------+-----------+
| FieldID | FieldName | TypeID | ClassID | Location |
+---------+-----------+--------+---------+-----------+
| 1 | field1 | 5 | 9 | 4,17,4,22 |
| 2 | s1 | 14 | 9 | 5,20,5,21 |
| 3 | s2 | 14 | 9 | 5,24,5,25 |
| 4 | s3 | 14 | 9 | 5,28,5,29 |
+---------+-----------+--------+---------+-----------+
+---------+------------+----------+
| FieldID | ModifierID | Location |
+---------+------------+----------+
| 1 | 4 | 4,5,4,11 |
| 2 | 4 | 5,5,5,11 |
| 3 | 4 | 5,5,5,11 |
| 4 | 4 | 5,5,5,11 |
+---------+------------+----------+
+------------+--------------------+
| FunctionID | ClassOrInterfaceID |
+------------+--------------------+
| 1 | 9 |
| 2 | 9 |
| 3 | 9 |
| 4 | 9 |
| 5 | 9 |
+------------+--------------------+
+----------+------------+--------------+-------------+
| MethodID | MethodName | ReturnTypeID | Location |
+----------+------------+--------------+-------------+
| 3 | method | 15 | 16,30,16,35 |
| 4 | getName | 14 | 20,22,20,28 |
| 5 | setVars | 15 | 25,17,25,23 |
+----------+------------+--------------+-------------+

80
Appendix C Test Results

+------------+------------+-------------+
| FunctionID | ModifierID | Location |
+------------+------------+-------------+
| 1 | 6 | 7,5,7,10 |
| 2 | 6 | 12,5,12,10 |
| 3 | 6 | 16,5,16,10 |
| 3 | 9 | 16,12,16,23 |
| 4 | 5 | 20,5,20,13 |
| 5 | 6 | 25,5,25,10 |
+------------+------------+-------------+
+------------+---------------+-------------+
| FunctionID | ExceptionName | Location |
+------------+---------------+-------------+
| 1 | Exception | 7,32,7,40 |
| 5 | SQLException | 25,56,25,67 |
+------------+---------------+-------------+
+------------+-----------+-------------+-------------+
| FunctionID | ParamName | ParamTypeID | Location |
+------------+-----------+-------------+-------------+
| 1 | f | 5 | 7,22,7,22 |
| 5 | i | 5 | 25,29,25,29 |
| 5 | j | 5 | 25,36,25,36 |
| 5 | s | 14 | 25,46,25,46 |
+------------+-----------+-------------+-------------+
+---------------+-------------+
| ConstructorID | Location |
+---------------+-------------+
| 1 | 7,12,7,16 |
| 2 | 12,12,12,16 |
+---------------+-------------+

From the results above the file was successfully added to the database. The file was
then altered and the results inspected again. Finally another file was added to the
database. The database passed all tests. It was also tested using the Search Dialog in
the interface.

81
Appendix D Code Listing

Appendix D
Code Listing
The application consists of a total of:

• 8 packages

• 77 classes and interfaces

• 22588 lines of code (approximately)

Only the code for the named classes below is in this document. These classes were
chosen because they deal with interesting and important aspects of the system such as
the database and parser.

• DBStatement.java

• DBInserter.java

• DBExtracter.java

• DBManager.java

• ParserManager.java

• OutputFrame.java

82
Appendix E Project Plan

Appendix E
Project Plan
This document was drafted in early November in collaboration with the project
supervisor.

It includes the:

• Aims and objectives of the project.

• Expected outcomes and deliverables

• Work plan – a pert chart showing how the workload was structured over the
project period (October – April)

95
Appendix F Interim Report

Appendix F
Interim Report
This document was outlined in January in collaboration with the project supervisor.

It revisits the project's aims and objectives and describes the:

• Work accomplished to date

• Main goals towards project completion

100
Appendix F Interim Report

Name: Fahd Shariff

Project Title: Integrated Development Environment for
Java

Supervisor: Graham Knight

Work Accomplished to Date
The work that I have done so far can be categorised (in chronological order) as
follows:

1. Research: I spent the first month heavily researching programming environments
such as JBuilder and MS Visual Basic. In my quest to find unique features for the
project, I wrote to a number of newsgroups and even participated in web chats
with fellow programmers. As a result, I found out what tools could be really
useful for programmers. I also came across a great concept known as “Source
Code In Database (SCID)”; programs are parsed and useful information stored in
a database. This makes handling large projects very easy and is the basis for my
project.

Finally, I drafted the “Requirements Specification Document”.

2. Design: I analysed the requirements document to identify potential packages,
classes, associations between classes etc. I also designed the database. It was then
time to hand in the November Project Plan.

3. Implementation: To date, the vast majority of work has been done in
implementing the system.

 Parser & Database: I used the java-compiler-compiler (javacc) to
generate a parser for java source code. I successfully set up a database
using mySQL, which is populated with data by the parser.

 Java Editor: I developed an editor with word processing tools (font
manipulation, printing, find and replace etc). I added automatic syntax
highlighting, auto-indentation and line numbering.

 Java Commands: Users can invoke the system compiler, appletviewer
and Java Runtime. They can click on a compiler error to go to the error in
their code.

 Code Tools: Code writing by point-and-click.

101
Appendix F Interim Report

Main Goals towards Project Completion
The work that remains to be done can be categorised (in chronological order) as
follows:

1. Continuation of Implementation:

 Code Browser: A navigation tool that “describes” java code. It allows
easy navigation through the fields and methods of a class.

 Documentation: A Java API Viewer that helps users quickly find the
documentation of the classes they are looking for. The system will also
allow automatic insertion of documentation.

 Wizards: The “New” wizard to generate code for classes given methods
and fields. The “Unit Test” wizard to generate code for JUnit test Classes.

2. Testing: Debugging and usability testing.

3. Final Report: Compilation of the final report will be carried out during the
beginning of March.

Supervisor’s Signature:

102
Appendix G Bibliography

Appendix G
Bibliography
References cited in the text:

[1] Sun Microsystems, Sun ONE Studio (formerly Forte Tools)
http://www.sun.com/software/sundev/

[2] Microsoft, Visual J++ Information
http://msdn.microsoft.com/vjsharp/productinfo/visualj/

[3] Borland, JBuilder
http://www.borland.com/jbuilder/

[4] T. Parr, The ANTLR Translator Generator
http://www.antlr.org/

[5] The Sable Researcher’s Group, SableCC
http://www.sablecc.org/

[6] Java Compiler Compiler, The Java Parser Generator
http://www.experimentalstuff.com/Technologies/JavaCC/

[7] Build your own Languages with JavaCC
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-cooltools.html

[8] Swing, Second Edition
Matthew Robinson, Pavel Vorobiev, Pavel A. Vorobiev, David Karr

[9] Roedy Green, Source Code In Database (SCID)
http://www.mindprod.com/scid.html

[10] MySQL, The World’s Most Popular Open Source Database
http://www.mysql.com/

[11] MySQL Database Driver Classes
http://www.cs.ucl.ac.uk/staff/m.pias/project/alanImpl/implem/org/

[12] Sun Microsystems, Why Java?
http://www.sun.com/software/java/why.html

[13] Java Optimization
http://www-2.cs.cmu.edu/~jch/java/optimization.html

103
Appendix G Bibliography

[14] The Unified Software Development Process
I. Jacobson, G. Booch, J. Rumbaugh, Addison-Wesley 1999

[15] JavaCC Grammar Repository
http://www.cobase.cs.ucla.edu/pub/javacc/

[16] Sun Microsystems, Working with XML
http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/TOC.html

[17] User Interface Design
http://www.cs.brown.edu/courses/cs032/resources/book/chap11.html

[18] Jeff Raskin, Intuitive Equals Familiar
http://www.asktog.com/papers/raskinintuit.html

[19] Maximising Windows
http://www.asktog.com/columns/000maxscrns.html

[20] David K Every, Databases 101
http://www.igeek.com/articles/Software/Databases101.txt

[21] Whatever Happened to Object-Oriented Databases?
Neal Leavitt, IEEE Computer, August 2000

[22] Sun Microsystems, JavaTM 2 Platform Std. Ed. v1.4.1
http://www.cs.ucl.ac.uk/teaching/java/javadoc/api/index.html

[23] Sun Microsystems, XML and DOM
http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/dom/

[24] Sun Microsystems, SDK 1.2 Printing API: A Tutorial
http://java.sun.com/products/java-media/2D/forDevelopers/sdk12print.html

[25] E. G. Kent Beck, Junit Open-Source Testing Framework
http://www.junit.org

[26] Refactoring – Improving the Design of Existing Code
M. Fowler, Addison Wesley 1999

Other Resources:

• Aubjex, an IDE that transforms Java code into an especially efficient and
complete database form.
http://www.alajava.com/aubjex/index.htm

• Object Oriented Databases and Their Applications to Software Engineering
Alan W. Brown

• Human Computer Interaction
Alan J. Dix, et al

104
Appendix G Bibliography

• Patterns in Java, Volume 2
Mark Grand

• Java Threads, Second Edition
Scott Oaks, Henry Wong
O’Reilly

• The JFC Swing Tutorial: A Guide to Constructing GUIs
Kathy Walrath, Mary Campione

• Java XBrowser
http://www.xbrowser.sourceforge.net/

• Google Java Groups
http://www.groups.google.com/groups?group=comp.lang.java

105
Appendix H Table of Figures

Appendix H
Table of Figures
Design Models
Figure 1 – Use Case Diagram .................................................................................. 14
Figure 2 – Basic System Model ............................................................................... 19
Figure 3 – Package Dependencies............................................................................ 24
Figure 4 – Database Class Diagram ......................................................................... 25
Figure 5 – Parser Class Diagram.............................................................................. 26
Figure 6 - Open File Activity Diagram .................................................................... 27
Figure 7 - Save File Activity Diagram ..................................................................... 28
Figure 8 - Search Database Activity Diagram .......................................................... 29
Figure 9 – Initial GUI Design .................................................................................. 30
Figure 10 - Data Flow Diagram ............................................................................... 33
Figure 11 - Entity Relation Diagram ........................................................................ 34
Figure 12 - System Package Hierarchy .................................................................... 36

Screenshots
Figure 13 - Database Search Dialog ......................................................................... 43
Figure 14 - Database Search Results ........................................................................ 44
Figure 15 - Add/Remove File(s) Dialog ................................................................... 44
Figure 16- Ouput Window....................................................................................... 46
Figure 17 - API Viewer ........................................................................................... 47
Figure 18 - Code Palette .......................................................................................... 48
Figure 19 – Class Browser....................................................................................... 49
Figure 20 – File Explorer......................................................................................... 50
Figure 21 – Java Editor............................................................................................ 52
Figure 22 – Options Dialog...................................................................................... 53

106
Appendix I Glossary

Appendix I
G l o s s a ry
This appendix provides short definitions of the jargon terms used throughout the
report.

Accelerator A keystroke combination (usually a modifier key and a
character key, like Control-C) that activates a menu item from
the keyboard.
API Viewer A tool used to view online java documentation and api.
Auto indentation Automatically indenting code when the enter button is
pressed.
Class Browser A tree representation of source code indicating class
information such as fields and methods and their accessibility.
Used for navigating through source code.
Code Palette A tree representation of code that can be inserted into the
document.
DBMS (Database Management System) A complex set of programs
that control the organization, storage and retrieval of data.
Dockable Items that can be added or removed
Driver Software that forms a bridge between the server hosting the
database and the client running the application.
Dummy file A file used for testing the parser and database.
Editor The text area on which the code is actually written.
File Explorer A tree representation of the file system.
Flat Database Stores data in one big table.
Formatting A toolbar used to change the way text looks.
Toolbar
Grammar A set of rules that define the structure of a language.
GUI (Graphical User Interface) An interface that has windows,
buttons and menus used to carry out tasks.
IDE (Integrated Development Environment) A collection of tools
that allow you to do many common programming tasks with a
common interface.
JavaCC A parser generator library for Java
JDBC (Java Database Connectivity) Connectivity between the Java
platform and a wide range of databases.
JUnit A framework to write automated repeatable tests.
Line indicator A list of line numbers found on the side of the editor.
Look and Feel Describes the appearance and behaviour of a complete set of
GUI components.

107
Appendix I Glossary

Mnemonic Shows the user which key to press (in conjunction with the
Alt key) to activate a command.
Modifier Keywords used to modify code e.g. public, private, static etc.
Multithreading Carrying out more than one task at a time.
MySQL A true multi-user, multi-threaded SQL (Structured Query
Language) database server.
Object Oriented Allows structured sub objects; each object has its own
Database identity, or object-id (as opposed to a purely value-oriented
approach).
Options User preferences.
Output Window The text area which displays the results of executing java
commands such as javac and java. Compiler errors are linked
to the source code.
Parentheses Positioning the caret immediately before or after a bracket
Matching will highlight the corresponding closing or opening bracket
(assuming it is visible) and all the text within it.
Parse To analyse a sentence in order to extract tokens corresponding
to syntax .
Parser A tool used for parsing programs.
Parser Generator A program which, given a formal description of a language,
can generate a parser. E.g. JavaCC.
Platform Code that once written, can be run anywhere.
Independent
Popup menu A menu displayed when the right mouse button is clicked.
Pretty Printer A module responsible for saving files as colourful web pages
in HTML format.
Print Preview A feature that shows how the document will look when
printed.
Refactoring An operation which modifies code to improve its design
without affecting the meaning of the program.
Relational Stores data in many tables that relate to each other.
Database
SCID (Source Code in Database) The process of storing source code
in a database instead of files to aid searching and navigating.
Semantic error An error in the meaning of the statements in the program.
Shared action An action used by more than one class e.g. toolbars and
menus.
SQL (Structured Query Language) A language used to create,
maintain, and query relational databases.
Standard Toolbar A toolbar used for common operations such as file handling
and java operations.
Status Bar A panel on the bottom of the main window which displays
messages to inform the user of what the system is doing.
Syntax error An error in the use of the rules of language.
Syntax Colouring text according to syntax
Highlighting

108
Appendix I Glossary

Highlighting
Theme A feature that enables the user to specify alternative colours
and fonts across the entire application.
Toolbar A vertical or horizontal bar containing icons that represent the
commands that can be used in an application.
Type A class or interface.
UML Creating UML representations of projects.
Visualisation
Unit Test Test of one part of the system to see if remediation efforts
were successful.
URL (Uniform Resource Locator) An Internet address which tells a
browser where to find an Internet resource.
Virtual Desktop A feature allowing multiple windows to be opened within the
application to prevent cluttering up the operating system's
desktop.
Wildcard A character that can represent any group of characters e.g. '*'.
Window Arranging windows in the virtual desktop. They can be
Management arranged in a number of ways including vertically and
horizontally.
XML (Extensible Mark-up language) A way of storing data in files.
Used by the code palette.
XML DOM An XML parser.
Parser

109