Index: trunk/org.modelica.mdt/src/org/modelica/mdt/editor/EditorUtility.java
===================================================================
--- trunk/org.modelica.mdt/src/org/modelica/mdt/editor/EditorUtility.java	(revision 177)
+++ trunk/org.modelica.mdt/src/org/modelica/mdt/editor/EditorUtility.java	(revision 178)
@@ -2,5 +2,5 @@
  * This file is part of Modelica Development Tooling.
  *
- * Copyright (c) 2005, Linköpings universitet, Department of
+ * Copyright (c) 2005, Link�pings universitet, Department of
  * Computer and Information Science, PELAB
  *
@@ -23,5 +23,5 @@
  *   distribution.
  *
- * * Neither the name of Linköpings universitet nor the names of its
+ * * Neither the name of Link�pings universitet nor the names of its
  *   contributors may be used to endorse or promote products derived from
  *   this software without specific prior written permission.
Index: trunk/org.modelica.mdt/src/org/modelica/mdt/editor/ModelicaCompletionProcessor.java
===================================================================
--- trunk/org.modelica.mdt/src/org/modelica/mdt/editor/ModelicaCompletionProcessor.java	(revision 178)
+++ trunk/org.modelica.mdt/src/org/modelica/mdt/editor/ModelicaCompletionProcessor.java	(revision 178)
@@ -0,0 +1,151 @@
+package org.modelica.mdt.editor;
+
+import java.text.MessageFormat;
+import java.util.List;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.TextPresentation;
+import org.eclipse.jface.text.contentassist.CompletionProposal;
+import org.eclipse.jface.text.contentassist.ContextInformation;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.jface.text.contentassist.IContextInformationPresenter;
+import org.eclipse.jface.text.contentassist.IContextInformationValidator;
+import org.modelica.mdt.MdtPlugin;
+import org.modelica.mdt.internal.omcproxy.ConnectionException;
+import org.modelica.mdt.internal.omcproxy.InvocationError;
+import org.modelica.mdt.internal.omcproxy.OMCProxy;
+import org.modelica.mdt.internal.omcproxy.UnexpectedReplyException;
+
+public class ModelicaCompletionProcessor implements IContentAssistProcessor
+{
+
+	protected static class Validator implements IContextInformationValidator,
+		IContextInformationPresenter
+	{
+		protected int fInstallOffset;
+		
+		public boolean isContextInformationValid(int offset)
+		{
+			return Math.abs(fInstallOffset - offset) < 5;
+		}
+		
+		public void install(IContextInformation info, ITextViewer viewer,
+				int offset)
+		{
+			fInstallOffset = offset;
+		}
+		
+		public boolean updatePresentation(int documentPosition,
+				TextPresentation presentation)
+		{
+			return false;
+		}
+	}
+	
+	protected IContextInformationValidator validator = new Validator();
+	
+	public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
+			int offset)
+	{
+		String className = "";
+
+		char ch;
+		
+		int offsetCounter = offset;
+		
+		try
+		{
+			/* to skip the . at the end */
+			offsetCounter--;
+			do
+			{
+				ch = viewer.getDocument().getChar(--offsetCounter);
+				if(ch != '\n' && ch != '\t' && ch != ' ')
+					className = ch + className;
+				else
+					break;
+			}
+			while(true);
+		}
+		catch(BadLocationException e)
+		{
+			e.printStackTrace();
+			MdtPlugin.log(e);
+		}
+		
+			String[] classes = null;
+			String[] packages = null;
+			
+			try
+			{
+				classes = OMCProxy.getClassNames(className);
+				packages = OMCProxy.getPackages(className);
+			}
+			catch (ConnectionException e)
+			{
+				e.printStackTrace();
+				MdtPlugin.log(e);
+			}
+			catch (UnexpectedReplyException e)
+			{
+				e.printStackTrace();
+				MdtPlugin.log(e);
+			}
+			catch (InvocationError e)
+			{
+				e.printStackTrace();
+				MdtPlugin.log(e);
+			}
+			
+			ICompletionProposal[] proposals = 
+				new ICompletionProposal[classes.length + packages.length];
+			
+			for(int i = 0;i < classes.length;i++)
+			{
+				proposals[i] = new CompletionProposal(classes[i], offset, 0,
+						classes[i].length(), null, classes[i], null, null);
+			}
+			for(int i = 0;i < packages.length;i++)
+			{
+				proposals[i + classes.length] = 
+					new CompletionProposal(packages[i], offset, 0,
+							packages[i].length(), null, packages[i],
+							null, null);
+			}
+		return proposals;
+	}
+
+	public IContextInformation[] computeContextInformation(ITextViewer viewer,
+			int offset)
+	{
+		IContextInformation[] result= new IContextInformation[5];
+		for (int i= 0; i < result.length; i++)
+			result[i]= new ContextInformation(
+				MessageFormat.format("CompletionProcessor.ContextInfo.display.pattern", new Object[] { new Integer(i), new Integer(offset) }),  //$NON-NLS-1$
+				MessageFormat.format("CompletionProcessor.ContextInfo.value.pattern", new Object[] { new Integer(i), new Integer(offset - 5), new Integer(offset + 5)})); //$NON-NLS-1$
+		return result;
+	}
+
+	public char[] getCompletionProposalAutoActivationCharacters()
+	{
+		return new char[] {'.', '('};
+	}
+
+	public char[] getContextInformationAutoActivationCharacters()
+	{
+		return new char[] {'#'};
+	}
+
+	public String getErrorMessage()
+	{
+		return null;
+	}
+
+	public IContextInformationValidator getContextInformationValidator()
+	{
+		return validator;
+	}
+}
Index: trunk/org.modelica.mdt/src/org/modelica/mdt/editor/ModelicaSourceViewerConfig.java
===================================================================
--- trunk/org.modelica.mdt/src/org/modelica/mdt/editor/ModelicaSourceViewerConfig.java	(revision 177)
+++ trunk/org.modelica.mdt/src/org/modelica/mdt/editor/ModelicaSourceViewerConfig.java	(revision 178)
@@ -2,5 +2,5 @@
  * This file is part of Modelica Development Tooling.
  *
- * Copyright (c) 2005, Linköpings universitet, Department of
+ * Copyright (c) 2005, Link�pings universitet, Department of
  * Computer and Information Science, PELAB
  *
@@ -23,5 +23,5 @@
  *   distribution.
  *
- * * Neither the name of Linköpings universitet nor the names of its
+ * * Neither the name of Link�pings universitet nor the names of its
  *   contributors may be used to endorse or promote products derived from
  *   this software without specific prior written permission.
@@ -44,4 +44,6 @@
 import org.eclipse.jface.text.IDocument;
 import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.contentassist.ContentAssistant;
+import org.eclipse.jface.text.contentassist.IContentAssistant;
 import org.eclipse.jface.text.presentation.IPresentationReconciler;
 import org.eclipse.jface.text.presentation.PresentationReconciler;
@@ -92,3 +94,19 @@
 	}
 
+	public IContentAssistant getContentAssistant(ISourceViewer sourceViewer)
+	{
+		ContentAssistant assistant = new ContentAssistant();
+		
+		assistant.setContentAssistProcessor(new ModelicaCompletionProcessor(),
+				IDocument.DEFAULT_CONTENT_TYPE);
+		
+		assistant.enableAutoActivation(true);
+		assistant.setAutoActivationDelay(500);
+		assistant.setProposalPopupOrientation(IContentAssistant
+				.PROPOSAL_OVERLAY);
+		assistant.setContextInformationPopupOrientation(IContentAssistant
+				.CONTEXT_INFO_ABOVE);
+		
+		return assistant;
+	}
 }
Index: trunk/org.modelica.mdt/src/org/modelica/mdt/internal/core/FolderPackage.java
===================================================================
--- trunk/org.modelica.mdt/src/org/modelica/mdt/internal/core/FolderPackage.java	(revision 177)
+++ trunk/org.modelica.mdt/src/org/modelica/mdt/internal/core/FolderPackage.java	(revision 178)
@@ -2,5 +2,5 @@
  * This file is part of Modelica Development Tooling.
  *
- * Copyright (c) 2005, Linköpings universitet, Department of
+ * Copyright (c) 2005, Link�pings universitet, Department of
  * Computer and Information Science, PELAB
  *
@@ -23,5 +23,5 @@
  *   distribution.
  *
- * * Neither the name of Linköpings universitet nor the names of its
+ * * Neither the name of Link�pings universitet nor the names of its
  *   contributors may be used to endorse or promote products derived from
  *   this software without specific prior written permission.
@@ -52,4 +52,5 @@
 import org.eclipse.core.resources.IResourceDelta;
 import org.eclipse.core.runtime.CoreException;
+import org.modelica.mdt.MdtPlugin;
 import org.modelica.mdt.core.IModelicaElementChange;
 import org.modelica.mdt.core.IModelicaElementChange.ChangeType;
@@ -163,4 +164,5 @@
 					// TODO Auto-generated catch block
 					e.printStackTrace();
+					MdtPlugin.log(e);
 				}
 				catch (UnexpectedReplyException e)
@@ -168,4 +170,5 @@
 					// TODO Auto-generated catch block
 					e.printStackTrace();
+					MdtPlugin.log(e);
 				}
 				children.put(res, element);
Index: trunk/org.modelica.mdt/src/org/modelica/mdt/internal/core/InnerPackage.java
===================================================================
--- trunk/org.modelica.mdt/src/org/modelica/mdt/internal/core/InnerPackage.java	(revision 177)
+++ trunk/org.modelica.mdt/src/org/modelica/mdt/internal/core/InnerPackage.java	(revision 178)
@@ -2,5 +2,5 @@
  * This file is part of Modelica Development Tooling.
  *
- * Copyright (c) 2005, Linköpings universitet, Department of
+ * Copyright (c) 2005, Link�pings universitet, Department of
  * Computer and Information Science, PELAB
  *
@@ -23,5 +23,5 @@
  *   distribution.
  *
- * * Neither the name of Linköpings universitet nor the names of its
+ * * Neither the name of Link�pings universitet nor the names of its
  *   contributors may be used to endorse or promote products derived from
  *   this software without specific prior written permission.
Index: trunk/org.modelica.mdt/src/org/modelica/mdt/internal/core/ModelicaRoot.java
===================================================================
--- trunk/org.modelica.mdt/src/org/modelica/mdt/internal/core/ModelicaRoot.java	(revision 177)
+++ trunk/org.modelica.mdt/src/org/modelica/mdt/internal/core/ModelicaRoot.java	(revision 178)
@@ -2,5 +2,5 @@
  * This file is part of Modelica Development Tooling.
  *
- * Copyright (c) 2005, Linköpings universitet, Department of
+ * Copyright (c) 2005, Link�pings universitet, Department of
  * Computer and Information Science, PELAB
  *
@@ -23,5 +23,5 @@
  *   distribution.
  *
- * * Neither the name of Linköpings universitet nor the names of its
+ * * Neither the name of Link�pings universitet nor the names of its
  *   contributors may be used to endorse or promote products derived from
  *   this software without specific prior written permission.
@@ -132,5 +132,5 @@
 				break;
 			case IResourceDelta.REMOVED:
-				changes.addAll(handleResouceRemoved(project));
+				changes.addAll(handleResourceRemoved(project));
 				break;				
 			case IResourceDelta.CHANGED:
@@ -155,5 +155,5 @@
 	}
 
-	private List<IModelicaElementChange> handleResouceRemoved(IProject project)
+	private List<IModelicaElementChange> handleResourceRemoved(IProject project)
 	{
 		List<IModelicaElementChange> changes = 
@@ -175,4 +175,7 @@
 		try
 		{
+			// TODO work this out
+			if(projectsTable == null)
+				;
 			ModelicaProject modelicaProject = projectsTable.get(project);
 			changes.addAll(modelicaProject.update(delta));
Index: trunk/org.modelica.mdt/src/org/modelica/mdt/internal/omcproxy/OMCProxy.java
===================================================================
--- trunk/org.modelica.mdt/src/org/modelica/mdt/internal/omcproxy/OMCProxy.java	(revision 177)
+++ trunk/org.modelica.mdt/src/org/modelica/mdt/internal/omcproxy/OMCProxy.java	(revision 178)
@@ -431,29 +431,31 @@
 		IModelicaClass.Type type = Type.CLASS;
 		
-		if(sendExpression("isType(" + className + ")").contains("true"))
+		String retval = sendExpression("getClassRestriction(" + className + ")");
+		
+		if(retval.contains("model"))
+		{
+			type = Type.MODEL;
+		}
+		else if(retval.contains("connector"))
+		{
+			type = Type.CONNECTOR;
+		}
+		else if(retval.contains("record"))
+		{
+			type = Type.RECORD;
+		}
+		else if(retval.contains("block"))
+		{
+			type = Type.BLOCK;
+		}
+		else if(retval.contains("function"))
+		{
+			type = Type.FUNCTION;
+		}
+		else if(retval.contains("type"))
 		{
 			type = Type.TYPE;
 		}
-		else if(sendExpression("isConnector(" + className + ")").contains("true"))
-		{
-			type = Type.CONNECTOR;
-		}
-		else if(sendExpression("isModel(" + className + ")").contains("true"))
-		{
-			type = Type.MODEL;
-		}
-		else if(sendExpression("isRecord(" + className + ")").contains("true"))
-		{
-			type = Type.RECORD;
-		}
-		else if(sendExpression("isBlock(" + className + ")").contains("true"))
-		{	
-			type = Type.BLOCK;
-		}
-		else if(sendExpression("isFunction(" + className + ")").contains("true"))
-		{
-			type = Type.FUNCTION;
-		}
-
+		
 		return type;
 	}
@@ -462,10 +464,12 @@
 		throws ConnectionException
 	{
-		/*
-		 * TODO add check that sendExpression really returned a string,
-		 * throw an exception otherwise
-		 */ 
-		String res = sendExpression("getErrorString()").trim();
-		return res.substring(1, res.length() - 1);
+		String res = sendExpression("getErrorString()");
+		if(res != null)
+		{
+			res = res.trim();
+			return res.substring(1, res.length() - 1);
+		}
+		else
+			return "";
 	}
 	
Index: trunk/org.modelica.mdt/src/org/modelica/mdt/internal/omcproxy/ProxyParser.java
===================================================================
--- trunk/org.modelica.mdt/src/org/modelica/mdt/internal/omcproxy/ProxyParser.java	(revision 177)
+++ trunk/org.modelica.mdt/src/org/modelica/mdt/internal/omcproxy/ProxyParser.java	(revision 178)
@@ -74,5 +74,6 @@
 			else
 			{
-				throw new UnexpectedReplyException("huh?");
+				throw new UnexpectedReplyException("List wasn't flat Modelica "
+						+"list");
 			}
 		}
Index: trunk/org.modelica.mdt/src/org/modelica/mdt/ui/ModelicaElementContentProvider.java
===================================================================
--- trunk/org.modelica.mdt/src/org/modelica/mdt/ui/ModelicaElementContentProvider.java	(revision 177)
+++ trunk/org.modelica.mdt/src/org/modelica/mdt/ui/ModelicaElementContentProvider.java	(revision 178)
@@ -138,8 +138,10 @@
 				// TODO Auto-generated catch block
 				e.printStackTrace();
+				MdtPlugin.log(e);
 			} catch (CoreException e)
 			{
 				// TODO Auto-generated catch block
 				e.printStackTrace();
+				MdtPlugin.log(e);
 			}
 
@@ -162,8 +164,10 @@
 				// TODO Auto-generated catch block
 				e.printStackTrace();
+				MdtPlugin.log(e);
 			} catch (CoreException e)
 			{
 				// TODO Auto-generated catch block
 				e.printStackTrace();
+				MdtPlugin.log(e);
 			}
 		}
@@ -200,8 +204,10 @@
 				// TODO Auto-generated catch block
 				e.printStackTrace();
+				MdtPlugin.log(e);
 			} catch (CompilerException e)
 			{
 				// TODO Auto-generated catch block
 				e.printStackTrace();
+				MdtPlugin.log(e);
 			}
 		}
Index: trunk/org.modelica.mdt/src/org/modelica/mdt/ui/ProjectsViewDoubleClickAction.java
===================================================================
--- trunk/org.modelica.mdt/src/org/modelica/mdt/ui/ProjectsViewDoubleClickAction.java	(revision 177)
+++ trunk/org.modelica.mdt/src/org/modelica/mdt/ui/ProjectsViewDoubleClickAction.java	(revision 178)
@@ -2,5 +2,5 @@
  * This file is part of Modelica Development Tooling.
  *
- * Copyright (c) 2005, Linköpings universitet, Department of
+ * Copyright (c) 2005, Link�pings universitet, Department of
  * Computer and Information Science, PELAB
  *
@@ -23,5 +23,5 @@
  *   distribution.
  *
- * * Neither the name of Linköpings universitet nor the names of its
+ * * Neither the name of Link�pings universitet nor the names of its
  *   contributors may be used to endorse or promote products derived from
  *   this software without specific prior written permission.
