Index: trunk/modelicaml/org.openmodelica.modelicaml.modelica.importer/META-INF/MANIFEST.MF
===================================================================
--- trunk/modelicaml/org.openmodelica.modelicaml.modelica.importer/META-INF/MANIFEST.MF	(revision 1478)
+++ trunk/modelicaml/org.openmodelica.modelicaml.modelica.importer/META-INF/MANIFEST.MF	(revision 1479)
@@ -15,5 +15,7 @@
  org.eclipse.core.filesystem;bundle-version="1.3.1",
  org.eclipse.papyrus.umlutils;bundle-version="0.7.4",
- org.eclipse.papyrus.service.edit;bundle-version="0.7.4"
+ org.eclipse.papyrus.service.edit;bundle-version="0.7.4",
+ org.modelica.mdt.omc;bundle-version="0.7.23",
+ org.modelica.mdt.core;bundle-version="0.7.23"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ActivationPolicy: lazy
Index: trunk/modelicaml/org.openmodelica.modelicaml.modelica.importer/src/org/openmodelica/modelicaml/modelica/importer/model/OpenModelicaCompilerCommunication.java
===================================================================
--- trunk/modelicaml/org.openmodelica.modelicaml.modelica.importer/src/org/openmodelica/modelicaml/modelica/importer/model/OpenModelicaCompilerCommunication.java	(revision 1478)
+++ trunk/modelicaml/org.openmodelica.modelicaml.modelica.importer/src/org/openmodelica/modelicaml/modelica/importer/model/OpenModelicaCompilerCommunication.java	(revision 1479)
@@ -3,9 +3,8 @@
 import java.util.ArrayList;
 import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
+
+import org.modelica.mdt.core.ICompilerResult;
+import org.modelica.mdt.omc.OMCProxy;
 import org.openmodelica.modelicaml.modelica.importer.helper.StringHandler;
-import org.openmodelica.modelicaml.modelica.importer.omc.corba.OMCProxy;
 
 
@@ -16,5 +15,5 @@
 	
 	public OpenModelicaCompilerCommunication(){
-		super();
+//		super();
 		this.omc = new OMCProxy();
 		history = new ArrayList<String>();
@@ -68,24 +67,36 @@
 	 */
 	private String executeCommand(String command) {
-//		System.err.println("Expression:" + command);
-
-		/**
-		 * Reply from OMC
-		 */
-		String reply = "no reply";
-
+		// initial reply (negative)
+		String replyString = "Error: No reply from OMC ...";
+		
 		if (command != null && command.length() > 0) {
 			history.add(command);
+			
 			try {
-				reply = omc.sendExpression(command);
+				ICompilerResult reply = omc.sendExpression(command, true);
+
+				// find the next not empty positive result. 
+				replyString = "";
+				String[] results = reply.getResult();
+				for (String string : results) {
+					if (string.trim().length() > 0) {
+						if (replyString.equals("")) {
+							replyString = string;		
+						}
+					}
+				}
+				
+				// catch the error string
+				String errorString = reply.getError(); 
+				if (errorString != null && errorString.trim().length() > 0) {
+					replyString = errorString.trim();
+				}
+				
 			} catch (Exception ex) {
-				reply = "\nError while sending expression: " + command + "\n"
-						+ ex.getMessage();
-			}
-		} else {
-			reply = ("\nNo expression sent because is empty");
-		}
-
-		return reply;
+				replyString = "\nError while sending expression: " + command + "\n" + ex.getMessage();
+			}
+		}
+
+		return replyString;
 	}
 	
@@ -244,18 +255,10 @@
 	
 	
-	/**
-	 * Leave OpenModelica and kill the process.
-	 * 
-	 * @return Reply from OMC
-	 */
+
 	public String quit() {
 		return executeCommand("quit()");
 	}
-	
-	/**
-	 * Get a possible error String from omc after executing a command.
-	 *
-	 * @return error string as reply from omc
-	 */
+
+	
 	public String getErrorString(){
 		return executeCommand("getErrorString()");
@@ -310,8 +313,4 @@
 	}
 	
-//	public String getInheritanceCount(String className){
-//		return executeCommand("getInheritanceCount(" + className + ")");
-//	}
-	
 	public String getNthInheritedClass(String className, String n){
 		return executeCommand("getNthInheritedClass(" + className+ "," + n + ")");
@@ -333,5 +332,4 @@
 		return executeCommand("getDocumentationAnnotation(" + className + ")");
 	}
-	
 	
 	
@@ -437,7 +435,4 @@
 	}
 	
-//	public String getAnnotationCount(String className){
-//		return executeCommand("getAnnotationCount(" + className + ")");
-//	}
 	
 	public Integer getAnnotationCount(String className){
@@ -499,7 +494,4 @@
 	
 	
-//	public String getInitialAlgorithmCount(String className){
-//		return executeCommand("getInitialAlgorithmCount(" + className + ")");
-//	}
 	public Integer getInitialAlgorithmCount(String className){
 		String reply = executeCommand("getInitialAlgorithmCount(" + className + ")");
@@ -527,5 +519,4 @@
 				String reply = getNthInitialAlgorithm(className, String.valueOf(i)).trim();
 				if (!reply.equals("") && !reply.equals("Error") && !reply.equals("false")) {
-//					initialAlgorithms.add(StringHandler.removeFirstLastDoubleQuotes(reply.trim()));
 					String string = StringHandler.removeFirstLastDoubleQuotes(reply.trim());
 					initialAlgorithms.add(replaceSpecChars(string));
@@ -535,9 +526,5 @@
 		return initialAlgorithms;
 	}
-	
-		
-//	public String getAlgorithmCount(String className){
-//		return executeCommand("getAlgorithmCount(" + className + ")");
-//	}
+
 	
 	public Integer getAlgorithmCount(String className){
@@ -566,5 +553,4 @@
 				String reply = getNthAlgorithm(className, String.valueOf(i)).trim();
 				if (!reply.equals("") && !reply.equals("Error") && !reply.equals("false")) {
-//					algorithms.add(StringHandler.removeFirstLastDoubleQuotes(reply.trim()));
 					String string = StringHandler.removeFirstLastDoubleQuotes(reply.trim());
 					algorithms.add(replaceSpecChars(string));
@@ -577,10 +563,4 @@
 	
 
-	
-//	public String getInitialEquationCount(String className){
-//		return executeCommand("getInitialEquationCount(" + className + ")");
-//	}
-	
-	
 	public Integer getInitialEquationCount(String className){
 		String reply = executeCommand("getInitialEquationCount(" + className + ")");
@@ -608,5 +588,4 @@
 				String reply = getNthInitialEquation(className, String.valueOf(i)).trim();
 				if (!reply.equals("") && !reply.equals("Error") && !reply.equals("false")) {
-//					initialEquations.add(StringHandler.removeFirstLastDoubleQuotes(reply.trim()));
 					String string = StringHandler.removeFirstLastDoubleQuotes(reply.trim());
 					initialEquations.add(replaceSpecChars(string));
@@ -619,9 +598,5 @@
 	
 
-		
-//	public String getEquationCount(String className){
-//		return executeCommand("getEquationCount(" + className + ")");
-//	}
-	
+
 	public Integer getEquationCount(String className){
 		String reply = executeCommand("getEquationCount(" + className + ")");
@@ -664,5 +639,4 @@
 	
 	
-	
 	/**
 	 * Gets the command history.
@@ -677,3 +651,4 @@
 		return this.history;
 	}
+	
 }
Index: trunk/modelicaml/org.openmodelica.modelicaml.modelica.importer/src/org/openmodelica/modelicaml/modelica/importer/model/TreeBuilder.java
===================================================================
--- trunk/modelicaml/org.openmodelica.modelicaml.modelica.importer/src/org/openmodelica/modelicaml/modelica/importer/model/TreeBuilder.java	(revision 1478)
+++ trunk/modelicaml/org.openmodelica.modelicaml.modelica.importer/src/org/openmodelica/modelicaml/modelica/importer/model/TreeBuilder.java	(revision 1479)
@@ -44,7 +44,4 @@
 import java.util.regex.Pattern;
 
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.filesystem.IFileSystem;
 import org.eclipse.core.resources.IMarker;
 import org.eclipse.core.resources.IProject;
@@ -76,4 +73,5 @@
 import org.eclipse.uml2.uml.Property;
 import org.openmodelica.modelicaml.common.constants.Constants;
+import org.openmodelica.modelicaml.common.services.ModelicaMLServices;
 import org.openmodelica.modelicaml.common.services.StringUtls;
 import org.openmodelica.modelicaml.modelica.importer.helper.ModelicaModelProxiesCollector;
@@ -88,6 +86,5 @@
 	private EObject ModelicaMLRoot = null;
 
-	private String OMCWorkingDirectoryAbsoplutePath = null;
-	private OpenModelicaCompilerCommunication omcc = new OpenModelicaCompilerCommunication();
+	private OpenModelicaCompilerCommunication omcc;
 	
 	private HashSet<Element> proxies = new HashSet<Element>();
@@ -119,9 +116,15 @@
 	}
 
+	public TreeBuilder(){
+		// create a new omc proxy object
+		omcc = new OpenModelicaCompilerCommunication();
+	}
+	
 	public void buildTree(TreeParent treeRoot, ArrayList<String> excludeModels){
-		
-		OMCWorkingDirectoryAbsoplutePath = omcc.cd();
-		
+
 		clearAll();
+		
+//		// create a new omc proxy object
+//		omcc = new OpenModelicaCompilerCommunication();
 		
 		loadModels();
@@ -309,8 +312,4 @@
 						item.setSourceQname(classQName);
 						item.setTarget(getTypeElement(inheritedClassQName));
-//						System.err.println();
-//						System.err.println(inheritedClassQName);
-//						System.err.println("getTypeElement(inheritedClassQName): " + getTypeElement(inheritedClassQName));
-//						System.err.println(); 
 						item.setTargetQname(inheritedClassQName);
 						
@@ -587,5 +586,5 @@
 			if (parent instanceof ClassItem) {
 				String isReplaceableReply = omcc.isReplaceable(parent.getQName(), classQName);
-				if (isReplaceableReply.trim().contains("true")) {
+				if (isReplaceableReply != null && isReplaceableReply.length() > 0 && isReplaceableReply.trim().contains("true")) {
 					item.setIsReplaceable(true);
 				}
@@ -653,265 +652,4 @@
 	}
 	
-	
-	// BACKUP
-//	private void setClassProperties(ClassItem item, String classQName){
-//		/*
-//		 * 	>> getClassInformation(ModelicaMLModel.Modelica.Fluid.Utilities)
-//			<< {"package",
-//			"",
-//			"D:/__PROJECTS/2008_PhD/tools/eclipse_3_6_modeling/runtime-New_configuration/modelicaml.example.potableWaterSystem_v26_TEST/code-sync/ModelicaMLModel/../ModelicaMLModel/Modelica/Fluid/Utilities/package.mo",
-//			{false,false,false},
-//			{"writable",3,1,8,14},
-//			{}}
-//		 *	
-//		 *	Explanation: 
-//		 *		-> Restriction, 
-//		 *		-> comment,
-//		 *		-> filename,
-//		 *		-> {partial,final,encapsulated}
-//		 * 		? {"writable",3,1,8,14},
-//		 * 		? {}
-//		 */
-//		
-//		
-//		String classInfo = omcc.getClassInformation(classQName);
-//		
-//		if (!classInfo.trim().equals("") && !classInfo.equals("Error") && !classInfo.trim().equals("false") ) {
-//
-//			// set class restriction
-//			String[] splitted = classInfo.split(",");
-//			if (splitted.length > 0) {
-//				item.setClassRestriction(splitted[0].replaceAll("\\{", "").replace("\"", ""));
-//			}
-//
-//			boolean isPartial = false;
-//			boolean isFinal = false;
-//			boolean isEncapsulated = false;
-//
-//			// get the boolean items (i.e. true or false)
-//			Pattern patternBooleanItems = Pattern.compile("(true|false)");
-//			Matcher matcherBooleanItems = patternBooleanItems.matcher(classInfo);
-//			List<String> booleanItems = new ArrayList<String>();
-//			while (matcherBooleanItems.find()) {
-//				booleanItems.add(matcherBooleanItems.group());
-//			}
-//			
-//			if (booleanItems.size() > 2) {
-//				if (booleanItems.get(0).trim().equals("true")) {
-//					isPartial = true;
-//				}
-//				if (booleanItems.get(1).trim().equals("true")) {
-//					isFinal = true;
-//				}
-//				if (booleanItems.get(2).trim().equals("true")) {
-//					isEncapsulated = true;
-//				}
-//			}
-//			
-//			
-//			// set the tree item data
-//			item.setFinal(isFinal);
-//			item.setPartial(isPartial);
-//			item.setEncapsulated(isEncapsulated);
-//		}
-//		
-//		if (classInfo.equals("Error") ) {
-//			// TODO: collect errors
-//			String errorString = omcc.getErrorString();	
-//			String msg = extractErrorMessage(errorString);
-//			
-//			// generate markers
-//			createOMCMarker(item, "error", msg);
-//		}
-//	}
-	
-	//BACKUP
-//	private List<ModelicaComponentData> getComponentData(ClassItem classItem, String string, Element owningClass){
-//			
-//			/*
-//			 * 	>> getComponents(Modelica.StateGraph.Examples.Utilities.CompositeStep2)
-//				<< {{Modelica.StateGraph.Transition,
-//				transition,
-//				"", 
-//				"public", 
-//				false, 
-//				false, 
-//				false, 
-//				false, 
-//				"unspecified", 
-//				"none", 
-//				"unspecified",
-//				{}}
-//			 * 
-//			 	-	item[0] = type qualified name
-//				-	item[1] = component name
-//				-	item[2] = comment
-//				-	item[3] = visibility (public/protected)
-//				-	item[4] = Final (true/false)
-//				-	item[5] = Flow (true/false)
-//				-	item[6] = Stream (true/false)
-//				-	item[7] = Replaceable (true/false)
-//				-	item[8] = variability (constant/discrete/parameter/unspecified)
-//				-	item[9] = inner/outer/innerouter/none
-//				-	item[10] = causality (input/output/unspecified)
-//				-	item[11] = bit unsure about this value but perhaps its length of array 
-//			 */
-//			
-//			List<ModelicaComponentData> list = new ArrayList<TreeBuilder.ModelicaComponentData>();
-//			String checkString = string.replaceAll("\"", "").replaceAll("\\{", "").replaceAll("\\}", "").trim();
-//			
-//			if (!checkString.equals("Error") && !checkString.equals("false") && !checkString.equals("")) {
-//				
-//				String string2 = string.trim();
-//				// remove outter braces from the entire OMC CORBA reply
-//				if (string.trim().length() > 4 
-//						&& string.trim().substring(string.trim().length()-3, string.trim().length()).equals("}}}")) {
-//					string2 = string.trim().substring(1, string.trim().length()-1);
-//				}
-//				
-//				// get entries
-//				String[] entries = string2.split("},");
-//				if (entries.length > 0) {
-//					for (int i = 0; i < entries.length; i++) {
-//						String entry = entries[i].replaceFirst("\\{", "");
-//						
-//						String entry2 = entry.trim();
-//						// remove outter braces from the individual component items
-//						if (entry.trim().length() > 2 && entry.trim().substring(entry.trim().length()-1, entry.trim().length()).equals(",")) {
-//							entry2 = entry.trim().substring(1, entry.trim().length()-1);
-//						}
-//						
-//						// default values
-//						String comment = ""; 
-//						String visibility = "public";
-//						String variability = "unspecified";
-//						String innerouter = "none";
-//						String causality = "unspecified";
-//						
-//						Pattern patternComment = Pattern.compile("\".*\",");
-//						Matcher matcherComment = patternComment.matcher(entry2);
-//						while ( matcherComment.find() ) {
-//							comment = matcherComment.group(0);
-//						}
-//						Pattern patternVisibility = Pattern.compile("\"(public|protected)\"");
-//						Matcher matcherVisibility = patternVisibility.matcher(entry2);
-//						while (matcherVisibility.find()) {
-//							visibility = matcherVisibility.group(0).replaceAll("\"", "");
-//						}
-//						Pattern patternVariability = Pattern.compile("\"(constant|discrete|parameter)\"");
-//						Matcher matcherVariability = patternVariability.matcher(entry2);
-//						while (matcherVariability.find()) {
-//							variability = matcherVariability.group(0).trim().replaceAll("\"", "");
-//						}
-//						Pattern patternInnerouter = Pattern.compile("\"(inner|outer|innerouter)\"");
-//						Matcher matcherInnerouter = patternInnerouter.matcher(entry2);
-//						while (matcherInnerouter.find()) {
-//							innerouter = matcherInnerouter.group(0).trim().replaceAll("\"", "");
-//						}
-//						Pattern patternCausality = Pattern.compile("\"(input|output)\"");
-//						Matcher matcherCausality = patternCausality.matcher(entry2);
-//						while (matcherCausality.find()) {
-//							causality = matcherCausality.group(0).trim().replaceAll("\"", "");;
-//						}
-//						
-//						// get the boolean items (i.e. true or false)
-//						Pattern patternBooleanItems = Pattern.compile("(true|false)");
-//						Matcher matcherBooleanItems = patternBooleanItems.matcher(entry2);
-//						List<String> booleanItems = new ArrayList<String>();
-//						while (matcherBooleanItems.find()) {
-//							booleanItems.add(matcherBooleanItems.group());
-//						}
-//						// default values
-//						boolean isFinal = false;
-//						boolean isFlow = false;
-//						boolean isStream = false;
-//						boolean isReplaceable= false;
-//						
-//						if (booleanItems.size() > 3) {
-//							if (booleanItems.get(0).trim().equals("true")) {
-//								isFinal = true;
-//							}
-//							if (booleanItems.get(1).trim().equals("true")) {
-//								isFlow = true;
-//							}
-//							if (booleanItems.get(2).trim().equals("true")) {
-//								isStream = true;
-//							}
-//							if (booleanItems.get(3).trim().equals("true")) {
-//								isReplaceable = true;
-//							}
-//						}
-//						
-//						// get string items within {}
-//						Pattern patternBracesItems = Pattern.compile("\\{.*\\}");
-//						Matcher matcherBracesItems = patternBracesItems.matcher(entry2);
-//						List<String> bracesItems = new ArrayList<String>();
-//						while (matcherBracesItems.find()) {
-//							bracesItems.add(matcherBracesItems.group(0).replaceAll("\\{", "").replaceAll("\\}", ""));
-//						}
-//						// default values
-//						String arraySizeString = "";
-//						EList<String> arraySize = new BasicEList<String>();
-//						if (bracesItems.size() > 0 ) {
-//							arraySizeString = bracesItems.get(0);
-//						}
-//						String[] splittedArraySizeString = arraySizeString.trim().split(",");
-//						if (splittedArraySizeString.length > 0) {
-//							for (int j = 0; j < splittedArraySizeString.length; j++) {
-//								String arraySizeItem = splittedArraySizeString[j];
-//								if (!arraySizeItem.trim().equals("")) {
-//									arraySize.add(arraySizeItem);
-//								}
-//							}
-//						}
-//						
-//						/*
-//						 * Note: the following split code works only for the first 2 items because the 3rd (Modelica comment) 
-//						 * can also contain "," so that split(",") will not work for the rest.
-//						 */
-//						
-//						// set data
-//						String[] items = entry2.split(",");
-//						if (items.length > 2 ) {
-//							ModelicaComponentData data = new ModelicaComponentData();
-//	
-//							data.typeQName = items[0].trim();
-//	//						data.type = getTypeElement(data.typeQName, owningClass);
-//							data.type = getTypeElement(data.typeQName);
-//							data.name = items[1].trim();
-//							
-//							data.comment = comment;
-//							data.visibility = visibility;
-//							data.isFinal = isFinal;
-//							data.isFlow = isFlow;
-//							data.isStream = isStream;
-//							data.isReplaceable = isReplaceable;
-//							data.variability = variability;
-//							data.innerouter = innerouter;
-//							data.causality = causality;
-//							data.arraySize = arraySize;
-//							
-//							list.add(data);
-//							
-//	//						System.err.println("typeQName: " + data.typeQName);
-//	//						System.err.println("name: " + data.name);
-//	//						System.err.println("comment: " + data.comment);
-//	//						System.err.println("visibility: " + data.visibility);
-//	//						System.err.println("isFinal: " + data.isFinal);
-//	//						System.err.println("arraySize: " + data.arraySize);
-//						}
-//					}
-//				}
-//			}
-//			if (checkString.equals("Error")) {
-//				// TODO: collect errors
-//				String errorString = omcc.getErrorString();	
-//				String msg = extractErrorMessage(errorString);
-//	
-//				// generate markers
-//				createOMCMarker(classItem, "error", msg);
-//			}
-//			return list;
-//		}
 
 	
@@ -1024,5 +762,5 @@
 	private String getComponentDeclarationEquation(ComponentItem component, String classQName){
 		String declaration = null;
-		if (!classQName.equals("")) {
+		if (!classQName.equals("") && component != null) {
 			String declarationString = omcc.getComponentModifierValue(classQName, component.getName()).trim();
 			if (!declarationString.equals("Error") && !declarationString.equals("false") && !declarationString.equals("")) {
@@ -1118,5 +856,5 @@
 		List<String> items = new ArrayList<String>();
 		
-		if (!string.trim().equals("Error") && !string.trim().equals("false")) {
+		if (string != null && string.trim().length() > 0 && !string.trim().equals("Error") && !string.trim().equals("false")) {
 			String[] splitted = string.trim().substring(1, string.length() - 2).split(",");
 			if (splitted.length > 0 ) {
@@ -1185,7 +923,8 @@
 //		UmlModel umlModel = UmlUtils.getUmlModel();
 		UmlModel umlModel = ModelicaMLModel;
-
-//		String modelFileURI = umlModel.getResourceURI().toPlatformString(true);
-//		String modelName = umlModel.getResourceURI().lastSegment();
+		
+		// clear the omc first
+		omcc.clear();
+
 		if (umlModel != null && umlModel.getResource() != null) {
 			String projectName = umlModel.getResource().getURI().segment(1);
@@ -1197,64 +936,29 @@
 			String projectAbsolutePath = iProject.getLocationURI().toString().replaceFirst("file:\\/", "");
 			String codeIncAbsolutePath = projectAbsolutePath+"/"+Constants.folderName_code_sync + "/";
-			
-//			IFolder codeIncFlder = iProject.getFolder("code-inc/");
-			
-			IFileSystem fileSystem = EFS.getLocalFileSystem();
-			IFileStore codeIncFolder = fileSystem.getStore(java.net.URI.create(projectAbsolutePath + "/" + Constants.folderName_code_sync));
-			
-			// clear first ...
-			omcc.clear();
-			
-			// try to load .mo files
-			try {
-				String[] children = codeIncFolder.childNames(EFS.NONE, null);
-				for (int i = 0; i < children.length; i++) {
-					String child = children[i];
+
+			List<String> filesToLoad = ModelicaMLServices.getFilesToLoad(codeIncAbsolutePath);
+			for (String fileToLoad : filesToLoad) {
+				
+				String reply = "";
+				reply = omcc.loadFile(fileToLoad);
+				
+				if (reply.trim().equals("Error")) {
+					String errorString = omcc.getErrorString();	
+					String msg = extractErrorMessage(errorString);
+
+					// generate markers
+					createOMCMarker(null, "error", msg);
+				}
+				else if (reply.trim().equals("false")) {
+					String errorString = omcc.getErrorString();	
+					String msg = extractErrorMessage(errorString);
 					
-					String reply = "";
-					String filePath = "";
-					if (child.endsWith(".mo")) { // if it is a .mo file
-						filePath = codeIncAbsolutePath + child;
-						reply = omcc.loadFile(filePath);
-						/*
-						 * For ModelicaML proxy concept the first level classes must be packages with 
-						 * no inheritance no Modelica package specific properties because  
-						 * UML Model (specialization of UML Package) as root must be created 
-						 * to apply the ModelicaML profile to.  
-						 */
-					}
-					else if (!child.endsWith(".mo")) { // if it is a folder
-//						System.err.println("file: " + iProject.getFile(codeIncAbsolutePath + "/" + child + "/package.mo"));
-//						System.err.println("file does not exist: " + iProject.getFile(codeIncAbsolutePath + "/" + child + "/package.mo") == null);					iProject.get
-						filePath = codeIncAbsolutePath + child + "/package.mo";
-						reply = omcc.loadFile(filePath);
-					}
-					else { // any other files 
-						
-					}
-					
-					if (reply.trim().equals("Error")) {
-						String errorString = omcc.getErrorString();	
-						String msg = extractErrorMessage(errorString);
-
-						// generate markers
-						createOMCMarker(null, "error", msg);
-					}
-					else if (reply.trim().equals("false")) {
-						String errorString = omcc.getErrorString();	
-						String msg = extractErrorMessage(errorString);
-						
-						// generate markers
-						createOMCMarker(null, "error", msg);
-					}
-				}
-			} catch (CoreException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-				System.err.println("Cannot read the file system.");
+					// generate markers
+					createOMCMarker(null, "error", msg);
+				}
+				
 			}
 		}
 		else {
-//			MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "OMC Communication Error", "Cannot access the Papyrus UML model.");
 			System.err.println("Cannot access the Papyrus UML model");
 		}
Index: trunk/modelicaml/org.openmodelica.modelicaml.modelica.importer/src/org/openmodelica/modelicaml/modelica/importer/views/ModelicaOMCCodeViewer.java
===================================================================
--- trunk/modelicaml/org.openmodelica.modelicaml.modelica.importer/src/org/openmodelica/modelicaml/modelica/importer/views/ModelicaOMCCodeViewer.java	(revision 1478)
+++ trunk/modelicaml/org.openmodelica.modelicaml.modelica.importer/src/org/openmodelica/modelicaml/modelica/importer/views/ModelicaOMCCodeViewer.java	(revision 1479)
@@ -1414,6 +1414,7 @@
 					 * - clear compiler, load models
 					 * * TODO: check if it is safe to rely on the fact that the ModelicaML model is set or not set in the tree builder?!  
+					 * TODO: now if the root node is expanded we clear and load omc each time ... how to make it better? 
 					 */
-					if (treeBuilder.getModelicaMLModel() == null) {
+					if (treeBuilder.getModelicaMLModel() == null || obj == treeRoot) {
 						
 						// Set all project- and model-related data
Index: trunk/modelicaml/org.openmodelica.modelicaml.simulation/META-INF/MANIFEST.MF
===================================================================
--- trunk/modelicaml/org.openmodelica.modelicaml.simulation/META-INF/MANIFEST.MF	(revision 1478)
+++ trunk/modelicaml/org.openmodelica.modelicaml.simulation/META-INF/MANIFEST.MF	(revision 1479)
@@ -23,6 +23,9 @@
  org.eclipse.emf.databinding,
  org.eclipse.core.filesystem;bundle-version="1.3.1",
- org.eclipse.uml2.uml;bundle-version="3.2.100"
+ org.eclipse.uml2.uml;bundle-version="3.2.100",
+ org.modelica.mdt.core;bundle-version="0.7.23",
+ org.modelica.mdt.omc;bundle-version="0.7.23"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ActivationPolicy: lazy
 Export-Package: org.openmodelica.modelicaml.simulation.handlers
+Import-Package: org.modelica.mdt.omc
Index: trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/Activator.java
===================================================================
--- trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/Activator.java	(revision 1478)
+++ trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/Activator.java	(revision 1479)
@@ -35,5 +35,11 @@
 package org.openmodelica.modelicaml.simulation;
 
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchListener;
+import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.modelica.mdt.core.CompilerProxy;
 import org.osgi.framework.BundleContext;
 
@@ -49,5 +55,5 @@
 	// The plug-in ID
 	/** The Constant PLUGIN_ID. */
-	public static final String PLUGIN_ID = "com.eadsiw.modelicaml.simulation"; //$NON-NLS-1$
+	public static final String PLUGIN_ID = "org.openmodelica.modelicaml.simulation"; //$NON-NLS-1$
 
 	// The shared instance
@@ -61,4 +67,51 @@
 	}
 
+	
+	//TODO: does not work yet ...
+	IWorkbenchListener onExitListener = new IWorkbenchListener()
+	{
+
+		@Override
+		public void postShutdown(IWorkbench workbench) {
+			/* do nothing */
+		}
+
+		@Override
+		public boolean preShutdown(IWorkbench workbench, boolean forced) {
+			try {
+				if (!CompilerProxy.isRunning()) return true;
+			}
+			catch (Exception e) { }
+			
+			boolean choice = 
+				MessageDialog.openConfirm(
+					getShell(), 
+					"Modelica Development Tooling", 
+					"The OpenModelica compiler is running in the background.\n " +
+					"Should we stop it? If you have other clients connected choose 'Cancel'.");
+			try {
+				if (choice) CompilerProxy.sendExpression("quit()", true);
+			}
+			catch (Exception e) {
+				// TODO: handle exception
+			}
+			return true;
+		}
+	};
+	
+	
+	public static Shell getShell()
+	{
+		IWorkbench workbench = getDefault().getWorkbench();
+		IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+			
+		if (window == null)
+		{
+			return null;
+		}
+
+		return window.getShell();
+	}
+	
 	/*
 	 * (non-Javadoc)
@@ -68,4 +121,5 @@
 		super.start(context);
 		plugin = this;
+		getWorkbench().addWorkbenchListener(onExitListener);
 	}
 
@@ -77,4 +131,5 @@
 		plugin = null;
 		super.stop(context);
+		getWorkbench().removeWorkbenchListener(onExitListener);	
 	}
 
@@ -87,4 +142,14 @@
 		return plugin;
 	}
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
 	
 	/**
Index: trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/execution/ExecuteSimulation.java
===================================================================
--- trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/execution/ExecuteSimulation.java	(revision 1478)
+++ trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/execution/ExecuteSimulation.java	(revision 1479)
@@ -43,5 +43,5 @@
 		if(omcReturnString.contains("Error")){
 			String errorString = omcc.getErrorString();
-			omcc.quit();
+//			omcc.quit();
 			return "cd: " + omcReturnString + "\nErrorString: " + errorString;
 		}
@@ -55,7 +55,5 @@
 		String simulateResult = check_and_simulate(monitor, omcc, testSessionObj, omcReturnString);
 		
-		omcc.quit();
-		
-//		System.err.println("NO ERROR");
+//		omcc.quit();
 
 		omcReturnString = "\n\n" + loadResult + "\n" + simulateResult + "\n"; 
@@ -189,5 +187,5 @@
 			
 			if (monitor.isCanceled()){
-				omcc.quit();
+//				omcc.quit();
 			}
 			else {
Index: trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/handlers/CGAndSimulationOMCAction.java
===================================================================
--- trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/handlers/CGAndSimulationOMCAction.java	(revision 1478)
+++ trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/handlers/CGAndSimulationOMCAction.java	(revision 1479)
@@ -70,4 +70,5 @@
 import org.eclipse.uml2.uml.Element;
 import org.eclipse.uml2.uml.NamedElement;
+import org.modelica.mdt.core.compiler.ConnectException;
 import org.openmodelica.modelicaml.common.constants.Constants;
 import org.openmodelica.modelicaml.common.services.ModelicaMLServices;
@@ -251,5 +252,10 @@
 					filesToLoad.add(packageMoFilePath);
 					
-					new OMCCommandExecuter(modelElement, filesToLoad, modelElementDotPath, plotCommand, simPar);
+					try {
+						new OMCCommandExecuter(modelElement, filesToLoad, modelElementDotPath, plotCommand, simPar);
+					} catch (ConnectException e) {
+						// TODO Auto-generated catch block
+						e.printStackTrace();
+					}
 					
 					return Status.OK_STATUS;
Index: trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/handlers/SimulationOMCAction.java
===================================================================
--- trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/handlers/SimulationOMCAction.java	(revision 1478)
+++ trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/handlers/SimulationOMCAction.java	(revision 1479)
@@ -37,4 +37,5 @@
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
 
@@ -75,7 +76,12 @@
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Element;
 import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Class;
 import org.openmodelica.modelicaml.common.constants.Constants;
 import org.openmodelica.modelicaml.common.helpers.VerificationExecutionServices;
+import org.openmodelica.modelicaml.common.instantiation.ClassInstantiation;
+import org.openmodelica.modelicaml.common.instantiation.TreeParent;
+import org.openmodelica.modelicaml.common.instantiation.TreeUtls;
 import org.openmodelica.modelicaml.common.services.ModelicaMLServices;
 import org.openmodelica.modelicaml.common.services.PapyrusServices;
@@ -149,4 +155,37 @@
 		// open dialog for simulation settings
 		Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+		
+		// instantiate in order to see of MSL is used
+		boolean isMSLUsed = false;
+		if (umlElement instanceof Class) {
+			ClassInstantiation ci = new ClassInstantiation((Class) umlElement, true);
+			ci.createTree();
+			TreeParent treeRoot = ci.getTreeRoot();
+			HashSet<Element> allTypes = TreeUtls.getAllTreeItemsClasses(treeRoot);
+			
+			for (Element element : allTypes) {
+				if (element instanceof NamedElement) {
+					String qName = ((NamedElement)element).getQualifiedName();
+					if (qName.startsWith("Modelica::")) {
+						isMSLUsed = true;
+					}
+				}
+			}
+		}
+		
+		// get files to load in order to see if only files from code-sync folder are need so no code generation is required.
+		List<String> filesToLoad = new ArrayList<String>();
+		// First files from the code-sync, then files from code-gen
+		filesToLoad.addAll(ModelicaMLServices.getFilesToLoad(projectPath + "/" + Constants.folderName_code_sync));
+		filesToLoad.addAll(ModelicaMLServices.getFilesToLoad(projectPath + "/" + Constants.folderName_code_gen));
+		
+		boolean areFilesFromCGFolderToBeLoaded = false;
+		for (String string : filesToLoad) {
+			if (string.contains(projectPath + "/" + Constants.folderName_code_gen)) {
+				areFilesFromCGFolderToBeLoaded = true;
+			}
+		}
+
+		// open dialog with preset settings
 		DialogSimulationSettings dialog = new DialogSimulationSettings(shell, 
 				"Simulation Settings", 
@@ -158,5 +197,11 @@
 				VerificationExecutionServices.getTolerance(umlElement), 
 				VerificationExecutionServices.getOutputFormat(umlElement));
+		
+		dialog.setLoadModelicaLibChecked(isMSLUsed);
+		if (!areFilesFromCGFolderToBeLoaded) {
+			dialog.setGenerateModelicaCodeChecked(false);
+		}
 		dialog.open();
+		
 		
 		if (dialog.getReturnCode() == IDialogConstants.OK_ID) { // OK button clicked
@@ -190,5 +235,5 @@
 					
 					String omcTempDirectory = ExecuteSimulation.getTempDirectoryPath();
-					String modelQName = StringUtls.replaceSpecCharExceptThis(umlElement.getQualifiedName(), "::");
+					String modelQName = StringUtls.replaceSpecCharExceptThis(umlElement.getQualifiedName(), "::").replaceAll("::", ".");
 					
 					/*
@@ -198,5 +243,16 @@
 					 */
 					monitor.beginTask("Deleting old files for '" + modelQName + "'", 100);
-					ModelicaMLServices.deleteOldSimulationFiles(modelQName, omcTempDirectory, monitor);
+					List<String> filesToBeDeleted = new ArrayList<String>();
+					filesToBeDeleted.add(modelQName + ".exe");
+					filesToBeDeleted.add(modelQName + "_init.xml");
+					filesToBeDeleted.add(modelQName + "_res.plt");
+					filesToBeDeleted.add(modelQName + "_res.mat");
+					filesToBeDeleted.add(modelQName + "_res.xml");
+					
+//					IStatus status = ModelicaMLServices.deleteOldSimulationFiles(modelQName, omcTempDirectory, monitor);
+					IStatus status = ModelicaMLServices.deleteFiles(filesToBeDeleted, monitor);
+//					if (status != null) {
+//						System.err.println("Deleted: " + modelQName + "_init.xml, _res.plt, _res.xml, .exe");
+//					}
 					
 					/*
@@ -237,5 +293,9 @@
 								
 								resultsXMLAbsolutePath = projectPath + "/" + Constants.folderName_sim_gen + "/" + model.qualifiedName + "_res.xml";
-								ModelicaMLServices.deleteFile(resultsXMLAbsolutePath, monitor);
+								
+								List<String> fileToBeDeleted = new ArrayList<String>();
+								filesToBeDeleted.add(resultsXMLAbsolutePath);
+//								ModelicaMLServices.deleteFile(resultsXMLAbsolutePath, monitor);
+								ModelicaMLServices.deleteFiles(fileToBeDeleted, monitor);
 								
 								monitor.subTask("Copying files into '"+Constants.folderName_sim_gen+"' for: " + model.qualifiedName);
Index: trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/omc/OMCCommandExecuter.java
===================================================================
--- trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/omc/OMCCommandExecuter.java	(revision 1478)
+++ trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/omc/OMCCommandExecuter.java	(revision 1479)
@@ -39,6 +39,6 @@
 import org.eclipse.uml2.uml.Element;
 import org.eclipse.uml2.uml.NamedElement;
-import org.modelica.ConnectException;
-import org.modelica.OMCProxy;
+import org.modelica.mdt.core.ICompilerResult;
+import org.modelica.mdt.omc.OMCProxy;
 
 // TODO: Auto-generated Javadoc
@@ -49,5 +49,5 @@
 	
 	/** The status. */
-	private String status;
+	private ICompilerResult status;
 	
 	/** The proxy. */
@@ -87,4 +87,5 @@
 	 * @param simPar
 	 *            the sim par
+	 * @throws org.modelica.mdt.core.compiler.ConnectException 
 	 */
 	public OMCCommandExecuter(Element elt, 
@@ -92,5 +93,5 @@
 								String modelElementQualifiedName, 
 								String plotCommand, 
-								String simPar) {
+								String simPar) throws org.modelica.mdt.core.compiler.ConnectException {
 		
 		this.filesToLoad = filesToLoad;
@@ -117,6 +118,7 @@
 	 *            the sim par
 	 * @return the string
+	 * @throws org.modelica.mdt.core.compiler.ConnectException 
 	 */
-	private String loadAndSimulate() {
+	private ICompilerResult loadAndSimulate() throws org.modelica.mdt.core.compiler.ConnectException {
 		
 		if (simPar != null) {
@@ -124,24 +126,22 @@
 		}
 		
-		try {
-
-			status = proxy.sendExpression("clear()");
+		status = proxy.sendExpression("clear()", true);
+		
+		//proxy.sendExpression("cd(\"" + dir + "\")");
+		
+		if (status == null) {
+			System.err.println("No connection to OMC! ");
+			MoldelicaMLSimulationMarkterCreator.modelicaMLSimulationAlert(elt, "error", "No connection to OMC! ");
+		}
+		
+		for (String path : filesToLoad) {
+			status = proxy.sendExpression("loadFile(\"" + path + "\")", true);
 			
-			//proxy.sendExpression("cd(\"" + dir + "\")");
-			
-			if (status == null) {
-				System.err.println("No connection to OMC! ");
-				MoldelicaMLSimulationMarkterCreator.modelicaMLSimulationAlert(elt, "error", "No connection to OMC! ");
-			}
-			
-			for (String path : filesToLoad) {
-				status = proxy.sendExpression("loadFile(\"" + path + "\")");
-				
 //				if (status.contains("error") || status.contains("false")) {
 //					System.err.println("Cannot find the package " + folderPath + "/package.mo"+ "!");
 //					MoldelicaMLSimulationMarkterCreator.modelicaMLSimulationAlert(elt, "error", "Cannot find the package " + folderPath + "/package.mo"+ "!");
 //				}
-			}
-			
+		}
+		
 //			errorString = proxy.sendExpression("getErrorString()");
 //			if (!errorString.equals("")) {
@@ -156,20 +156,20 @@
 //				System.err.println(errorString);
 //			}
-			
-			status = proxy.sendExpression("simulate("
-					+ modelElementQualifiedName + simulationParameters + ")");
-			
-			if (status.contains("error") || status.contains("imulation failed")) {
-				setErrorString(status);
-				MoldelicaMLSimulationMarkterCreator.modelicaMLSimulationAlert(elt, "error", "Simulation of the class '"+ ((NamedElement)elt).getName() +"' failed." + "\n" + status);
+		
+		status = proxy.sendExpression("simulate("
+				+ modelElementQualifiedName + simulationParameters + ")", true);
+		
+		if (status.getResult().toString().contains("error") || status.getResult().toString().contains("failed")) {
+			setErrorString(status.getResult().toString());
+			MoldelicaMLSimulationMarkterCreator.modelicaMLSimulationAlert(elt, "error", "Simulation of the class '"+ ((NamedElement)elt).getName() +"' failed." + "\n" + status);
 //				DialogMessage dialog = new DialogMessage(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Errors", "Errors occured during simulation", status);
 //				dialog.open();
-			}
-			else  {
+		}
+		else  {
 //				MoldelicaMLSimulationMarkterCreator.modelicaMLSimulationAlert(elt, "info", "Simulation of the class '"+ ((NamedElement)elt).getName() +"' was successful.");
-			}
-			
-			if (plotCommand != null) {
-				status = proxy.sendExpression(plotCommand);
+		}
+		
+		if (plotCommand != null) {
+			status = proxy.sendExpression(plotCommand, true);
 //				if (status.contains("No simulation result to plot")) {
 //					MoldelicaMLSimulationMarkterCreator.modelicaMLSimulationAlert(elt, "error", "No simulation result to plot.");
@@ -178,12 +178,7 @@
 //					MoldelicaMLSimulationMarkterCreator.modelicaMLSimulationAlert(elt, "info", "Simulation results are plotted in a separate window.");
 //				}
-			}
-			else {
+		}
+		else {
 //				MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Nothing to plot", "No variables were selected to be plotted after simulation.");
-			}
-
-		} catch (ConnectException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
 		}
 		return status;
Index: trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/omc/OpenModelicaCompilerCommunication.java
===================================================================
--- trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/omc/OpenModelicaCompilerCommunication.java	(revision 1478)
+++ trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/omc/OpenModelicaCompilerCommunication.java	(revision 1479)
@@ -4,15 +4,7 @@
 import java.util.Collections;
 
-import org.openmodelica.modelicaml.simulation.omc.corba.OMCProxy;
-
-
-// TODO: Auto-generated Javadoc
-/**
- * The Class OpenModelicaCompilerCommunication.
- *
- * @author EADS Innovation Works, Parham Vasaiely, Parham.Vasaiely@eads.com
- * 
- * Direct communication with the OM Compiler using a Java and CORBA implementation of the OM developers
- */
+import org.modelica.mdt.core.ICompilerResult;
+import org.modelica.mdt.omc.OMCProxy;
+
 public class OpenModelicaCompilerCommunication {
 
@@ -85,19 +77,22 @@
 		 * Reply from OMC
 		 */
-		String reply = "no reply";
+		ICompilerResult reply;
+		String replyString = "Error: No reply from OMC ...";
 
 		if (command != null && command.length() > 0) {
 			history.add(command);
 			try {
-				reply = omc.sendExpression(command);
+				reply = omc.sendExpression(command, true);
+				replyString = reply.getFirstResult();
+				
 			} catch (Exception ex) {
-				reply = "\nError while sending expression: " + command + "\n"
+				replyString = "\nError while sending expression: " + command + "\n"
 						+ ex.getMessage();
 			}
 		} else {
-			reply = ("\nNo expression sent because is empty");
+			replyString = ("\nNo expression sent because it is empty");
 		}
 
-		return reply;
+		return replyString;
 	}
 	
@@ -298,16 +293,16 @@
 	}
 
-	/**
-	 * The main method.
-	 *
-	 * @param args the arguments
-	 */
-	public static void main(String[] args){
-		OpenModelicaCompilerCommunication i = new OpenModelicaCompilerCommunication();
-		i.cd("D:/OpenModelica1.5.0/tmp/");
-		i.loadModel("TwoTanks");
-		i.buildModel("TwoTanks.TanksConnectedPI", "plt");
-		i.quit();
-	}
+//	/**
+//	 * The main method.
+//	 *
+//	 * @param args the arguments
+//	 */
+//	public static void main(String[] args){
+//		OpenModelicaCompilerCommunication i = new OpenModelicaCompilerCommunication();
+//		i.cd("D:/OpenModelica1.5.0/tmp/");
+//		i.loadModel("TwoTanks");
+//		i.buildModel("TwoTanks.TanksConnectedPI", "plt");
+//		i.quit();
+//	}
 	
 }
Index: trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/testexecution/actions/ExecuteTestsAction.java
===================================================================
--- trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/testexecution/actions/ExecuteTestsAction.java	(revision 1478)
+++ trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/testexecution/actions/ExecuteTestsAction.java	(revision 1479)
@@ -107,5 +107,13 @@
 								}
 								
-								ModelicaMLServices.deleteOldSimulationFiles(model.qualifiedName, omcTempWorkingFolder, monitor);
+								List<String> filesToBeDeleted = new ArrayList<String>();
+								filesToBeDeleted.add(model.qualifiedName + ".exe");
+								filesToBeDeleted.add(model.qualifiedName + "_init.xml");
+								filesToBeDeleted.add(model.qualifiedName + "_res.plt");
+								filesToBeDeleted.add(model.qualifiedName + "_res.mat");
+								filesToBeDeleted.add(model.qualifiedName + "_res.xml");
+
+//								ModelicaMLServices.deleteOldSimulationFiles(model.qualifiedName, omcTempWorkingFolder, monitor);
+								ModelicaMLServices.deleteFiles(filesToBeDeleted, monitor);
 								
 //								monitor.subTask("Deleting files from OMC tmp folder for '" + model.qualifiedName + "'");
Index: trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/testexecution/dialogs/DialogSimulationSettings.java
===================================================================
--- trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/testexecution/dialogs/DialogSimulationSettings.java	(revision 1478)
+++ trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/testexecution/dialogs/DialogSimulationSettings.java	(revision 1479)
@@ -71,5 +71,6 @@
 	private Combo comboFormat;
 	
-	private boolean isGenerateModelicaCodeChecked, isCopyFilesChecked, isLoadModelicaLibChecked;
+	private boolean isGenerateModelicaCodeChecked = true, isCopyFilesChecked = false, isLoadModelicaLibChecked = false;
+	private String isLoadModelicaLibCheckedAddString = "";
 	
 	public DialogSimulationSettings(Shell 
@@ -107,4 +108,6 @@
 	}
 	
+
+
 	protected void configureShell(Shell shell) {
         super.configureShell(shell);
@@ -238,5 +241,5 @@
         btnCopySimulationFiles.setToolTipText("If this option is activated then the simulation files such as _init.xml, .exe and the simulation result file will be copies into the 'sim-gen' folder inside the active project.");
         btnCopySimulationFiles.setBounds(10, 73, 477, 16);
-        btnCopySimulationFiles.setText("Copy result files in my project 'sim-gen' folder after simulation");
+        btnCopySimulationFiles.setText("Copy result files in my project 'sim-gen' folder after simulation (overwrite)");
         
         btnLoadModelicaLib = new Button(grpOptions, SWT.CHECK);
@@ -248,6 +251,7 @@
         });
         btnLoadModelicaLib.setToolTipText("If this option is activated then the Modelica library will be loaded in advance.");
-        btnLoadModelicaLib.setText("Load Modelica library");
+        btnLoadModelicaLib.setText("Load Modelica Standard Library (MSL) " + isLoadModelicaLibCheckedAddString);
         btnLoadModelicaLib.setBounds(10, 51, 477, 16);
+        btnLoadModelicaLib.setSelection(isLoadModelicaLibChecked);
         
         btnGenerateModelicaCode = new Button(grpOptions, SWT.CHECK);
@@ -298,4 +302,18 @@
 	}
 	
+	
+	public void setLoadModelicaLibChecked(boolean isLoadModelicaLibChecked) {
+		this.isLoadModelicaLibChecked = isLoadModelicaLibChecked;
+		if (isLoadModelicaLibChecked) {
+			this.isLoadModelicaLibCheckedAddString = "(beacuse some components of this class use it)";
+		}
+		else {
+			this.isLoadModelicaLibCheckedAddString = "";
+		}
+	}
+
+	public void setGenerateModelicaCodeChecked(boolean isGenerateModelicaCodeChecked) {
+		this.isGenerateModelicaCodeChecked = isGenerateModelicaCodeChecked;
+	}
 	
 	
Index: trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/view/noninteractive/NonInteractive Simulation
===================================================================
--- trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/view/noninteractive/NonInteractive Simulation	(revision 1478)
+++ 	(revision )
@@ -1,29 +1,0 @@
-Non-Interactive Simulation
-
-A Non Interactive Simulation will be configured by a noninteractive session setting and an initial model
-After Starting a non interactive simulation the choosen setting will be used to modify the init.txt
-and the runtime will be executed.
-
-Pre-Condition:
-	P1. A Simulation project and a corresponding Simulation session configuration had been chosen
-	P2. Simulation Runtime has been prepared and is running
-	P3. Change Perspective to Simulation Perspective
-
-Post-Condition:
-	Post1. Close Non Interactive Simulation Perspective/Views to avoid nullpointexception
-
-1. Simulation Center
-
-2. Simulation Session Control
-	2.1 Add a visualization wizard
-		o Properties to be plot on display (Dialog mit check box aller verfügbaren properties)
-	2.2 Delte, ...
-	
-3. Simulation Property Control
-	3.1 Manuelle eingabe des wertes
-	3.2 Slider zum ändern das wertes
-	
-4. Simulation Visualization
-	4.1 anzeigen der Werte in einem fortlaufenden Intervall fenster
-	4.2 anzeigen aller werte aber nur als snapshot beim anklicken!?
-
Index: trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/view/noninteractive/OBSOLETE_NonInteractive Simulation
===================================================================
--- trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/view/noninteractive/OBSOLETE_NonInteractive Simulation	(revision 1479)
+++ trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/view/noninteractive/OBSOLETE_NonInteractive Simulation	(revision 1479)
@@ -0,0 +1,29 @@
+Non-Interactive Simulation
+
+A Non Interactive Simulation will be configured by a noninteractive session setting and an initial model
+After Starting a non interactive simulation the choosen setting will be used to modify the init.txt
+and the runtime will be executed.
+
+Pre-Condition:
+	P1. A Simulation project and a corresponding Simulation session configuration had been chosen
+	P2. Simulation Runtime has been prepared and is running
+	P3. Change Perspective to Simulation Perspective
+
+Post-Condition:
+	Post1. Close Non Interactive Simulation Perspective/Views to avoid nullpointexception
+
+1. Simulation Center
+
+2. Simulation Session Control
+	2.1 Add a visualization wizard
+		o Properties to be plot on display (Dialog mit check box aller verfügbaren properties)
+	2.2 Delte, ...
+	
+3. Simulation Property Control
+	3.1 Manuelle eingabe des wertes
+	3.2 Slider zum ändern das wertes
+	
+4. Simulation Visualization
+	4.1 anzeigen der Werte in einem fortlaufenden Intervall fenster
+	4.2 anzeigen aller werte aber nur als snapshot beim anklicken!?
+
