org.openide.compiler
Class ExternalCompilerGroup

java.lang.Object
  |
  +--org.openide.compiler.CompilerGroup
        |
        +--org.openide.compiler.ExternalCompilerGroup

public class ExternalCompilerGroup
extends CompilerGroup

A group holding several ExternalCompilers. When they are compiled, all the filename arguments are collected and the process is run only once.

See Also:
ExternalCompiler

Inner Class Summary
static class ExternalCompilerGroup.Format
          Default format that can format tags related to compilation.
 
Constructor Summary
ExternalCompilerGroup()
          Create an external compiler group.
 
Method Summary
 void add(Compiler c)
          Add a compiler to the group.
protected  Process createProcess(NbProcessDescriptor desc, String[] files)
          Allows subclasses to provide their own format for parsing the arguments of NbProcessDescriptor contained in the ExternalCompiler.
protected  Process createProcess(NbProcessDescriptor desc, String[] files, File cwd)
          Allows subclasses to provide their own format for parsing the arguments of NbProcessDescriptor contained in the ExternalCompiler.
protected  Process createProcess(NbProcessDescriptor desc, String[] files, Object compilerType)
          Deprecated. Please instead directly override createProcess(NbProcessDescriptor,String[]) as this version does not use the now-deprecated "compiler type" object.
protected  Collection filterCompilers(Collection allCompilers)
          This implementation filters compilers that have the same hashCode and equals, but they report different up-to-date status.
protected  ExternalCompiler[] getAllCompilers()
           
protected  String getStatusLineText()
          Creates human readable String used in status line - should contain information what is compiled - Compiling MyClass.java
protected  void notifyError(String file, int line, int column, String message, String ref)
          Notifies (fires) about an error; all parameters are description of the error
protected  void parseErrors(ExternalCompiler.ErrorExpression err, Reader parsedReader)
          Parses a compiler errors described by err from parsedReader
 boolean start()
          Start compilation.
 
Methods inherited from class org.openide.compiler.CompilerGroup
addCompilerListener, fireErrorEvent, fireProgressEvent, removeCompilerListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExternalCompilerGroup

public ExternalCompilerGroup()
Create an external compiler group.
Method Detail

add

public void add(Compiler c)
         throws IllegalArgumentException
Description copied from class: CompilerGroup
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.

Overrides:
add in class CompilerGroup
Following copied from class: org.openide.compiler.CompilerGroup
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())

createProcess

protected Process createProcess(NbProcessDescriptor desc,
                                String[] files,
                                Object compilerType)
                         throws IOException
Deprecated. Please instead directly override createProcess(NbProcessDescriptor,String[]) as this version does not use the now-deprecated "compiler type" object.

Allows subclasses to provide their own format for parsing the arguments of NbProcessDescriptor contained in the ExternalCompiler; assumes interesting content of "compiler type".

By default, delegates to the variant that does not take a "compiler type" argument, as this is deprecated usage.

Parameters:
desc - description of program to start
files - the argument to compiler list of files to compile (or reference to the file with @files)
compilerType - the type of compiler for all this files, this is the compiler dependent object returned from method ExternalCompiler.compilerType ()
Returns:
format to use for changing the command line of the compiler
Throws:
IOException - if exec fails
See Also:
ExternalCompiler.compilerType()

createProcess

protected Process createProcess(NbProcessDescriptor desc,
                                String[] files)
                         throws IOException
Allows subclasses to provide their own format for parsing the arguments of NbProcessDescriptor contained in the ExternalCompiler.

This implementation creates new format Format with settings from NbClassPath.createXXXX and executes them in the provided process descriptor.

Parameters:
desc - description of program to start
files - the argument to compiler list of files to compile (or reference to the file with @files)
Returns:
format to use for changing the command line of the compiler
Throws:
IOException - if exec fails

createProcess

protected Process createProcess(NbProcessDescriptor desc,
                                String[] files,
                                File cwd)
                         throws IOException
Allows subclasses to provide their own format for parsing the arguments of NbProcessDescriptor contained in the ExternalCompiler.

This implementation creates new format Format with settings from NbClassPath.createXXXX and executes them in the provided process descriptor.

Parameters:
desc - description of program to start
files - the argument to compiler list of files to compile (or reference to the file with @files)
cwd - current working directory. The parameter is taken into account only for JDK 1.3
Returns:
format to use for changing the command line of the compiler
Throws:
IOException - if exec fails

getStatusLineText

protected String getStatusLineText()
Creates human readable String used in status line - should contain information what is compiled - Compiling MyClass.java
Returns:
String

getAllCompilers

protected final ExternalCompiler[] getAllCompilers()
Returns:
an array containing all Compilers that were added to this CompilerGroup

filterCompilers

protected Collection filterCompilers(Collection allCompilers)
This implementation filters compilers that have the same hashCode and equals, but they report different up-to-date status. The compiler that is not up-to-date will be passed on.
Returns:
Collection of unique compilers.

start

public boolean start()
Description copied from class: CompilerGroup
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.

Overrides:
start in class CompilerGroup
Following copied from class: org.openide.compiler.CompilerGroup
Returns:
true if successful, false if the compilation failed

parseErrors

protected void parseErrors(ExternalCompiler.ErrorExpression err,
                           Reader parsedReader)
Parses a compiler errors described by err from parsedReader
Parameters:
err - describes format of errors of the related compiler
parsedReader - the parsed stream

notifyError

protected void notifyError(String file,
                           int line,
                           int column,
                           String message,
                           String ref)
Notifies (fires) about an error; all parameters are description of the error
Parameters:
file - in which file
line - on which line
column - on which column
message -  
ref -  


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