A Netbeans IDE Plug-in for Creating Configuration Files

adorableautomaticΛογισμικό & κατασκευή λογ/κού

15 Αυγ 2012 (πριν από 5 χρόνια και 3 μήνες)

774 εμφανίσεις

Masaryk University
Faculty of Informatics

A Netbeans IDE Plug-in for Editing
Conguration Files
Bachelor's Thesis
Stefan Rakonjac
Brno,May 2011
Declaration
Hereby I assure that I wrote independently this present bachelor thesis.I have not used
any sources or literature without declaration in the text.
In Brno,May 23,2011
Stefan Rakonjac
........................................
Advisor:RNDr.Vlastislav Dohnal,Ph.D.
i
Acknowledgement
I would like to thank here my advisor|RNDr.Vlastislav Dohnal,Ph.D.for all the time
spent on helping me,for the patience and valuable comments on everything starting with
writing of the plug-in and ending with the written part of my thesis.
ii
Abstract
This thesis deals with the architecture of the NetBeans platform.It studies in more
detail modules such as its basic elements as well as the problem of their creation,usage
and application.In particular,it focuses on one specic module that makes the editing
of conguration les for the MESSIF library easier.This module uses techniques such as
accessing external libraries and their classes using Java's Re ection API in order to collect
information about these libraries.The module oers the automatic completion of words
or sets of words according to the syntax of the conguration le and the information it
acquires analyzing a specic MESSIF library's class.It also makes the writing of new rules
easier,with the automatic completion of rules'starts based on the content of previously
entered lines in the edited conguration le.When the user provides some input,the
module controls its format according to the rules the conguration le's syntax is based
on.
iii
Keywords
NetBeans,plug-in,MESSIF,conguration le,modular architecture,code completion,
syntax highlighting,Java re ection,experiment setting
iv
Contents
1 Introduction 3
2 The NetBeans Platform 5
2.1 History......................................5
2.2 Architecture of the NetBeans Platform.....................6
2.3 Applications Developed in the NetBeans Platform..............7
3 NetBeans IDE 8
3.1 Architecture of IDE...............................8
3.2 Basic NetBeans IDE Distributions.......................9
3.3 Extending the Functionality of IDE.......................10
3.4 Integrating Google Search Form into IDE...................10
3.4.1 Creating the Action...........................10
3.4.2 Creating the Toolbar...........................12
3.4.3 Exporting the Module..........................13
3.5 Editor Code Completion API..........................14
4 Module for the MESSIF Library 15
4.1 The MESSIF Library,the CoreApplication Class and Conguration Files 16
4.2 Completion Rules for MESSIF Conguration Files..............17
4.3 Setting up the Project..............................18
4.4 Implementation of Interfaces..........................19
4.4.1 Class CfCompletionProvider......................19
4.4.2 Class CfCompletionItem........................22
4.4.3 Class CfCompletionDocumentation..................22
4.4.4 Class CfItemsProvider.........................23
4.5 Registring Code Completer with text/x-ini MIME-Type..........28
5 Conclusion 30
Bibliography 31
1
A User Manual 33
A.1 Distribution....................................33
A.2 Adding the Module................................33
A.2.1 Installing the Module..........................33
A.2.2 Setting up the MIME-Type.......................33
B CD Contents 35
2
Chapter 1
Introduction
The modular design of applications was introduced as a solution to problems many pro-
gramdevelopers came across:the increasing complexity of projects and a lack of eciency
in their further development.In many situations in which a program had to be changed,
changes did not only introduce greater complexity,but also generated unwanted\chaos"
inside the program's code.This happened in particular when the changes were made by
people who did not originally work on the development of the program and who did not
have sucient knowledge about its architecture.
Developing a program consisting of modular blocks (plug-ins,modules) as the smallest
parts of its infrastructure { blocks having precisely-dened access points (i.e.publicly-
exposed interfaces) as well as an exact purpose { makes the work easier.The mentioned
chaos can now exist only inside the module's boundaries and therefore it is much easier
to overcome.
Object-oriented programming techniques include features like data abstraction,encap-
sulation,inheritance,polymorphism,and modularity and these features have been used as
the basis for creating a unique framework { The NetBeans Platform{ in which Java Swing
desktop applications having modular design can be easily developed.
The NetBeans platform oers a good generic framework for developing these appli-
cations.Its core consists of a Runtime Container,on top of which is based every new
rich-client application developed in this framework.Since the framework is written in
Java,it is designed to inherit all the features of object-oriented programming that Java
oers.And as mentioned before,one of them is modularity.
The plug-in this Bachelors Thesis deals with should allow the more ecient creation
and editing of conguration les used by the MESSIF library.The library's name stands
for Metric Similarity Search Implementation Framework.The MESSIF library is free soft-
ware;it's the result of a research project started at the Faculty of Informatics at Masaryk
University in Brno,Czech Republic.The goal of the authors of this project is to develop
a framework which would provide basic support for indexing based on metric space [1].
Conguration les are used for evaluation of the search system's algorithms'eciency.
They have a predened structure which allows the deriving of rules used for automatic
completion.
3
The thesis consists of 5 chapters.Chapter 2 deals with the architecture of the Net-
Beans platform in more detail.Chapter 3 discusses the extensibility of the Netbeans IDE
(Integrated Development Environment) using standard and user-made modules.Chapter
4 concentrates on the specic plug-in for the NetBeans IDE that is used when working
with the MESSIF library.The conclusion is outlined in Chapter 5.
4
Chapter 2
The NetBeans Platform
2.1 History
In 1996,a group of students from the Faculty of Mathematics and Physics at Charles
University in Prague,Czech Republic started working on a project named Xel with the
goal of creating the rst IDE for Java written in Java.At the very beginning,the project
attracted enough interest for its authors,once they had graduated,to decide to market
their software as a commercial product while continuing work on its development.In 1997,
they were contacted by Roman Stank,an entrepreneur who had already been involved in
several startups in the Czech Republic and who was looking for a good idea to invest in.
A company was formed around the project shortly after.
Jaroslav Tulach,the author of IDE's basic architecture and the only founder still
working on the project,came up with the name NetBeans for the platform,which was to
represent the basic concept of this software,since the business plan made with R.Stank
was to develop network-enabled JavaBeans components (therefore,NetBeans stands for
network JavaBeans).
In March 1999,NetBeans DeveloperX2 was released.Shortly after that,in the Fall
of 1999,JDK (Java Development Kit) 1.3 was also released and its performance improve-
ments positioned NetBeans on the market as a viable choice for development tools.During
the Summer of 1999,the team re-architectured DeveloperX2 into the more modular Net-
Beans,which forms the basis of the software today.
At the Java One presentation in 1998,Jonathan Schwartz (currently the CEO of Sun
Microsystems) became interested in the project and in the Fall of 1999 Sun acquired Net-
Beans a.s.NetBeans had become the agship tool set of the maker of Java,which was
a dream come true for its founders.Less than six months later,Sun decided to make
NetBeans their rst sponsored open sourced project.
This decision had an important in uence on the direction of NetBeans'further de-
velopment.Many programmers started stripping out components of the NetBeans IDE
so that they could combine its core (Runtime Container) with their own plug-ins while
building new applications.These actions led to the creation of a platform that could be
used for building generic desktop applications suitable for any purpose.
5
During the year 2000 and 2001 a great deal of work went into this task and the result
was the NetBeans platform derived from the NetBeans IDE.This also encouraged Sun's
developers to make a cleaner API design and a separation of concerns.
2.2 Architecture of the NetBeans Platform
In the client-server model,rich-client application term is used when raw data is sent from
the server's side and processed by an application on the client's side.Besides data pro-
cessing,rich-client application should also provide GUI (Graphical User Interface) for the
user.
Modularization becomes more important as an application's complexity increases.
Modular design of an application brings certain benets over the old and trusted pro-
gramming methodologies.Some of these benets are:
 shortened development time,
 consistency of user interface,
 simplied actualization,
 platform-independence,and
 possibility of reusing the code.
The NetBeans platform is a modular-designed framework for creating rich-client applica-
tions.Its core consists of Runtime Container providing basic functionality and services
on top of which new applications are built.Runtime Container can be understood as
an execution environment for the modules that dene a NetBeans Platform application.
These ve modules build the container:
 Bootstrap { This module is activated before all other modules.It calls all registered
command line handlers and prepares boot classloader,which initializes the Startup
module.
 Startup { Provides the main method of an application,starts the application,ini-
tializes Module System API and File System API.
 Module System API { This module is responsible for managment of other modules,
their congurations and lifecycles as well as dependencies between them.
 File System API { Provides platform-indipendent access to virtual lesystem.
 Utilities API { Includes many utility classes,for example the Lookup class,which is
used for communication between modules.
All the other modules of an application,as well as these ve,need to have certain charac-
teristics to provide the desired advantages promised by modular application development.
6
It should be possible to make all resources required by a module available via a single
deployment package.For this purpose NetBeans uses specic NBM archive,which is
similar to the standard JARarchive for Java packages.Amodule should also have a unique
identity;it must be able to specify its version (both specication and implementation);it
must declare which,if any,of the other modules in the application are required for it to
function;and it needs to have a publicly exposed interface,via which module features can
be accessed [2].
2.3 Applications Developed in the NetBeans Platform
To demonstrate the full possibilities of the NetBeans platform,several interesting examples
of applications developed on top of this framework are presented in this section.NetBeans
IDE is one of them and more information on it will be provided in the following chapter.
Northrop Grumman Agile Client
Agile Client is a NetBeans Platform application developed by
Northrop Grumman in partnership with the US Defense Infor-
mation System Agency.It brings the war ghter a 3-D common
operational picture (COP) workstation designed for greater ef-
ciency and mission eectiveness [3].
Boeing Mass Properties Toolkit
The MassTk is an engineering analysis application by Boeing.
It incorporates the functionality from several legacy mass prop-
erties analysis applications that were originally written in Java,
Fortran,C,and even Perl.
MassTk is built on top of the NetBeans Platform.It provides a
rich GUI with custom editors for all business objects including
2D & 3D visualization [4].
Vinland Software Suite
Vinland,by Eriksord,is an application in the oil & gas explo-
ration business.Its mission is to make the daily life of geosci-
entists easier and to avoid forcing them to become spreadsheet
addicts,since typically that's what they need to be.The decision
to use the NetBeans Platform in this case was a combination of
its OS independence,its 100% Java content,and the fact that
it is fully Swing based [5].
7
Chapter 3
NetBeans IDE
3.1 Architecture of IDE
NetBeans IDE,like the NetBeans platform,is an open-source and free software that runs
on today's standard operating systems.As mentioned before,NetBeans IDE is set on top
of the NetBeans platform and its inner organization can be represented by the following
schema [6]:
Java
Ruby
Mobility
Web/JEE
C/C++
UML
SOA
Java Editor
Form Editor
Java Refactoring
...
Ruby Projects
...
CLDC Platform
...
Web Projects
...
...
...
...
Base IDE
Editor
Highlighting
Navigator API
Refactoring API
CVS
...
...
NetBeans Platform
Data System API
Nodes API
Explorer API
Window System API
...
...
Runtime Container
There are three functional layers on top of the JDK (Java Development Kit).The Net-
Beans platform is positioned on the lowest level which oers a modular infrastructure and
reusable components.The middle layer or the Base IDE provides the parts that are spe-
cic to NetBeans IDE.On the highest layer,external complements can extend NetBeans
IDE by means of plug-ins,because the modules on the lower layers expose APIs enabling
them to be extended thanks to the NetBeans platform's modular architecture [7].
8
IDE's current version is 7.0 and it is mostly aligned with the newest JDK 1.7.It
supports the development of all Java application types:Java SE including Java ME,web
applets,EJB and mobile applications.However,it can also be used when developing PHP
or C++ applications.All the functions of the IDE are provided by modules.Among
others,these are part of standard IDE distributions:
 NetBeans Proler { This module is a useful tool for monitoring the behavior of
Java applications.For example,it is used by developers to nd memory leaks or to
optimize speed,
 GUI design tool { This GUI builder was formerly known as project Matisse.It allows
developers to prototype and design Swing graphical user interfaces by dragging and
positioning GUI components,and
 NetBeans JavaScript editor { This module provides extended support for Ajax,CSS
and JavaScript.The editor features code completion,syntax highlighting,refac-
toring,the generation of class skeletons,the generation of Ajax callbacks from a
template and others.
Code editor features such as automatic completion,syntax highlighting and le documen-
tation,which are specic for conguration les used by the MESSIF library,will be the
subject of the Chapter 4.
3.2 Basic NetBeans IDE Distributions
Starting from version 7.0,these ve diferent bundles of IDE can be downloaded from the
NetBeans IDE website [8]:
 Java SE (Standard Edition) Bundle { Bundle containing NetBeans Platform SDK
and Java SE packages.
 Java EE (Enterprise Edition) Bundle { This bundle extends the basic Java SE Bundle
by also including Java EE packages as well as two services:GlassFish Server and
Apache Tomcat.
 C/C++ Bundle { Bundle containing packages for developing C/C++ applications.
 PHP Bundle { Bundle containing packages for developing PHP applications.
 Complete Bundle { This bundle contains all previously mentioned packages.
The previous stable version of IDE (version 6.9.1) can also be downloaded from the dis-
tribution website.In this version,two additional bundles are available:Java Bundle
(containing Java Web and ME technologies in addition to Java EE Bundle as well as
Groovy package) and Ruby Bundle (containing packages for developing Ruby applications
and GlassFish Server).
Having downloaded any distribution of the NetBeans IDE,one can later add or re-
move packages using the IDE's Plugin manager.Therefore,the user is provided with the
possibility of customizing IDE so that it meets his demands.
9
3.3 Extending the Functionality of IDE
NetBeans IDE's functionality can be extended by adding new plug-ins.Plugin man-
ager (Tools  Plugins) allows adding modules in two dierent ways:a module can be
downloaded directly from a trusted vendor's website usnig IDE's interface (list of trusted
vendors can be edited in this manager) and to make this process more simplied,the
Plugin manager oers search function over a database of modules;or it can be added to
IDE by selecting its distribution package from the lesystem.
The user can also modify IDE so that it ts his needs by creating new plug-ins sutable
to his demands.To do so,the user should rst get familiar with what the NetBeans
platform oers and probably the best way to start understanding this platform and its
possibilities is to analyze in more details an example on how to create a functional plug-in.
Few examples can be found online [9] and one of themis presented in the following section.
3.4 Integrating Google Search Form into IDE
An example of how to integrate the Google search form into IDE is presented in this sec-
tion.This example is taken from already existing tutorial which can be found on-line [10].
NetBeans IDE oers a wide variety of wizzards that provide the user with help when
creating,editing,refactoring,etc.The New Project wizzard oers assistance when start-
ing new project (to start it,select File  New Project or press the <Ctrl-Shift-N>
key-combination).To create a new plug-in for the NetBeans platform,one should select
NetBeans Module in the Category list and Module in Projects list and then,in the follow-
ing two steps insert\GoogleToolbar"as Project Name and\org.myorg.googletoolbar"
as Code Name Base.The Standalone Module option should be left marked.
Having nished these steps,wizzard should create a new project with all the necessary
sources and metadata,souch as the project's Ant build script or Module Manifest le
describing the module.In order to code the Google search module,the following tasks
need to be complited:
 Creating the Action
 Creating the Toolbar
3.4.1 Creating the Action
To make the Google search toolbar plug-in functional,two classes need to be developed.
The rst one,which will be dened in a le named GoogleAction.java,can be created
using the New Action wizzard.This wizzard collects the information fromthe user in order
to generate the le and the class'code in it.The following steps need to be completed in
order to create this class:
 The wizzard should be started by making a right-click on the project node in the
Project window and selecting the New  Action wizzard;
 In the Action Type step,the Always enabled options should be left marked;
10
 In the GUI Registration step,File should be selected in the Category drop-down
list,the Global Menu Item option should be deselected and the Global Toolbar
Button option should be selected.In the Toolbar drop-down list,File shoud be
selected and in the Position drop-down list,toolbar button's position within the
toolbar should be selected;
 In the Name,Icon and Location step,\GoogleAction"text should be set as the
Class Name and\Google Action"text as the Display Name.
Having nished these steps,a new le with the following code in it is automatically gen-
erated:
1 package org.myorg.googletoolbar;
2
3 import java.awt.event.ActionEvent;
4 import java.awt.event.ActionListener;
5 import org.openide.awt.ActionRegistration;
6 import org.openide.awt.ActionReference;
7 import org.openide.awt.ActionReferences;
8 import org.openide.awt.ActionID;
9 import org.openide.util.NbBundle.Messages;
10
11 @ActionID(category ="File",
12 id ="org.myorg.googletoolbar.GoogleAction")
13 @ActionRegistration(displayName ="(irrelevant)")
14 @ActionReferences(f
15 @ActionReference(path ="Toolbars/File",position = 0)
16 g)
17 @Messages("CTL
GoogleAction=Google Action")
18 public final class GoogleAction implements ActionListener f
19
20 public void actionPerformed(ActionEvent e) f
21//TODO implement action body
22 g
23 g
This class can be also created manually { the user should right-click on the package node
representing the org.myorg.googletoolbar package in the Projects window and choose
New  Java class.In that case,the code generated by the New Action wizzard also
needs to be typed in manually.
When builiding the module,the class annotations that can be seen above will be con-
verted to XML tags in a le that will be contributed to the virtual lesystem of the
application.The XML le will be named generated-layer.xml and will be found in the
buildnclassesnMETA-INF folder of the module.
11
3.4.2 Creating the Toolbar
JPanel that will be the toolbar that will be displayed in the application's main toolbar is
created in this section.To create a new JPanel,the user should right-click on the project
node and choose New  Other.
The Swing GUI Form should be selected under Categories and the JPanel Form un-
der Projects.In the Name and Location panel,\GooglePanel"text should be set as
Class Name and the right package should be selected from the drop-down list.By clicking
Finish,the GooglePanel.java le is added to the package and is opened in the Design
view.
By simple dragging and dropping of elements in the Design view,newly created JPanel
should be brought to the following state:
What follows is creating the actionPerformed method for the text eld in the toolbar.
This is achieved by making a right-click on the JTextField and choosing Event  Action
 actionPerformed which will generate jTextField1ActionPerformed() method in the
source code of GooglePanel.java.This method should be implemented in the following
way:
20 private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) f
21 try f
22 String searchText = URLEncoder.encode(jTextField1.getText(),"UTF-8");
23 URLDisplayer.getDefault().showURL
24 (new URL("http://www.google.com/search?hl=en&q="
24  + searchText +"&btnG=Google+Search"));
25 g catch (Exception eee)f
26 return;//nothing much to do
27 g
28 g
The Source Editor indicates that some problems exist,but this can be easily solved by
xing the imports.To x the imports user should press the <Alt+Shift+F> combination
of keys.
The created JPanel is the component that will render the toolbar.To display this
componen in the toolbar,Presenter.Toolbar needs to be implemented.To do so,
GoogleAction.java should be opened and its signature should be changed so that it
implements Presenter.Toolbar.
12
The nal denition of the GoogleAction class is:
18 public final class GoogleAction extends AbstractAction
19  implements Presenter.Toolbar f
20 @Override
21 public Component getToolbarPresenter() f
22 return new GooglePanel();
23 g
24 public void actionPerformed(ActionEvent e) f
25//not needed,because the GooglePanel handles the action
26 g
27 g
By pressing the <F6> key,the module is built and installed in a new instance of the
IDE (i.e.,the target platform).By default,the default target platform is the version of
the IDE in which is currently being worked.
The newly-developed module looks like this:
3.4.3 Exporting the Module
Having built a working module that enhances the IDE,one can export a binary NetBeans
Module le (.nbm),so the others can add it to their IDEs or even continue working on
its development.To export the binary le of developed module,one should right-click on
the project node in the Projects window and then choose Create NBM.A new binary le
is created and saved in the user's lesystem,as it can be seen in the Files window.
How to add a module distributed as a NBM le to the NetBeans IDE is described in
Appendix A,subsection A.2.1.
13
3.5 Editor Code Completion API
NetBeans IDE provides a wide variaty of APIs (Application Programming Interfaces).
Complete list can be found on-line [11].All of the APIs can be sorted into three groups:
 APIs that are part of the NetBeans platform,for example lookup,loaders,utilities,
nodes,explorer,etc.
 APIs that are specic for NetBeans IDE,like projects,javacore,di,etc.
 APIs that are not included in the release at all and are just provided for download.
Module that will provide code competion when creating or editing conguration les for
the MESSIF library implements Editor Code Completion API,which is a standard API
of every NetBeans IDE distribution.
Java Code Completion module that comes with IDE provides Code Completion API
with a simple API for showing and hiding of the competion window and with SPI (Ser-
vice Provider Interface) dening the completion providers and the implementation.SPI
provides completion content by independent providers [12].
To provide basic functionality of the Code Competlion API two interfaces need to be
implemented:
 CompletionProvider,and
 CompletionItem
both located in the org.netbeans.spi.editor.completion package.Another interface
can be implemented if the module should also provide documentation for created items
oered in the completion popup window.This is the CompletionDocumentation inter-
face,located in the same package.
14
Chapter 4
Module for the MESSIF Library
This chapter will focus on solving the problem of writing a module that will help with the
creation of conguration les for the MESSIF library.The module should handle:
 writing of the preamble;
 automatic completion of the names of the CoreApplication class'methods;
 providing the documentation for the respective methods;
 automatic completion of the action's parameter;
 the search for other actions'names;
 control of input provided by the user;
 syntax highlighting in conguration les.
The automatic completion provided by this module should look like this:
The module this thesis deals with implements one of the most-frequently used APIs of
the NetBeans IDE:Completion Provider API.The functional part of the module consists
of four classes,but only the implementations of two of them are more signicant for this
completion.
15
The CfItemsProvider class contains almost all the algorithms which are specic to
automatic completion of conguration les.Among other things,these algorithms are used
for the creation of lists of completion items.The other class in which these algorithms are
implemented is the CfCompletionProvider class.
4.1 The MESSIF Library,the CoreApplication Class and
Conguration Files
MESSIF framework eases the task of building prototype implementations that are part of
researches in the area of similarity search in metric space.It provides a number of modules
from basic storage management to automatic collecting of performance statistics.Due to
its open and modular design it is also easy to implement additional modules if necessary.
The MESSIF also oers several ready-to-use generic clients that allow to control and test
the index structures and also measure its performance.These are its objectives:
 to provide basic support for the indexing based on metric space { let developers
focus on the higherlevel design;
 to create a unied and semi-automated mechanism for measuring and collecting
statistics;
 to dene and use uniform interfaces to support modularity and thus allow reusing
of the code;
 to provide infrastructure for distributed processing with focus on peer-to-peer paradigm
{ communication support,deployment,monitoring,testing,etc.;
 to support complex similarity search in multi-metric spaces [1].
The CoreApplication class implements a standalone client for MESSIF-enabled algo-
rithms.To start the client the following command should be issued:
user@home:#java -classpath MESSIF.jar:<algorithm's jar file or directory>
 messif.utility.CoreApplication [parameters]
Among others,command\<configurationFile> [action] [var=value...]"can be
passed as the parameter on the command line.It executes action in the specied
configurationFile (optionally with setting variables).
The conguration le is another way of issuing application commands.It allows batches
of commands to be prepared.These batches of commands can be run either immediately
after the process is started (see the example above) or through the
controlFile(java.io.PrintStream,java.lang.String...)
method.The conguration le is a textual le usually having\.cf"extension [13].
16
4.2 Completion Rules for MESSIF Conguration Files
Owing to the fact that conguration les used by the MESSIF library have a predened
structure,rules for automatic completion can be derived.These are the rules that can be
found in the library's Javadoc (for the CoreApplication class) [13]:
 Conguration les should have a predened header;
 Empty lines or lines starting with the#symbol are ignored;
 All other lines are actions with the following syntax:
<actionName> = <methodName | otherActionName1 otherActionName2...>
<actionName>.param.1 = <first parameter of the method methodName>
<actionName>.param.2 = <second parameter of the method methodName>
<actionName>.param.3 = <third parameter of the method methodName>
<actionName>.param.4 = <fourth parameter of the method methodName>
...
<actionName>.repeat = <repeats>
<actionName>.foreach = <value> <value>...
<actionName>.outputFile = <filename>
<actionName>.assign = <variable name>
<actionName>.postponeUntil = hh:mm:ss
All the elements that are part of action's declaration have a denition which can be used
when deriving rules for automatic completion:
 <actionName> is a user specied name for the action,which can be referred from
other actions (<otherActionName1> <otherActionName2>) or the command line
parameter [action].
 <methodName> can be any CoreApplication method,which is to be executed if
<actionName> is called.If a space-separated list of other action names is provided,
they will be executed one by one in the order they were specied.Parameters for
the method are specied using <actionName>.param.x;the documentation of the
respective CoreApplication methods can be consulted for their parameters.
 the repeat parameter is optional and allows multiple execution of the same action
<repeats> times to be specied.It can be used together with\block"method name
to implement a loop of commands with a specied number of repeats.
 the foreach parameter is also optional and,similarly to repeat,it allows the action
to be executed multiple times - the number of repeats is equal to the number of
values provided.Moreover,in each iteration the variable <actionName> is assigned
a <value> taken one by one from the foreach parameter.
17
 the outputFile parameter is optional and allows the output of this block to be redi-
rected to a le <filename>.When this lename is reached for the rst time,it is
opened for writing (previous contents are destroyed) and all successive writes are
appended to this le until this batch run nishes.
 the assign parameter is optional and allows output of this block to be redirected to
a variable <variable name>.The previous contents of the variable are replaced by
the new value and the variable is available after the action with\assign"is nished.
 the postponeUntil parameter is optional and allows the action to be postponed until
the specied time.The whole execution of the control le is paused.If the specied
time is in the past,this parameter is ignored.Note that the postponeUntil works
within one day.
 the repeatUntilException parameter is optional and allows the repetition of the action
to be stopped when the exception given as the value of this parameter occurs.Note
that if either the repeat or foreach parameter is also specied,the repeating ends
after their number of repeats or an exception whichever comes rst.If no repeat or
foreach is specied,the action is repeated until an exception occurs.
These and other denitions were used while planning algorithms for the automatic com-
pletion.While the API's interfaces are provided only with the basic logic needed for
completion to work,most of these algorithms are applied in the CfItemsProvider class,
which does not implement any of the API's interfaces.
4.3 Setting up the Project
After a new project for developing a module has been created (how to create a new project
was described in section 3.4;the new name for the project is\MESSIFCodeCompleter"and
Code Name Base should be set to\cz.imaginary.bcthesis"),in order to work properly
a module needs to declare its dependencies on other APIs.MESSIFCodeCompleter needs
to declare its dependency only on Editor Code Completion API.
Code completer uses the MESSIF library in order to determine the names of the li-
brary's methods,which are used for automatic completion.To nd these method names,
the MESSIF library needs to be included in the project,and by using Re ection API
these names can be later obtained.Re ection API is part of the Apache Commons Lang
package [14],which also needs to be included in the project.To add these two packages
the user should go to:
Project Properties  Libraries  Wrapped JARs  Add JAR
and select packages from lesystem.By doing this,packages become part of the project.
At this point,these three classes implementing similarly named interfaces should be
created:CfCompletionProvider,CfCompletionItem and CfCompletionDocumentation.
Class CfItemsProvider should also be created.
18
4.4 Implementation of Interfaces
An example of how to implement Editor Code Completion API's interfaces is available in
an on-line tutorial on the NetBeans community website [15].Besides a few changes,the
two classes implementing CompletionItem and CompletionDocumentation interfaces are
the same as the the ones in the tutorial.The class implementing CompetlionProvider
interface is also provided with an algorithm for disallowing bad user input when this kind
of control is required.
4.4.1 Class CfCompletionProvider
Having created this class and set its signature so that it implements the CompletionProvider
interface,NetBeans IDE can automatically add import statements that are needed and
then create skeleton methods for the following two methods required by the interface it
implements:
 CompletionTask createTask(int queryType,JTextComponent component) used
for creating tasks whenever the user types in an editor and,at the same time,the
code completion infrastructure asks all code completion providers registered in the
XML layer le { see section 4.5 { to create new CompletionTasks.
 int getAutoQueryTypes(JTextComponent component,String typedText) called
whenever completion infrastructure needs to decide whether to create a new com-
pletion task or not.Since this method is called whenever the user types in an editor,
determining whether the user input is correct is also left to this method.
The method createTask should return a new AsyncCompletionTask,since the code com-
pleter works with asynchronous events.This class allows asynchronous query execution
through AsyncCompletionQuery.It is a nal class and all the logic must be dened in an
implementation of AsyncCompletionQuery that is passed to the constructor of this task.
Both of this these classes come fromthe org.netbeans.spi.editor.completion.support
package,which provides several useful supporting classes for code completion implemen-
tations.
Writing of preamble
The AsyncCompletionQuery class is an abstract class and its query method needs to be
implemented to dene asynchronous querying behavior.This method's main goal is to
prepare the result set for the completion,but in this implementation it is also used for
inserting the preamble every conguration le should start with:
#Lines with comments start with'#'
########################################
#Main action which gets executed as first
actions =
19
To write the preamble at the beginning of a document,the text cursor { represented
by a caret { must be positioned at the rst line and the line must be empty.A combi-
nation of the <Ctrl-Space> keys invokes the code completer to create a new completion
task.This task does not prepare a set of possible results for the completion,but it writes
the preamble.What follows is a section of the code providing this functionality:
41 if(0==caretOffset && 1==document.getParagraphElement(caretOffset)
41 .getEndOffset()) f
42 final String headerSignature ="#Lines with comments start with'#'"+ eol
43 +"########################################"+ eol + eol
44 +"#Main action which gets executed as first"+ eol
45 +"actions =";
46 try f
47 document.insertString(0,headerSignature,null);
48 g
49 catch (BadLocationException ex) f
50 Logger.getLogger(CfCompletionProvider.class.getName())
51 .log(Level.SEVERE,null,ex);
51 g
52 resultSet.finish();
53 return;
54 g
If the preamble is not inserted,the query method adds completion items to a provided
result set that will form the completion popup window,sets the anchor oset and,naly
nishes the set.Before setting the anchor oset and nishing the set,the method needs
to determine which lists of items should be added to the set.Lists of completion items
are obtained using the following methods from the CfItemsProvider class:
 ArrayList<CfCompletionItem> getAssignForeachItems() providing <variables>
as items (see its implementation in section 4.4.4),
 ArrayList<CfCompletionItem> getPossibleRuleItems() providing rules as items
(see its implementation in section 4.4.4),
 ArrayList<CfCompletionItem> getActionNameItems() providing already dened
action names as items (see its implementation in section 4.4.4),
 ArrayList<CfCompletionItem> getMessifMethodParamItems() providing names
of methods from CoreApplication class,which have already been used in action
denition,as items (see its implementation in section 4.4.4),and
 ArrayList<CfCompletionItem> getMessifMethodNameItems() providing all names
of methods from the CoreApplication class as items (see its implementation in sec-
tion 4.4.4).
20
The getAutoQueryTypes method is used for determining whether the completion in-
frastructure should create a new task.Being called every time the user provides some
input qualies this method for input control and at this point patterns play an important
role.This control is needed on several occasions:
 when dening the repeat parameter,
 when dening the foreach parameter,or
 when dening the postponeUntil parameter.
Patterns are used for recognizing those lines in which one of these three parameters are
dened.At the time when the user provides some input only one line is analyzed.This
is the line in which the text cursor is located.The method rst fetches this line and then
determines whether the control of input should be made.
The repeat parameter can accept two kinds of values:a digit or a variable.Variables
are passed into conguration les using <variableName> annotation.This is the pattern
for recognizing the line dening this parameter:
109 Pattern patternRepeat = Pattern.compile("
^
(nnw+nn.repeatnns*=nns?)(.+)");
110 Matcher matcherRepeat = patternRepeat.matcher(currentParagraphLine);
When matcherRepeat nds a searched pattern,user input control should be activated.
This means that only a single numeric value or <variable> can be allowed and that any
other kind of input must be denied.Every other form of input must be denied or removed
from the line if it already exists.
Similar rules exist for the other two parameters and similar patterns are used for their
recognition.Multiple numeric values or <variables> (separated with an empty space)
can be assigned to the foreach parameter and the postponeUntil parameter can only accept
a value having the hh:mm:ss format,where h,m and s are single digits.
The getAutoQueryTypes method should return any combination of the following values:
 COMPLETION
ALL
QUERY
TYPES { the int value representing the query for an all code
completion,
 COMPLETION
QUERY
TYPE { the int value representing the query for a code completion,
 DOCUMENTATION
QUERY
TYPE { the int value representing the query for a documenta-
tion,
 TOOLTIP
QUERY
TYPE { the int value representing the query for a tooltip hint,or
 zero value if no query should be automatically invoked.
In this implementation,the method always returns zero because every query type should
always be invoked by the user (by pressing appropriate key-combination).
21
4.4.2 Class CfCompletionItem
This class represents a single itemof the result list that can be displayed in the completion
pop-up window.Most of its methods are implemented in the same way as the ones in the
on-line tutorial (see section 4.4).The following two methods had to be changed:
58 public void defaultAction(JTextComponent component) f
59 StyledDocument doc = (StyledDocument)component.getDocument();
60 try f
61 doc.remove(textOffset,caretOffset - textOffset);
62 text = text.replace("&lt;","<");
63 text = text.replace("&gt;",">");
64 doc.insertString(textOffset,text,null);
65 Completion.get().hideAll();
66 g catch (BadLocationException ex) f
67 Logger.getLogger(CfCompletionItem.class.getName())
67 .log(Level.SEVERE,null,ex);
68 g
69 g
The defaultAction method has been changed so that in one specic situation,text
representing the item in a completion pop-up window can be altered.This change is
needed because the two symbols {\<"and\>"{ are represented by their HTML codes {
\&lt;"and"&gt;".Their HTML representations need to be replaced with actual symbols
before inserting the text at the given position.
72 public void processKeyEvent(KeyEvent evt) f
73 if(evt.isShiftDown() && evt.getKeyCode() == KeyEvent.VK
ENTER) f
74 this.text += eol;
75 if(postText!= null) this.text += postText;
76 g
77 g
The processKeyEvent method processes the key pressed when this completion item
was selected in the completion pop-up window.If the <Shift> key was held down while
pressing the <Enter> key,a new line should be inserted after the text.In addition,some
items can have additional text which should be inserted on that new line (see section 4.4.4).
4.4.3 Class CfCompletionDocumentation
This class represents an item that can be displayed in the documentation pop-up window.
The constructor of this class is provided with an instance of the CfCompletionItem.The
provided instance\owns"newly created documentation item.To obtain all the necessary
information about the completion itemthis class is associated with,it can access protected
22
methods of the item.The CfCompletionDocumentation class has the following methods:
 Action getGotoSourceAction(),
 CompletionDocumentation resolveLink(String link),
 String getText(),and
 URL getURL().
In this implementation the rst two methods are dummies (a dummy method returns
null or 0 value without computing anything).The other two methods provide basic
functionality,like the ones in the on-line tutorial.
4.4.4 Class CfItemsProvider
This is a class containing algorithms used for providing lists of automatic completion and
documentation items that are specic to the MESSIF library's conguration les.It ana-
lyzes a given document and creates lists of items from the data it collects.
It also accesses the MESSIF library package and,using the Re ection API,determines
the names of methods from the CoreApplication class that will be used when providing
lists of items for automatic completion.These lists are used later for lling completion
pop-up windows in the implementation of the CompletionProvider interface (see sec-
tion 4.4.1).
Class constructor is provided with two parameters:
 StyledDocument document { this class is obtained using the getDocument method
from the JTextComponent class.The JTextComponent class represents the Editor
window,in which the user inserts text when working with conguration les.The
value of this parameter is saved in a private StyledDocument document data eld.
 int caretOffset { the integer value that can be obtained using the getCaretPosition
method from the JTextComponent class.This is a value representing the current po-
sition of the text cursor in the Editor window.The value of this parameter is saved
in a private int caretOffset data eld.
Besides these two elds,the class also contains elds holding the following information:
 the starting position of the searched word in the document (saved in private int
textOffset),
 the part of the word that has already been typed in (saved in private String
preText),and
 the priority of an itembelonging to a list (saved in private int itemListPriority).
When an instance of this class is created,values are automatically assigned to these elds.
This is achieved using the parameters provided to the class constructor.
23
This class also contains two static elds for storing information about the methods
fromthe CoreApplication class.Assigning values to these two elds is done using the Re-
ection API,by determining which are the appropriate methods.An appropriate method
is the one having the following signature:
methodName(java.io.PrintStream out,java.lang.String...args)
Adding the methods that have been found (as Method objects) and their names (as String
objects) simultaneously to two ArrayLists makes it possible to nd the index of a specic
Method object in that ArrayList just by knowing its name [16],which is later put to use
in the implementation of the getMessifMethodNameItems method.
Two methods have been copied into this class fromthe CountriesCompletionProvider
class developed in the earlier mentioned on-line tutorial.These methods are getTextOffset
and indexOfWhite.
The getParagraphLine method is used for obtaining that line from the document in
which the caret,passed as its argument,is located.Method getActionNames returns an
ArrayList of other actions'names,the ones that will be executed after that action,one
by one in the order they were specied:
<actionName> = <methodName | otherActionName1 otherActionName2...>
This method goes through the entire document searching for these actions'names and
adds the ones it has not found yet to the list.
Five methods that have been mentioned in section 4.4.1,those methods returning ArrayLists
of CfCompletionItems,will be discussed in more detail.
Method getAssignForeachItems()
When dening an action,lling out its assign or foreach parameters qualies it later
to be used as a variable.It can be used for automatic completion when lling out any of
these four other action's parameters:
 otherActionName.param.x where x is a number,
 otherActionName.repeat,
 otherActionName.foreach,or
 otherActionName.postponeUntil.
This means that if some action has the following line as a part of its denition:
actionName.assign = assignedName
this action can be used later as a variable when lling out the parameters of other actions.
It can be accessed as an <assignedName> variable.
24
A similar situation is true for the foreach parameter.For example,having typed the
line
actionName.foreach = 1 10 100
as a part of actionName denition,this action can be accessed later as a variable <actionName>.
The getAssignForeachItems method analyzes a given document in a search for de-
nitions of actions that fulll these demands.Every action can have only one foreach or
assign parameter in its denition and therefore it cannot be added more than once to the
list.Every item of this list starts with the\<"symbol and ends with the\>"symbol,so it
is clear that items making this list are variables that can be used in described situations
later on.
Method getPossibleRuleItems()
As shown in section 4.2,six dierent parameters can be assigned to each action in the
action denition.Finding those parameters that have not yet been assigned can make
auto completion more ecient.
This method analyzes the current block of text,searching for parameters that have
not yet been dened in it.It does not analyze lines starting with the symbol\#"because
this symbol is used to mark the beginning of the comment section in the conguration
les and,therefore,these lines do not have any meaning in action denitions.Skipping
commented lines and nding a block's boundaries is achieved using the following code:
254 matcherEmpty = patterEmpty.matcher(searchedParagraphLine);
255 if(matcherEmpty.find()) break;
256 if(searchedParagraphLine.startsWith("#")) continue;
The Pattern patternEmpty and Matcher matcherEmpty used for empty-line recogni-
tion,as well as the Pattern pattern and Matcher matcher used for recognition of those
lines having the searched structure,were dened earlier:
226 final Pattern patterEmpty = Pattern.compile("
^
(nns*)$");
227 Matcher matcherEmpty;
228 final Pattern pattern = Pattern.compile
228  ("
^
(nnw+)nn.?(nnw*)nn.?(nnd*)nns*=nns*nnw*");
229 Matcher matcher;
The rst pattern's role is just to recognize those lines consisting of empty-space char-
acters.The second pattern searches for lines in which actions or the actions'parameters
are dened.All the captured groups are later used for determining what kind of denition
is present on the line.This is why the\."symbol,separating the basic elements building
25
rules and,therefore,separating capturing groups,can occur zero times or once.Deter-
mining if some captured group is empty or not tells the method what kind of denition is
present on the line.
By processing every line inside the block,the method remebers which parameters have
already been dened.Information about already found parameters is kept in the array
of boolean values and this array is used later in this method when adding the missing
parameters to a completion list.The resulting list of CfCompletionItems is returned.
Method getActionNameItems()
This method uses an already prepared list of actions provided by the getActionNames
method.It checks if any of these actions'names are the same as a method's name from
the CoreApplication class and if not it wraps this name as an CfCompletionItem,adds
it to the list and returns the list.This functionality,as described,is achieved using the
following code:
176 Iterator iterator = actionNames.iterator();
177 while (iterator.hasNext()) f
178 final String actionName = iterator.next().toString();
179 if (actionName.startsWith(preText) &&!actionName.equals(preText)
179  &&!messifMethodNames.contains(actionName)) f
180 actionNameItems.add(new CfCompletionItem(actionName,"Allready defined
181  <actionName>","<div style=n"padding:5px;font-size:10pxn">
181  &lt;actionName&gt;that has allready been defined in this document.
181  </div>",null,itemListPriority,textOffset,caretOffset,null));
181 g
182 g
When the method completes the list,like all the other methods returning lists of items,
it increases the next list's priority and returns the list:
184 itemListPriority++;
185 return actionNameItems;
Method getMessifMethodParamItems()
The structure of conguration les allows direct assignment of some parameters to those
methods from the CoreApplication class that have been used in an action denioton as
the actions whose execution will follow after the execution of that action.In the following
example,instead of typing:
inf = algorithmInfo statGlob
statGlob = statisticsGlobal
statGlob.param.1 = DistanceComputations.*|BucketRead
26
a user can shorten his work by typing:
inf = algorithmInfo statisticsGlobal
statisticsGlobal.param.1 = DistanceComputations.*|BucketRead
In other words,there is no need to create a new action that will represent a method
from the CoreApplication class and then assign parameters to this action.
The getMessifMethodParamItems method returns a list of those methods'names that
have been used in the denition of any action in the le.Every item of this list has the
following structure:
<methodName>.param.1 =
Items are added to this list (to be more precise,this list is included in the nal result
list used in the completion pop-up window) only when the text cursor is located at the
beginning of a line.
This method creates the list of items in a very similar way to the method that was
previously explained,except that it checks if the given action's name (the list of actions'
names is also provided using the getActionNames method) is the name of a method from
the CoreApplication class and,if it is,the method adds the\.param.1 ="text to the
action's name,wraps it as a new item and,when nished iterating through the actions'
names,returns the list.
Method getMessifMethodNameItems()
The names of the methods fromthe CoreApplication class can be used independently for
automatic completion as well.They can occur when dening some action or the action's
parameter and therefore a list of these names should be be provided also.
As mentioned at the beginning of this section,a static eld is used for keeping these
names and this eld is now used for creating the list of items.This method does not only
wrap every method's name as a new item and adds it to the list,but it also allows addi-
tional actions to happen when any of these items are selected in the completion pop-up.
The following code determines whether an action is being denied on the line or not.If
so,it assigns the name of the action to a String variable.This variable will be used later
to determine whether additional completion should be provided if this item is selected in
the completion popup window.
100 String lineStart = null;
101 Pattern patternLineStart = Pattern.compile("
^
(nnw+)nns*=nns*nnw*$");
102 Matcher matcherLineStart = patternLineStart
102 .matcher(getParagraphLine(caretOffset,true));
103 if(matcherLineStart.find()) lineStart = matcherLineStart.group(1);
27
While iterating through CoreApplication methods'names,this method gains access
to every method's object (by determining its index in the ArrayList<String> and fetch-
ing the object with the same index from the other ArrayList<Method>).Having done
this,annotations describing the fetched method can be determined.These annotations
and the information they are holding are used for generating the item's documentation.
One specic annotation plays an important role when determining whether additional
automatic completion should be done.This annotation holds information about the actual
parameters that should be provided when calling this method,and if the rst parameter
should be the name of some class,then additional automatic completion should be done:
124 if(1 == argNum && arg.contains("class") && null!= lineStart)
124  postText = lineStart +".param.1 =";
The postText is the text that will be automatically inserted into a new line if the user
holds down the <Shift> key while selecting the item in the completion pop-up window.
4.5 Registring Code Completer with text/x-ini MIME-Type
The CfCompletionProvider class needs to be registered in the XML layer le in order to
make the module functional.This is necessary for the reason that every code completer
(even the one that comes with the IDE) needs to declare the le MIME-Type that it works
with.Inside the cz.imaginary.bcthesis package is located the layer.xml le,whose
content should look like this:
1 <?xml version="1.0"encoding="UTF-8"?>
2 <!DOCTYPE filesystem PUBLIC"-//NetBeans//DTD Filesystem 1.2//EN"
2 "http://www.netbeans.org/dtds/filesystem-1
2.dtd">
3 <filesystem>
4 <folder name="Editors">
5 <folder name="text">
6 <folder name="x-ini">
7 <folder name="CompletionProviders">
8 <file name="cz-imaginary-bcthesis-CfCompletionProvider
8 .instance"/>
9 </folder>
10 </folder>
11 </folder>
12 </folder>
13 </filesystem>
This le was automatically generated when the project was created,but lines 4{12
have been added later.Thanks to the entries on these lines,whenever the user types a
character of any kind in a le with a MIME-Type of text/x-ini,the code completion
28
infrastructure will ask the CfCompletionProvider to create its CompletionTask.
Syntax highlightning in conguration les,the one presented in this chapter's exam-
ples,can be achived just by associating conguration les for the MESSIF library with
an appropriate MIME-Type in the IDE's settings.How to achieve this is described in
Appendix A,subsection A.2.2.
29
Chapter 5
Conclusion
The result of the work is a plug-in that enhances the NetBeans IDE and makes the editing
of conguration les for the MESSIF library easier.The source code of the developed
module is written in about 1000 lines.Though the thesis does not analyze every line,it
provides a reasonable explanation of the most important points in the code.
NetBeans IDE is the leading IDE for the development of Java applications,but other
software solutions (like Eclipse,IntelliJ IDEA,and Oracle JDeveloper) also exist and are
frequently used.Having separated almost all the logic that is specic to the automatic
completion of conguration les into one class,it became possible to quickly isolate the
algorithms in it and to use them later,when developing similar plug-ins for other IDEs.
Future plans for the development of the plug-in could be focused on extending its
functionalities.The standard Java completion provider,which is used when editing les
written in the Java language,oers automatic completion and documentation when work-
ing with Java packages that are available in a developing project.This kind of functionality
could be put to use as well when editing conguration les for the MESSIF library.Once
again,in order to expand the module's functionality it would be enough just to edit a
single class,represented by the\CfItemsProvider.java"le.
30
Bibliography
[1] BATKO,Michal |NOV

AK,David |ZEZULA,Pavel.MESSIF:Metric Similarity
Search Implementation Framework.In Digital Libraries:Research and Development,
Lecture Notes in Computer Science,vol.4877.Berlin,Heidelberg:Springer-Verlag.
2007.10 pages.ISBN 978-3-540-77087-9.3
[2] J

URGEN,Petri.NetBeans Platform 6.9 Developer's Guide.Birmingham,UK:Packt
Publishing Ltd.August 2010.291 pages.ISBN 978-1-849511-76-6.Chapter 1:Mod-
ules.Page 8.6
[3] Northrop Grumman Agile Client [online].[cit.2011-05-04].Available at URL:
<http://netbeans.dzone.com/news/war-fighter-netbeans-platform>.7
[4] Boeing Mass Properties Toolkit [online].[cit.2011-05-04].Available at URL:
<http://netbeans.org/community/articles/boeing-netbeans-platform.html>.7
[5] Vinland Software Suite [online].[cit.2011-05-04].Available at URL:
<http://netbeans.dzone.com/news/oil-gas-exploration-netbeans>.7
[6] B

OCK,Heiko.Platforma NetBeans:Podrobny pruvodce programatora.First edition.
Computer Press,Brno,CZ.320 pages.ISBN 978-80-251-3116-9.KAPITOLA 2:Ar-
chitektura platformy NetBeans,page 20.8
[7] Free NetBeans Platform Crash Course [online].[cit.2011-05-04].Available at URL:
<http://netbeans.dzone.com/videos/free-netbeans-platform-crash>.8
[8] NetBeans IDE 7.0 Download [online].[cit.2011-05-06].Available at URL:
<http://netbeans.org/downloads/index.html>.9
[9] NetBeans Platform Learning Trail [online].[cit.2011-05-16].Available at URL:
<http://netbeans.org/kb/trails/platform.html>.10
[10] NetBeans Plugin Quick Start [online].[cit.2011-05-16].Available at URL:
<http://platform.netbeans.org/tutorials/nbm-google.html>.10
[11] NetBeans API List [online].[cit.2011-05-05].Available at URL:
<http://bits.netbeans.org/dev/javadoc/>.15
31
[12] Editor Code Completion Javadoc [online].[cit.2011-05-05].Available at URL:
<http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-editor-completion>.16
[13] Class CoreApplication Javadoc [online].[cit.2011-05-08].Available at URL:
<http://lsd.fi.muni.cz/projects/messif/javadoc/messif/utility/CoreApplication.html>.17
[14] Apache Commons [online].[cit.2011-05-13].Available at URL:
<http://commons.apache.org/lang/>.18
[15] NetBeans Code Completion Tutorial [online].[cit.2011-05-03].Available at URL:
<http://platform.netbeans.org/tutorials/nbm-code-completion.html>.19
[16] ECKEL,Bruce.Thinking in Java:4
th
edition.New Jersey,USA:Prentice Hall.Oc-
tober 2009.ISBN 0-13-187248-6.Containers in Depth.Page 589.23
[17] MESSIF Code Completer { A Netbeans IDE Plug-in for Editing Conguration Files
[online].[cit.2011-05-06].Available at URL:
<http://bcthesis.imaginary.cz/index.php>.33
32
Appendix A
User Manual
A.1 Distribution
The MESSIFCodeCompletion module can be downloaded fromthe Bachelor's Thesis'home-
page [17],as an exported NBMbinary le or as a NetBeans project (in a.zip le or every
source le individually).Its Javadoc can be found at the same location.
A.2 Adding the Module
A.2.1 Installing the Module
Having obtained the installation le (MESSIFCodeCompleter.nbm),the module can be
added to the NetBeans IDE.To do so,the user should go to:
Tools  Plugins  Downloaded
and then add it by clicking Add Plugins and selecting the downloaded le fromlesystem.
Once the plugin has been added,the user should press the Install button at the bottom
of the Plugin window and follow the installation procedure to complete the installation
process.To use the module,NetBeans IDE needs to be restarted after the installation has
nished.
A.2.2 Setting up the MIME-Type
Conguration les used by the MESSIF library do not have a specic MIME-Type.Hav-
ing registered the MESSIFCodeCompleter module to be activated whenever editing les
having MIME-Type of text/x-ini,it is necessary to associate.cf le extension (cong-
uration les'extension) to the same MIME-Type in NetBeans settings.
33
This can be achieved by adding the above mentioned le extension to the list of ex-
tensions associated with MIME-Types in:
Tools  Options  Miscellaneous  Files.
Conguration les used by many applications { those les having extension.ini or.cfg
{ have a text/x-ini MIME-Type.Conguration les used by the MESSIF library can
also be associated with this MIME-Type.
34
Appendix B
CD Contents
An integral part of the thesis is a CD containing the following:
/Module/directory
"MESSIFCodeCompleter.nbm"and"MESSIFCodeCompleter.zip"les
/Text/directory
source code of the Bachelor's Thesis and the output in PDF format
35