tico.editor
Class TProjectHandler

java.lang.Object
  extended by tico.editor.TProjectHandler

public class TProjectHandler
extends java.lang.Object

Static class that manages the current editing project files.

Version:
1.0 Nov 20, 2006
Author:
Pablo Muñoz

Constructor Summary
TProjectHandler()
           
 
Method Summary
static void cleanTempDirectory()
          Deletes all the current temporal directory contents.
static void copyCurrentToTemp(java.lang.String[] partialPaths)
          Copies a list of files from the current directory to the temporal directory.
static void deleteTempDirectory()
          Deletes the current temporal directory and all its contents.
static java.io.File getTempDirectory()
          Returns the current temporal directory.
static java.lang.String getTempDirectoryPath()
          Returns the current temporal directory path.
static TBoard loadBoard(java.io.File zipFile)
          Creates a board using the information contained in a zipFile.
static TProject loadProject(java.io.File zipFile)
          Creates an editor project using the information contained in a zipFile.
static TInterpreterProject loadProjectInterpreter(java.io.File zipFile)
          Creates an interpreter project using the information contained in a zipFile.
static void loadZip(java.io.File zipFile)
          Loads the current temporal directory with the contents of the specified zipFile.
static void saveBoard(TBoard board, java.io.File zipFile)
          Saves the specified board to the specified zipFile.
static void saveProject(TProject project, java.io.File zipFile)
          Saves the specified project to the specified zipFile.
static void saveZip(java.io.File zipFile)
          Stores the current termporal directory in the specified zipFile.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TProjectHandler

public TProjectHandler()
Method Detail

getTempDirectory

public static java.io.File getTempDirectory()
Returns the current temporal directory.

Returns:
The current temporal directory

getTempDirectoryPath

public static java.lang.String getTempDirectoryPath()
Returns the current temporal directory path.

Returns:
The current temporal directory path

deleteTempDirectory

public static void deleteTempDirectory()
Deletes the current temporal directory and all its contents.


cleanTempDirectory

public static void cleanTempDirectory()
Deletes all the current temporal directory contents.


copyCurrentToTemp

public static void copyCurrentToTemp(java.lang.String[] partialPaths)
                              throws java.io.IOException
Copies a list of files from the current directory to the temporal directory.

Parameters:
partialPaths - The list of files
Throws:
java.io.IOException - If there is any problem copying the files

saveZip

public static void saveZip(java.io.File zipFile)
                    throws java.io.IOException
Stores the current termporal directory in the specified zipFile.

Parameters:
zipFile - The specified zipFile
Throws:
java.io.IOException - If there is any problem with the zipFile

loadZip

public static void loadZip(java.io.File zipFile)
                    throws java.io.IOException
Loads the current temporal directory with the contents of the specified zipFile.

Parameters:
zipFile - The specified zipFile
Throws:
java.io.IOException - If there is any problem with the zipFile

saveProject

public static void saveProject(TProject project,
                               java.io.File zipFile)
                        throws javax.xml.parsers.ParserConfigurationException,
                               java.io.IOException,
                               javax.xml.transform.TransformerException
Saves the specified project to the specified zipFile.

Parameters:
project - The project to save
zipFile - The target zipFile
Throws:
javax.xml.parsers.ParserConfigurationException - If there are syntactic error in the XML document
java.io.IOException - If there are file problems with the zipFile
javax.xml.transform.TransformerException - If there are problems transforming the XML document to text

saveBoard

public static void saveBoard(TBoard board,
                             java.io.File zipFile)
                      throws javax.xml.parsers.ParserConfigurationException,
                             java.io.IOException,
                             javax.xml.transform.TransformerException
Saves the specified board to the specified zipFile.

Parameters:
board - The board to save
zipFile - The target zipFile
Throws:
javax.xml.parsers.ParserConfigurationException - If there are syntactic error in the XML document
java.io.IOException - If there are file problems with the zipFile
javax.xml.transform.TransformerException - If there are problems transforming the XML document to text

loadProject

public static TProject loadProject(java.io.File zipFile)
                            throws java.io.IOException,
                                   javax.xml.parsers.ParserConfigurationException,
                                   InvalidFormatException,
                                   org.xml.sax.SAXException
Creates an editor project using the information contained in a zipFile.

Parameters:
zipFile - The source zipFile
Returns:
The created project
Throws:
java.io.IOException - If there are file problems with the zipFile
javax.xml.parsers.ParserConfigurationException - If there are syntactic error in the XML document
InvalidFormatException - If the XML document has an invalid format
org.xml.sax.SAXException - If there are problems transforming the text to a XML document

loadProjectInterpreter

public static TInterpreterProject loadProjectInterpreter(java.io.File zipFile)
                                                  throws java.io.IOException,
                                                         javax.xml.parsers.ParserConfigurationException,
                                                         InvalidFormatException,
                                                         org.xml.sax.SAXException
Creates an interpreter project using the information contained in a zipFile.

Parameters:
zipFile - The source zipFile
Returns:
The created project
Throws:
java.io.IOException - If there are file problems with the zipFile
javax.xml.parsers.ParserConfigurationException - If there are syntactic error in the XML document
InvalidFormatException - If the XML document has an invalid format
org.xml.sax.SAXException - If there are problems transforming the text to a XML document

loadBoard

public static TBoard loadBoard(java.io.File zipFile)
                        throws javax.xml.parsers.ParserConfigurationException,
                               java.io.IOException,
                               org.xml.sax.SAXException,
                               InvalidFormatException
Creates a board using the information contained in a zipFile.

Parameters:
zipFile - The source zipFile
Returns:
The created board
Throws:
java.io.IOException - If there are file problems with the zipFile
javax.xml.parsers.ParserConfigurationException - If there are syntactic error in the XML document
InvalidFormatException - If the XML document has an invalid format
org.xml.sax.SAXException - If there are problems transforming the text to a XML document