package authoring_environment.Event;

import java.io.File;
import java.util.ArrayList;
import java.util.Enumeration;

public class ClassesInPackage {
	public ArrayList<String> getAllClasses(String pckgname) {
		ArrayList<String> classNames = new ArrayList<String>();
		try{
			ArrayList classes=new ArrayList(); 
			// Get a File object for the package 
			File directory=null; 
			try { 
				directory=new File(Thread.currentThread().getContextClassLoader().getResource(pckgname.replace('.', '/')).getFile()); 
			} catch(NullPointerException x) { 
				System.out.println("Nullpointer");
				throw new ClassNotFoundException(pckgname+" does not appear to be a valid package"); 
			} 
			if(directory.exists()) { 
				// Get the list of the files contained in the package 
				String[] files=directory.list(); 
				for(int i=0; i<files.length; i++) { 
					// we are only interested in .class files 
					if(files[i].endsWith(".class")) { 
						// removes the .class extension 
						classes.add(Class.forName(pckgname+'.'+files[i].substring(0, files[i].length()-6))); 
					} 
				} 
			} else { 
				System.out.println("Directory does not exist");
				throw new ClassNotFoundException(pckgname+" does not appear to be a valid package"); 
			} 
			Class[] classesA=new Class[classes.size()]; 
			classes.toArray(classesA); 
			for (Class c:classesA) {
				classNames.add(c.getName().substring(pckgname.length()+1));
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
		return classNames;
	}
}

@@ -300,25 +300,24 @@
 ArrayList();
- 
 %0A%09%09%09// Get a
@@ -340,25 +340,24 @@
  the package
- 
 %0A%09%09%09File dir
@@ -368,17 +368,16 @@
 ry=null;
- 
 %0A%09%09%09try 
@@ -377,17 +377,16 @@
 %09%09%09try %7B
- 
 %0A%09%09%09%09dir
@@ -499,17 +499,16 @@
 File());
- 
 %0A%09%09%09%7D ca
@@ -536,17 +536,16 @@
 ion x) %7B
- 
 %0A%09%09%09%09Sys
@@ -660,31 +660,29 @@
 d package%22);
- 
 %0A%09%09%09%7D
- 
 %0A%09%09%09if(direc
@@ -693,25 +693,24 @@
 .exists()) %7B
- 
 %0A%09%09%09%09// Get 
@@ -755,17 +755,16 @@
  package
- 
 %0A%09%09%09%09Str
@@ -792,17 +792,16 @@
 .list();
- 
 %0A%09%09%09%09for
@@ -832,17 +832,16 @@
 ; i++) %7B
- 
 %0A%09%09%09%09%09//
@@ -879,17 +879,16 @@
 ss files
- 
 %0A%09%09%09%09%09if
@@ -918,17 +918,16 @@
 ass%22)) %7B
- 
 %0A%09%09%09%09%09%09/
@@ -956,17 +956,16 @@
 xtension
- 
 %0A%09%09%09%09%09%09c
@@ -1051,24 +1051,21 @@
 )));
- 
 %0A%09%09%09%09%09%7D
- 
 %0A%09%09%09%09%7D
- 
 %0A%09%09%09
@@ -1072,17 +1072,16 @@
 %7D else %7B
- 
 %0A%09%09%09%09Sys
@@ -1217,15 +1217,13 @@
 e%22);
- 
 %0A%09%09%09%7D
- 
 %0A%09%09%09
@@ -1265,17 +1265,16 @@
 size()%5D;
- 
 %0A%09%09%09clas
@@ -1295,17 +1295,16 @@
 assesA);
- 
 %0A%09%09%09for 
@@ -1332,23 +1332,22 @@
 %09%09%09%09
-classNames.add(
+String name = 
 c.ge
@@ -1384,16 +1384,230 @@
 gth()+1)
+;%0A%09%09%09%09String nameToAdd = %22%22;%0A%09%09%09%09for(int i=0;i%3Cname.length();i++)%7B%0A%09%09%09%09%09if(Character.isUpperCase(name.charAt(i)))%7B%0A%09%09%09%09%09%09nameToAdd += %22 %22;%0A%09%09%09%09%09%7D%0A%09%09%09%09%09nameToAdd += name.charAt(i);%0A%09%09%09%09%7D%0A%09%09%09%09classNames.add(nameToAdd
 );%0A%09%09%09%7D%0A

add spaces to dynamic event names