org.openide.compiler
Class CompilerGroup

java.lang.Object
  |
  +--org.openide.compiler.CompilerGroup
Direct Known Subclasses:
ExternalCompilerGroup

public abstract class CompilerGroup
extends Object

Cluster of compiler objects that actually runs the compilation. Should be implemented by a module author in conjunction with Compiler.

The group is created by obtaining a class name from Compiler.compilerGroupClass() and instantiating it. Then all compilers that use the same class are added to the group with add(org.openide.compiler.Compiler).

The group can assume that everything is prepared for compilation. It can be invoked by actions to compile, build or clean.


Constructor Summary
CompilerGroup()
           
 
Method Summary
abstract  void add(Compiler c)
          Add a compiler to the group.
 void addCompilerListener(CompilerListener l)
          Add a listener.
protected  void fireErrorEvent(ErrorEvent ev)
          Fires an error event to all listeners.
protected  void fireProgressEvent(ProgressEvent ev)
          Fire a progress event to all listeners.
 void removeCompilerListener(CompilerListener l)
          Remove a listener.
abstract  boolean start()
          Start compilation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompilerGroup

public CompilerGroup()
Method Detail

add

public abstract void add(Compiler c)
                  throws IllegalArgumentException
Add a compiler to the group. Should absorb all information contained in the compiler.

This method is important for module authors, as it should keep track of the essential data from the compiler added to it, so that the group knows what files (e.g.) to compile.

Parameters:
c - the compiler to consume
Throws:
IllegalArgumentException - if the compiler does not belong to this group (the group's class is not assignable to the one returned from Compiler.compilerGroupClass())

start

public abstract boolean start()
Start compilation. Should check which files really need to be compiled and compile only those. The compilation should be synchronous (i.e. occupy this thread).

The compilation should report its progress to status listeners and report all errors to error listeners.

Returns:
true if successful, false if the compilation failed

addCompilerListener

public final void addCompilerListener(CompilerListener l)
Add a listener.
Parameters:
l - the listener to add

removeCompilerListener

public final void removeCompilerListener(CompilerListener l)
Remove a listener.
Parameters:
l - the listener to remove

fireProgressEvent

protected final void fireProgressEvent(ProgressEvent ev)
Fire a progress event to all listeners.
Parameters:
ev - the event to fire

fireErrorEvent

protected final void fireErrorEvent(ErrorEvent ev)
Fires an error event to all listeners.
Parameters:
ev - the event to fire


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.