public String execute() {
String classPathXml = params.get(SzjdeConstants.PARAM_CLASSPATHXML);
String sourceFile = params.get(SzjdeConstants.PARAM_SOURCEFILE);
CompilerContext cc=getCompilerContext(classPathXml);
JDTCompiler compiler =new JDTCompiler(cc);
String[] allSrcFiles = new String[] {};
if (sourceFile.equals("All")) {
allSrcFiles = cc.getAllSourceFiles();
} else {
ClassMetaInfoManager metaInfoManager = cc.getClassMetaInfoManager();
String targetClassName=cc.buildClassName(sourceFile);
Set<String> dependentClasses = metaInfoManager.getDependentClasses(targetClassName);
List<String> srcFileList = new ArrayList<String>();
for (String depClass : dependentClasses ) {
String rtlPathName = depClass.replace(".", "/") + ".java";
String sourcePath = cc.findSourceFileInSrcPath(rtlPathName);
if (sourcePath != null ) {
srcFileList.add(sourcePath);
}
}
if (!srcFileList.contains(sourceFile)) {
srcFileList.add(sourceFile);
}
allSrcFiles = srcFileList.toArray(new String[]{});
}
CompileResultInfo resultInfo =compiler.generateClass(allSrcFiles);
List<String> problemList = resultInfo.getProblemInfoList();
StringBuilder sb = new StringBuilder();
for (String srcFile : allSrcFiles) {
sb.append(srcFile).append("\n");
}