Nice TWiki > Dev > EclipsePlugin (r1.19) TWiki webs:
Dev | Doc | Main | TWiki | Sandbox
Dev . { Changes | Index | Search | Go }
On this page the Nice Eclipse Plug-in is described

The Plug-in's progress


The plug-in consists of three plugins:

the downloadable jar (v0.0.2) contains the two folders. you can download here:


Put the nice plugins in the %eclipse_home%/plugins folder and restart eclipse.


If you experience an unexpected behaviour sheck the following by Menu Help > About Eclipse Platform >

-- AlexGreif - 08 Jun 2003


You can find a fast intro on the exclipse workbench at worbench_userguide.pdf

User feedback

I just tried the plugin. Installation was very easy! I could create a new project, a new folder hello, and a file hello.nice. To go farther, I would need to be able to compile my project! :-)

If I understand well, a perspective is a set of windows that fill the screen at some point. The Nice perspective has "Nice resources" and the text editor. Note that when I created a Nice project, it did not switch automatically to the Nice perspective. Is this normal? -- DanielBonniot - 10 Jun 2003

I will investigate how to set the default perspective. -- AlexGreif - 12 Jun 2003

In the "resource" perspective, there is a "task" window. That's where compilation errors will go in the future, right? -- DanielBonniot - 10 Jun 2003

In the first drop we will present all compiler output in a console window. But later, yes the task view will list all errors and warnings... and the user can then double-click the error and lands in the appropriate line. -- AlexGreif - 12 Jun 2003

The compilation listener is already implemented. So maybe you can skip the console step. --Daniel

How will this work in a multi-language project (say, Nice and Java, like in the Nice compiler source)? The source files will be opened in different editors, depending on the extension? -- DanielBonniot - 10 Jun 2003

Yes, in the Nice-Project, that can contain diffferent file types, always the appropriate editor is opened. -- AlexGreif - 12 Jun 2003

What is Nice-Project? --Daniel

with Nice Project I mean a special eclipse project Type, that was created by menu =File > new... > Project... > Nice =. A Nice-Project knows which filetypes how to handle and how to invoke the compiler ... -- AlexGreif - 12 Jun 2003

If I write an ant build file for that project, will it be possible that compile errors are parsed correctly, depending on whether they come from javac and nicec?

all errors should land in the task view, independently from which compiler. This is the desired solution. Isn't it? -- AlexGreif - 12 Jun 2003

Yes. But if the compiler was invoked by ant, I wonder how the information can be passed to eclipse through ant. --Daniel

If you build the project by ant, in a java-Project, all ant compilation errrors are "routed" in the Task view. If a java-project can to this, then we should be able to do this too :) -- AlexGreif - 12 Jun 2003

Does eclipse support Makefile too?

I dont know, we have to look :) -- AlexGreif - 12 Jun 2003

I know, these are advanced features. I'm just curious. For the moment, support for Nice-only projects would already be great. Keep up the good work! -- DanielBonniot - 10 Jun 2003

This plugin is a good reason for me to try out eclipse. -- ArjanB



One improvement I want to make to the compiler interface is to create a CompilationListener interface. It would receive messages that describe how the compilation is going. Incidentally, I will completely separate the console compiler in The package will only hold the high-level, java/nice compilation api.

A first idea for the listener is:

interface CompilationListener
  error  (Location location, String message);
  warning(Location location, String message);

  /** Reports the progress of compilation.
      phase can be: parsing, type-checking, generating code, ...
      the package can be null if the phase applies to the whole program (testing dispatch, creating the archive, compiling to native code, ...).
  progress(?String package, String phase);

I might work on this today.

-- DanielBonniot - 11 Jun 2003

I would add a method "message(String)" for general messages.

All messages should be identified by a precise kind, I think. --Daniel

ASAIK other compilers go the other way:

interface CompilationListener {

class CompilationMessage {
  String getText()

class Error extends CompilationMessage {
  int getLine();

class Warning extends CompilationMessage {
 int getLine()

class Progress extends CompilationMessage {
  String getPackage();

-- AlexGreif - 12 Jun 2003

Is this better? One drawback is that it encourages to catch the generic message, thus losing information. I think a listener will take different actions depending on the kind of message, so we might as well call different methods for that. --Daniel

I dont know it this is better, Pizza did it this way and I think javac too. I was quite happy with this solution. There are only some types of Information that the compiler returns, so may be both are good. We schould start with yours and see how it involvs. -- AlexGreif - 12 Jun 2003


Looks useful to me. By the way, does the compiler offer a convenient way of obtaining the AST? Do we have a pretty-printer that will generate Nice source code from the AST? These could be important for this plugin (or others), if we want to support automated refactoring operations.

-- BrynKeller - 11 Jun 2003

No, the compiler offer no easy way to obtain the AST. And pretty-printing is only very limited because it's only used for creating *.nicei files. Both things could easily be implemented once the bossa.syntax package is completely converted to Nice. -- ArjanB

At the moment, the compilation API only allows a full compilation. It would not be very difficult to add an API to get an AST. It just needs to be defined: should we pass a package name and get back a list of AST for all files in this package and the imported packages? Or work on a file-by-file basis?

Pretty printing would need to be written (at the moment there is a toString method, but it won't create indentation, for instance). I'd suggest writing a Nice multi-method for pretty-printing, so it could be kept in a separate package. The root class for an AST is bossa.syntax.AST.

-- DanielBonniot

Syntax Highlighting

If you need it, I want to help the syntax highlighting since I familiar with the grammar of Nice and I have some time. -- ArjanB

We have to collect ideas how to realize syntax highlighting. My suggestion is

All editors that I know use the second way, they scan the source for strings and apply the rules in for of setting style and color.

I think the first suggestion is better, because we let the nice parser determine which words are highlighted. On the other hand we have to measure how performant on the fly parsing is.

Maybe there is a way in eclipse to parse only the relevant parts of the edited document, and not the whole file all the time. -- AlexGreif - 12 Jun 2003

The parser is not very adapted for syntax highlighting because:

It seems that we need three parsers, for the compiler (can be used for refactoring too), NiceDoc, and syntax highlighting. They are similar, but have different requirement. Does anybody know a way to share the common parts, while getting the different behaviours? -- DanielBonniot - 12 Jun 2003

yes that would be a good thing! -- AlexGreif - 12 Jun 2003

-- AlexGreif - 12 Jun 2003

I think implementing simple keyword highligthing is a good start. -- DanielBonniot - 12 Jun 2003

OKwe will take this for the first proto , then I can use the Ruby example :)) They do it the simple way too -- AlexGreif - 12 Jun 2003

We don't need three parsers because the NiceDoc comments could be parsed by the compiler and be put in the AST. This allow better linking between NiceDoc pages because the compiler can know wich method implementation belongs to which method definition and vice versa.

The parser for the plugin could be a lot simpler than the one for the compiler so sharing common parts might be not worth the effort.

-- ArjanB

I would prefer the parser in the final solution.

The question is, how should the parser return the syntax information?

It depends how eclipse allows us to implement it, but IMO the third one is the best.

-- AlexGreif - 12 Jun 2003

For syntax highlighting, it seems to me the best would be to implement an generic SyntaxHighlighter?. It would take as input a, and return as output a list of specifications: at such position there is a keyword, at such other position there is the name of a variable being defined, ... Would it be easy to do the highlighting in the text editor, given this info?

It should probably be started in a low-priority thread, so it does not slow-down the system when writing.

A good thing is that SyntaxHighlighter? could be shared among several editors (think JEdit).

If we think, in the long term, about refactoring, showing the definition of a class and automatic completion, which basically mean parsing the whole program, this could be seen as duplicating effort. On the other hand, it could be nice to have syntax highlighting on syntactically incorrect programs (when you are writing a method, and it is not finished yet), and then SyntaxHighlighter? needs to be quite different from a normal parser anyway.

Do we know how code completion works in eclipse plugins?


-- DanielBonniot

Compiler Invocation

In the first run I will embed the nice.jar in the temporary (net.sf.nice.compile) plugin. This makes it fast to implement the plugin proto. If we get more experience how to handle only one nice.jar on the whole system, we will get rid of this temp plugin. -- AlexGreif - 12 Jun 2003

Should there be a way to specify compilation options (the main package, class directory, classpath...). These are per-project setups, so I don't think they should go in the global preferences. -- DanielBonniot

we should specify the most necessary things in the main preferences (Menu Window > Preferences > Nice) -- AlexGreif

Or should we require that the user writes an Ant build file to do that? (Is there a good assistant to write build files? Or maybe the nice plugin could contain an editor to create sections in a ant build file specifically for the nicec target, listing the available options?). -- DanielBonniot - 12 Jun 2003

Only ant script is not enough. Its not very user friendly. There is another plugin that lets one build ant scripts. we can make our plugin dependant on the ant-plugin. -- AlexGreif

I managed to compile a Nice project, by writing a ant build file! The editing was in a text window, but there was automatic tag completion. Is this what you were refering to, or is there something more user-friendly? -- DanielBonniot

Topic EclipsePlugin . { Edit | Attach | Ref-By | Printable | Diffs | r1.35 | > | r1.34 | > | r1.33 | More }
Revision r1.19 - 12 Jun 2003 - 12:40 GMT - DanielBonniot
Parents: WebHome
Copyright © 1999-2003 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback.