private static void compile( LanguageService languageService, List<FileDelta> fileDeltas, IProgressMonitor monitor) throws CoreException { for (FileDelta fileDelta : fileDeltas) { Delta delta = fileDelta.getDelta(); if (delta == Delta.ADDED || delta == Delta.CHANGED) { String fileName = fileDelta.getFileName(); // skip ambient declaration files if (fileName.endsWith("d.ts")) { continue; } // compile the file try { compile(fileName, languageService, monitor); } catch (RuntimeException e) { String errorMessage = "Compilation of '" + fileName + "' failed."; Status status = new Status(IStatus.ERROR, TypeScriptPlugin.ID, errorMessage, e); TypeScriptPlugin.getDefault().getLog().log(status); } } } }
private void clean(List<FileDelta> fileDeltas, IProgressMonitor monitor) throws CoreException { // clear the problem markers this.getProject().deleteMarkers(MARKER_TYPE, true, IResource.DEPTH_INFINITE); // remove the built files if compile-on-save is enabled IPreferenceStore preferenceStore = TypeScriptPlugin.getDefault().getPreferenceStore(); if (preferenceStore.getBoolean(IPreferenceConstants.COMPILER_COMPILE_ON_SAVE)) { for (FileDelta fileDelta : fileDeltas) { String fileName = fileDelta.getFileName(); ImmutableList<String> builtFiles = getBuiltFiles(fileName); for (String builtFile : builtFiles) { Path path = new Path(builtFile); IFile file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path); file.refreshLocal(IResource.DEPTH_ZERO, monitor); if (file.exists()) { file.delete(false, monitor); } } } } }