Index: trunk/org.modelica.mdt.test/src/org/modelica/mdt/test/util/Utility.java
===================================================================
--- trunk/org.modelica.mdt.test/src/org/modelica/mdt/test/util/Utility.java	(revision 1074)
+++ trunk/org.modelica.mdt.test/src/org/modelica/mdt/test/util/Utility.java	(revision 1075)
@@ -42,7 +42,9 @@
 package org.modelica.mdt.test.util;
 
+import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.util.Collection;
 import java.util.concurrent.Semaphore;
@@ -51,7 +53,7 @@
 
 import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IWorkspace;
 import org.eclipse.core.resources.IWorkspaceDescription;
-import org.eclipse.core.resources.IWorkspaceRoot;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
@@ -60,12 +62,14 @@
 import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Widget;
 import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.IWorkbenchWizard;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.wizards.IWizardDescriptor;
+import org.eclipse.ui.wizards.IWizardRegistry;
 import org.modelica.mdt.core.IModelicaClass;
 import org.modelica.mdt.core.IModelicaElement;
-import org.modelica.mdt.core.IModelicaExtends;
 import org.modelica.mdt.core.IModelicaRoot;
 import org.modelica.mdt.core.IModelicaSourceFile;
@@ -91,45 +95,37 @@
  * This class contains some utility code for assisting the testcases
  */
-public class Utility 
-{
-
+public class Utility {
 	/**
 	 * creates and opens a wizard
-	 *  
+	 *
 	 * @param wizardID the ID of the wizard to create and open
 	 * @param selection the selection which is used to initialize the wizard
 	 */
-	public static IWorkbenchWizard openWizard(String wizardID, 
-			IStructuredSelection selection)
-	{
-		
+	public static IWorkbenchWizard openWizard(String wizardID, IStructuredSelection selection) {
 		IWorkbench workbench = PlatformUI.getWorkbench();
-		IWizardDescriptor wizDesc = 
-			workbench.getNewWizardRegistry().findWizard(wizardID);	
+		IWizardRegistry wizardRegistry = workbench.getNewWizardRegistry();
+		IWizardDescriptor wizDesc = wizardRegistry.findWizard(wizardID);
 		Assert.assertNotNull("wizard " + wizardID + " not found", wizDesc);
-		
+
 		IWorkbenchWizard wizard = null;
-		try
-		{
+		try {
 			wizard = wizDesc.createWizard();
 		}
-		catch (CoreException e)
-		{
-			Assert.fail("Could not create " + wizardID + 
+		catch (CoreException e) {
+			Assert.fail("Could not create " + wizardID +
 					" wizard, CoreException thrown\n" + e.getMessage());
 		}
 		Assert.assertNotNull(wizard);
-		
+
 		wizard.init(workbench, selection);
-		final WizardDialog dialog = 
-			new WizardDialog(workbench.getActiveWorkbenchWindow().getShell(), wizard);
+		IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
+		Shell shell = activeWorkbenchWindow.getShell();
+		final WizardDialog dialog = new WizardDialog(shell, wizard);
 		dialog.create();
 
 		final Semaphore sem = new Semaphore(0);
-		
-		dialog.getShell().getDisplay().syncExec(new Runnable()
-		{
-			public void run()
-			{
+
+		dialog.getShell().getDisplay().syncExec(new Runnable() {
+			public void run() {
 				dialog.setBlockOnOpen(false);
 				dialog.open();
@@ -137,68 +133,59 @@
 			}
 		});
-		
-		try
-		{
+
+		try {
 			sem.acquire();
-		} 
-		catch (InterruptedException e)
-		{
+		}
+		catch (InterruptedException e) {
 			Assert.fail("interruped while waiting for dialog to open");
 		}
-		
+
 		return wizard;
 	}
+
 	/**
 	 * creates and opens a wizard initialized with empty selection
-	 *  
+	 *
 	 * @param wizardID the ID of the wizard to create and open
 	 */
-	public static IWorkbenchWizard openWizard(String wizardID)
-	{
+	public static IWorkbenchWizard openWizard(String wizardID) {
 		return openWizard(wizardID, StructuredSelection.EMPTY);
 	}
-	
-	/**
-	 * 
+
+	/**
+	 *
 	 * @return currently displayed button with text '&Finish'
 	 * this function will fail if not exactly one finish button is
 	 * on the screen
 	 */
-	public static Button findButtonByText(String buttonText)
-	{
+	public static Button findButtonByText(String buttonText) {
 		BasicFinder finder =  /* find finish button */
-			new BasicFinder(new TestHierarchy(PlatformUI.getWorkbench().getDisplay()));
-
-		try
-		{
+				new BasicFinder(new TestHierarchy(PlatformUI.getWorkbench().getDisplay()));
+
+		try {
 			return (Button) finder.find(new TextMatcher(buttonText));
 		}
-		catch (WidgetNotFoundException e)
-		{
+		catch (WidgetNotFoundException e) {
 			Assert.fail("Finish button not found.");
-		} 
-		catch (MultipleWidgetsFoundException e) 
-		{
+		}
+		catch (MultipleWidgetsFoundException e) {
 			Assert.fail("Multiple finish buttons found.");
 		}
-		
+
 		Assert.fail("this is not happening");
 		return null;
 	}
+
 	/*
-	 * sleeps for approx time seconds
-	 * this method does not garantee that it will sleep any particular time
-	 */
-	public static void sleep(Object mutex, long time)
-	{
-		try 
-		{
-			synchronized (mutex)
-			{
+	 * sleeps for approximately time seconds
+	 * this method does not guarantee that it will sleep any particular time
+	 */
+	public static void sleep(Object mutex, long time) {
+		try {
+			synchronized (mutex) {
 				mutex.wait(time);
 			}
-		} 
-		catch (InterruptedException e)
-		{
+		}
+		catch (InterruptedException e) {
 			e.printStackTrace();
 		}
@@ -208,15 +195,13 @@
 	 * Tries to find a project by name, this method fails (Assert.fail)
 	 * if a modelica project by that name is not found. This method also
-	 *  fails if any exception is thrown while searching for the project.
-	 * 
+	 * fails if any exception is thrown while searching for the project.
+	 *
 	 * @param name name of the project to find
 	 * @return the modelica project handle named name
 	 */
-	public static IModelicaProject getProject(String name)
-	{
+	public static IModelicaProject getProject(String name) {
 		for (Object proj : ModelicaCore.getModelicaRoot().getProjects())
 		{
-			if (proj instanceof IModelicaProject)
-			{
+			if (proj instanceof IModelicaProject) {
 				if (((IModelicaProject)proj).getElementName().equals(name))
 				{
@@ -225,11 +210,10 @@
 			}
 		}
-		
+
 		Assert.fail("No modelica project named '" + name + "' found.");
 		return null; /* this is not happening */
 	}
-	
-	public static Widget getInstrumentedWidget(final String tag)
-	{
+
+	public static Widget getInstrumentedWidget(final String tag) {
 		/*
 		 * find classType combo by tag
@@ -238,129 +222,138 @@
 		BasicFinder finder = new BasicFinder(new TestHierarchy
 				(PlatformUI.getWorkbench().getDisplay()));
-		
-		try 
-		{			
-			widget = finder.find(new Matcher()
-			{
-				public boolean matches(Widget w) 
-			    {
+
+		try {
+			widget = finder.find(new Matcher() {
+				public boolean matches(Widget w) {
 					Object widgetTag = w.getData("name");
 
-			        if (widgetTag == null || !(widgetTag instanceof String))
-			        {
-			        	return false;
-			        }
-			        return ((String)widgetTag).equals(tag);
-			    }
-			                
+					if (widgetTag == null || !(widgetTag instanceof String)) {
+						return false;
+					}
+					return ((String)widgetTag).equals(tag);
+				}
 			});
-			
+
 			return widget;
-		} 
-		catch (WidgetNotFoundException e) 
-		{
+		}
+		catch (WidgetNotFoundException e) {
 			/* fall through */
-		} 
-		catch (MultipleWidgetsFoundException e) 
-		{
+		}
+		catch (MultipleWidgetsFoundException e) {
 			/* fall through */
 		}
-		
+
 		/* exception thrown, no/more than one widgets found */
 		return null;
 	}
-	
+
+	public static void printFile(IProject project, String fileName) {
+		IFile file = project.getFile(fileName);
+		try {
+			InputStream is = file.getContents();
+			InputStreamReader isr = new InputStreamReader(is);
+			BufferedReader br = new BufferedReader(isr);
+
+			String total = "";
+			String line;
+
+			while ((line = br.readLine()) != null) {
+				total += line + "\n";
+			}
+
+			System.out.println(total);
+		}
+		catch (CoreException e) {
+			e.printStackTrace();
+		}
+		catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+
+	public static void printFile(IModelicaProject modelicaProject, String fileName) {
+		IProject project = modelicaProject.getWrappedProject();
+		printFile(project, fileName);
+	}
+
 	/**
 	 * Compares the content of a file with a provided string
 	 * @param file
 	 * @param expectedContent
-	 * @return true if file's content exactly matches the expectedContent 
+	 * @return true if file's content exactly matches the expectedContent
 	 * string
 	 */
-	public static boolean compareContent(IFile file, String expectedContent)
-	{
+	public static boolean compareContent(IFile file, String expectedContent) {
 		InputStream fileContent = null;
-		
-		try
-		{
+
+		try {
 			fileContent = file.getContents();
 		}
-		catch (CoreException e) 
-		{
+		catch (CoreException e) {
 			Assert.fail("could not fetch contents of the created class");
 		}
 
 		byte[] buf = new byte[expectedContent.length()];
-		
-		try
-		{
+
+		try {
 			fileContent.read(buf);
 			int i = fileContent.read();
 
-			if (-1 != i)
-			{
+			if (-1 != i) {
 				Assert.fail("file is to longer than expected");
 			}
 		}
-		catch (IOException e)
-		{
+		catch (IOException e) {
 			Assert.fail("could not read contents of the file");
 		}
+
 		return expectedContent.equals(new String(buf));
 	}
-	
-	/**
-	 * convinience method to 'convert' a string into a InputStream.
-	 * 
+
+	/**
+	 * convenience method to 'convert' a string into a InputStream.
+	 *
 	 * @return an input stream that have the same content as the provided string
 	 */
-	public static InputStream getByteStream(String content) 
-	{
+	public static InputStream getByteStream(String content) {
 		return new ByteArrayInputStream(content.getBytes());
 	}
-	
-	/**
-	 * Convinience method to find a modelica file in a modelica folder.
-	 * If the file is not found, then this method will fail 
-	 * (e.g. call Assert.fail()) the invocing test. 
-	 * 
+
+	/**
+	 * Convenience method to find a modelica file in a modelica folder.
+	 * If the file is not found, then this method will fail
+	 * (e.g. call Assert.fail()) the invoking test.
+	 *
 	 * @param folder the folder where to look
 	 * @param fileName the name of the file to look for
-	 * 
-	 * @return the modelica file found 
-	 * @throws CoreException 
-	 * @throws InvocationError 
-	 * @throws UnexpectedReplyException 
-	 * @throws ConnectException 
-	 * @throws CompilerInstantiationException 
-	 */
-	public static IModelicaSourceFile findModelicaFileInFolder(IModelicaFolder folder, 
-			String fileName) 
-	throws ConnectException, UnexpectedReplyException, 
-		InvocationError, CoreException, CompilerInstantiationException 
-	{
-		for (Object child : folder.getChildren())
-		{
-				if (child instanceof IModelicaSourceFile)
-				{
-					IModelicaSourceFile f = (IModelicaSourceFile) child;
-					if (f.getElementName().equals(fileName))
-					{
-						return f;
-					}
+	 *
+	 * @return the modelica file found
+	 * @throws CoreException
+	 * @throws InvocationError
+	 * @throws UnexpectedReplyException
+	 * @throws ConnectException
+	 * @throws CompilerInstantiationException
+	 */
+	public static IModelicaSourceFile findModelicaFileInFolder(IModelicaFolder folder, String fileName)
+			throws ConnectException, UnexpectedReplyException, InvocationError, CoreException, CompilerInstantiationException {
+		for (Object child : folder.getChildren()) {
+			if (child instanceof IModelicaSourceFile) {
+				IModelicaSourceFile f = (IModelicaSourceFile)child;
+				if (f.getElementName().equals(fileName)) {
+					return f;
 				}
-		}
-		
-		Assert.fail("No modelica file named '" + fileName + 
-				"' found in folder '" + folder.getElementName() + "'");  
+			}
+		}
+
+		Assert.fail("No modelica file named '" + fileName +
+				"' found in folder '" + folder.getElementName() + "'");
 		return null; /* this is not happening */
-
 	}
 
 	public static boolean isAutoBuilding() {
 		IWorkspace workspace = ResourcesPlugin.getWorkspace();
-		
+
 		boolean isAutoBuilding = workspace.isAutoBuilding();
-		
+
 		return isAutoBuilding;
 	}
@@ -368,7 +361,7 @@
 	public static void setAutobuilding(boolean autoBuilding) {
 		IWorkspace workspace = ResourcesPlugin.getWorkspace();
-		
+
 		IWorkspaceDescription workspaceDescription = workspace.getDescription();
-		
+
 		workspaceDescription.setAutoBuilding(autoBuilding);
 	}
@@ -376,20 +369,20 @@
 	public static void listAllProjects() {
 		IModelicaRoot modelicaRoot = ModelicaCore.getModelicaRoot();
-		
+
 		IModelicaProject[] allProjects = modelicaRoot.getProjects();
-		
+
 		for (IModelicaProject modelicaProject : allProjects) {
 			String name = modelicaProject.getElementName();
-			
+
 			System.out.println(name);
 		}
 	}
-	
+
 	public static void goThroughStdlib(Collection<? extends IModelicaElement> aList) {
 		if (aList == null) {
 			IModelicaRoot modelicaRoot = ModelicaCore.getModelicaRoot();
-			
+
 			IStandardLibrary stdlib = modelicaRoot.getStandardLibrary(null);
-			
+
 			try {
 				aList = stdlib.getPackages();
@@ -408,9 +401,9 @@
 					IModelicaClass cls = (IModelicaClass)elem;
 					String name = cls.getFullName();
-					
+
 					System.out.println("Considering " + name);
-					
+
 					boolean isEncapsulated = cls.isEncapsulated();
-					
+
 					if (isEncapsulated) {
 						System.out.println(name + " is indeed encapsulated!");
@@ -419,7 +412,7 @@
 						//System.out.println(pkg.getFullName() + " is not encapsulated.");
 					}
-					
+
 					Collection<? extends IModelicaElement> children = cls.getChildren();
-					
+
 					if (children != null) {
 						goThroughStdlib(children);
