de.cau.cs.kieler.s.sc.beautifier
Class Beautifier

java.lang.Object
  extended by de.cau.cs.kieler.s.sc.beautifier.Beautifier
All Implemented Interfaces:
org.eclipse.xpand2.output.PostProcessor

public class Beautifier
extends Object
implements org.eclipse.xpand2.output.PostProcessor

Formats generated Java code using the Eclipse code formatter.

Since:
4.0
Rating red

Constructor Summary
Beautifier()
           
 
Method Summary
 void afterClose(org.eclipse.xpand2.output.FileHandle impl)
          
 void beforeWriteAndClose(org.eclipse.xpand2.output.FileHandle info)
          Formats the file using Eclipse code formatter.
 String getConfigFile()
           
protected  InputStream openStream(String filename)
          Searches for the given filename as a resource and returns a stream on it.
 void setConfigFile(String configFile)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Beautifier

public Beautifier()
Method Detail

beforeWriteAndClose

public void beforeWriteAndClose(org.eclipse.xpand2.output.FileHandle info)
Formats the file using Eclipse code formatter. The file must have the extension '.c'.

Specified by:
beforeWriteAndClose in interface org.eclipse.xpand2.output.PostProcessor

openStream

protected InputStream openStream(String filename)
                          throws IOException
Searches for the given filename as a resource and returns a stream on it. Throws an IOException, if the file cannot be found.

Parameters:
filename - The name of the file to be searched in the resources.
Returns:
InputStream for subsequent reading
Throws:
IOException

getConfigFile

public String getConfigFile()
Returns:
the configuration file for the formatter

setConfigFile

public void setConfigFile(String configFile)
Parameters:
configFile - configuration file for the formatter

afterClose

public void afterClose(org.eclipse.xpand2.output.FileHandle impl)

Specified by:
afterClose in interface org.eclipse.xpand2.output.PostProcessor