package com.cast.mocker;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

import logger.MyLogger;

public class CMockSources {

	private final static Logger logger = MyLogger.getLogger();
	
	public CMockSources() {
		// TODO Auto-generated constructor stub
	}

	public static void main(String[] args) {
		
		// Initialise Logger
		try {
			MyLogger.setup();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		// get list of Files in Passed Folder
		
		// Set includePaths
		String[] includePaths = new String[1];
		includePaths[0] = "docs/sample001";
		
		//
		List<String> results = new ArrayList<String>();
		File[] files = new File("docs/sample001").listFiles();
		//If this pathname does not denote a directory, then listFiles() returns null. 
		for (File file : files) {
		    if (file.isFile()) {
		        file.getAbsolutePath();
		        // Mock only C-Files
		        if(file.getName().endsWith(".c")) {
		        	results.add(file.getName());
		        	// Create Mock Prepressor
		        	CMockerCreator MyCMocker = new CMockerCreator();
		        	MyCMocker.CreateMockPrepressor(file.getAbsolutePath(), includePaths);
		        }
		        
		    }
		}
	}

}

@@ -157,24 +157,110 @@
 .Logger;%0D%0A%0D%0A
+import javax.swing.JFileChooser;%0D%0A%0D%0Aimport org.eclipse.core.runtime.CoreException;%0D%0A%0D%0A
 import logge
@@ -436,24 +436,26 @@
 tor stub
+%09%09
 %0D%0A%09%7D%0D%0A%0D%0A
 %09public 
@@ -446,16 +446,900 @@
 %0D%0A%09%7D%0D%0A%0D%0A
+    /**%0D%0A    * Mock Files in Passed Folder%0D%0A    * @return boolean flag as an indication of successful operation%0D%0A    * @param%09Files%09Folder    %0D%0A    * @param %09includePaths%09include paths to be scanned with the source file%0D%0A    * @throws CoreException%0D%0A    */%09%0D%0A%09public List%3CString%3E MockFiles(String folderpath, String%5B%5D includePaths) %7B%0D%0A%09%09%0D%0A%09%09// List of mocked-files%0D%0A%09%09List%3CString%3E results = new ArrayList%3CString%3E();%0D%0A%09%09File%5B%5D files = new File(folderpath).listFiles();%0D%0A%09%09%0D%0A%09%09for (File file : files) %7B%0D%0A%09%09    if (file.isFile()) %7B%0D%0A%09%09        // Mock only C-Files%0D%0A%09%09        if(file.getName().endsWith(%22.c%22)) %7B%0D%0A%09%09        %09results.add(file.getName());%0D%0A%09%09        %09// Create Mock Prepressor%0D%0A%09%09        %09CMockerCreator MyCMocker = new CMockerCreator();%0D%0A%09%09        %09MyCMocker.CreateMockPrepressor(file.getAbsolutePath(), includePaths);%0D%0A%09%09        %7D%0D%0A%09%09    %7D%0D%0A%09%09%7D%0D%0A%09%09return results;%0D%0A%09%7D%0D%0A%09%0D%0A
 %09public 
@@ -1369,26 +1369,24 @@
 %5B%5D args) %7B%0D%0A
-%09%09
 %0D%0A%09%09// Initi
@@ -1526,18 +1526,16 @@
 ();%0D%0A%09%09%7D
-%0D%0A
 %09%09%0D%0A%09%09//
@@ -1571,16 +1571,57 @@
 Folder%0D%0A
+%09%09String folderpath = %22docs/sample001%22;%0D%0A
 %09%09%0D%0A%09%09//
@@ -1724,20 +1724,16 @@
 %22;%0D%0A
-%09%09%0D%0A
 %09%09//%0D%0A%09%09
 List
@@ -1732,573 +1732,95 @@
 %0D%0A%09%09
-List%3CString%3E results = new ArrayList%3CString%3E();%0D%0A%09%09File%5B%5D files = new File(%22docs/sample001%22).listFiles();%0D%0A%09%09//If this pathname does not denote a directory, then listFiles() returns null. %0D%0A%09%09for (File file : files) %7B%0D%0A%09%09    if (file.isFile()) %7B%0D%0A%09%09        file.getAbsolutePath();%0D%0A%09%09        // Mock only C-Files%0D%0A%09%09        if(file.getName().endsWith(%22.c%22)) %7B%0D%0A%09%09        %09results.add(file.getName());%0D%0A%09%09        %09// Create Mock Prepressor%0D%0A%09%09        %09CMockerCreator MyCMocker = new CMockerCreator();%0D%0A%09%09        %09MyCMocker.CreateMockPrepressor(file.getAbsoluteP
+CMockSources cm = new CMockSources();%0D%0A%09%09List%3CString%3E results = cm.MockFiles(folderp
 ath
-()
 , in
@@ -1837,47 +1837,8 @@
 );%0D%0A
-%09%09        %7D%0D%0A%09%09        %0D%0A%09%09    %7D%0D%0A%09%09%7D%0D%0A
 %09%7D%0D%0A

Update CMockSources.java