1 package org.andromda.core.common;
2
3 import de.plushnikov.doctorjim.ImportProcessor;
4 import de.plushnikov.doctorjim.javaparser.ParseException;
5 import java.io.File;
6 import org.apache.log4j.Logger;
7
8
9
10
11
12 public class ImportBeautifierPostProcessorImpl implements PostProcessor
13 {
14
15 private static final Logger LOGGER = Logger.getLogger(ImportBeautifierPostProcessorImpl.class);
16
17
18
19
20
21
22 public boolean acceptFile(File pFile)
23 {
24 return null!=pFile && pFile.getName().endsWith(".java");
25 }
26
27
28
29
30
31
32
33
34 public String postProcess(String pSource, String pPreviousData) throws Exception
35 {
36 try
37 {
38 return new ImportProcessor().organizeImports(pSource);
39 }
40 catch (ParseException ex)
41 {
42 LOGGER.debug("Error PostProcessing ", ex);
43 throw ex;
44 }
45 }
46 }