| package org.eclipse.app4mc.slg.config.util; |
| |
| import java.io.File; |
| import java.util.ArrayList; |
| import java.util.List; |
| |
| import org.eclipse.app4mc.slg.config.CodeHooks; |
| import org.eclipse.app4mc.slg.config.CodehookType; |
| import org.eclipse.app4mc.slg.config.ConfigModel; |
| import org.eclipse.app4mc.slg.config.HeaderFiles; |
| |
| public class ConfigModelUtils { |
| |
| public static List<String> getHeaderFilesDirectories(ConfigModel configModel, CodehookType codehookType) { |
| |
| List<String> ls = new ArrayList<String>(); |
| |
| CodeHooks codeHooks = configModel.getCodeHooks(); |
| if (codeHooks != null) { |
| for (HeaderFiles headerFile : codeHooks.getHeaderFiles()) { |
| if (headerFile.getCodehookType().getName().equals(codehookType.getName())) |
| { |
| for (String hfileDir : headerFile.getHeaderFilesDirectories()) { |
| ls.add(hfileDir); |
| } |
| |
| } |
| return ls; |
| } |
| |
| } |
| |
| return ls; |
| } |
| |
| public static String getHeaderFilesIncludeMultiString(File folder,StringBuffer sb) { |
| |
| if(folder.exists()&&folder.isDirectory()) { |
| |
| for ( File fileEntry : folder.listFiles()) { |
| if (!fileEntry.isDirectory()) { |
| if (fileEntry.getName().endsWith(".h")) |
| { |
| sb.append("#include \""); |
| sb.append(fileEntry.getName()); |
| sb.append('\"'); |
| sb.append(System.getProperty("line.separator")); |
| } |
| |
| } |
| } |
| }else { |
| System.err.println("Input header folder doesnot exist/it is not a directory : "+folder.getPath() ); |
| } |
| |
| return sb.toString(); |
| |
| } |
| } |