/** Final method that will construct the file on the Disk. */ public static void constructFile() { try { _file.createNewFile(); PrintWriter pw = new PrintWriter(_file); pw.println(_package); pw.println(); for (int i = 0; i < _imports.size(); i++) pw.println(_imports.get(i)); pw.println(); for (int i = 0; i < _mainComponentAccess.length; i++) pw.print(_mainComponentAccess[i] + " "); pw.print(_mainComponentType + " "); pw.print(_fileName + _whatExtends); pw.println(); pw.println("{"); for (int i = 0; i < _fileBody.size(); i++) pw.println(KeyWords.TAB + _fileBody.get(i)); for (int i = 0; i < _additionalComponents.size(); i++) { IComponent ic = _additionalComponents.get(i); for (int j = 0; j < ic.buildComponent().size(); j++) pw.println(KeyWords.TAB + ic.buildComponent().get(j)); } pw.println("}"); pw.close(); } catch (Exception e) { e.printStackTrace(); } _fileHandler.addFile( new CreatedFile( _fileName, _whatExtends, _package, _file, _imports, _fileBody, _mainComponentAccess, _mainComponentType, _additionalComponents)); clearInfo(); }
public static void addToFileHandler(IFile file) { _fileHandler.addFile(file); }