* ruby call hierarchy.
* external project fragment memento fix.
* some cleanups.
* open type history crach fix.
diff --git a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/ExternalProjectFragment.java b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/ExternalProjectFragment.java
index 5f87a46..79f9b1f 100644
--- a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/ExternalProjectFragment.java
+++ b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/ExternalProjectFragment.java
@@ -16,6 +16,8 @@
 import org.eclipse.dltk.core.IProjectFragment;
 import org.eclipse.dltk.core.IScriptFolder;
 import org.eclipse.dltk.core.ModelException;
+import org.eclipse.dltk.core.WorkingCopyOwner;
+import org.eclipse.dltk.internal.core.util.MementoTokenizer;
 import org.eclipse.dltk.internal.core.util.Util;
 
 
@@ -216,4 +218,33 @@
 	public String getElementName() {		
 		return fPath.toOSString().replace(File.separatorChar, JEM_SKIP_DELIMETER);		
 	}
+	public IModelElement getHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner owner) {
+		switch (token.charAt(0)) {
+			case JEM_SCRIPTFOLDER:
+				String pkgName;
+				if (memento.hasMoreTokens()) {
+					pkgName = memento.nextToken();
+					char firstChar = pkgName.charAt(0);
+					if (firstChar == JEM_SOURCEMODULE || firstChar == JEM_COUNT) {
+						token = pkgName;
+						pkgName = IProjectFragment.DEFAULT_SCRIPT_FOLDER_NAME;
+					} else {
+						token = null;
+					}
+				} else {
+					pkgName = IScriptFolder.DEFAULT_FOLDER_NAME;
+					token = null;
+				}
+				ModelElement pkg = (ModelElement) getScriptFolder(pkgName);
+				if (token == null) {
+					return pkg.getHandleFromMemento(memento, owner);
+				} else {
+					return pkg.getHandleFromMemento(token, memento, owner);
+				}
+		}
+		return null;
+	}
+	protected char getHandleMementoDelimiter() {
+		return JEM_PROJECTFRAGMENT;
+	}
 }
diff --git a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/ExternalSourceModule.java b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/ExternalSourceModule.java
index 5970fdb..0a83af8 100644
--- a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/ExternalSourceModule.java
+++ b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/ExternalSourceModule.java
@@ -34,6 +34,7 @@
 import org.eclipse.dltk.core.IProjectFragment;
 import org.eclipse.dltk.core.ISourceElementParser;
 import org.eclipse.dltk.core.ISourceModule;
+import org.eclipse.dltk.core.ISourceModuleInfoCache;
 import org.eclipse.dltk.core.ISourceRange;
 import org.eclipse.dltk.core.IType;
 import org.eclipse.dltk.core.ModelException;
@@ -126,7 +127,12 @@
 				throw new ModelException(new ModelStatus(ModelStatus.INVALID_NAME));
 			}
 			ISourceElementParser parser = toolkit.createSourceElementParser(requestor, null, Collections.EMPTY_MAP);
-			parser.parseSourceModule(contents, null);
+			
+			ISourceModuleInfoCache sourceModuleInfoCache = ModelManager.getModelManager().getSourceModuleInfoCache();
+//			sourceModuleInfoCache.remove(this);
+			parser.parseSourceModule(contents, sourceModuleInfoCache.get(this));
+			
+//			parser.parseSourceModule(contents, null);
 			if (ExternalSourceModule.DEBUG_PRINT_MODEL) {
 				System.out.println("Source Module Debug print:");
 				CorePrinter printer = new CorePrinter(System.out);
diff --git a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/SourceModuleInfoCache.java b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/SourceModuleInfoCache.java
index fa9ce75..5e714cf 100644
--- a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/SourceModuleInfoCache.java
+++ b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/SourceModuleInfoCache.java
@@ -28,7 +28,7 @@
 		// if max memory is infinite, set the ratio to 4d which corresponds to
 		// the 256MB that Eclipse defaults to
 		// (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=111299)
-		double ratio = 100; // 64000000
+		double ratio = 10; // 64000000
 
 		this.cache = new ElementCache(
 				(int) (ModelCache.DEFAULT_ROOT_SIZE * ratio));
@@ -41,9 +41,11 @@
 
 	public ISourceModuleInfo get(ISourceModule module) {
 		Object object = this.cache.get(module);
+		System.out.println("Filling ratio:" + this.cache.fillingRatio());
 		if (object == null) {
 			return returnAdd(module);
 		}
+		this.cache.printStats();
 		return (ISourceModuleInfo) object;
 	}
 
diff --git a/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/core/search/indexing/SourceIndexer.java b/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/core/search/indexing/SourceIndexer.java
index 7619afe..da05a06 100644
--- a/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/core/search/indexing/SourceIndexer.java
+++ b/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/core/search/indexing/SourceIndexer.java
@@ -22,6 +22,8 @@
 import org.eclipse.dltk.core.IScriptFolder;

 import org.eclipse.dltk.core.ISourceElementParser;

 import org.eclipse.dltk.core.ISourceModule;

+import org.eclipse.dltk.core.ISourceModuleInfoCache;

+import org.eclipse.dltk.core.ISourceModuleInfoCache.ISourceModuleInfo;

 import org.eclipse.dltk.core.search.IDLTKSearchScope;

 import org.eclipse.dltk.core.search.SearchDocument;

 import org.eclipse.dltk.internal.core.ModelManager;

@@ -67,9 +69,11 @@
 			}

 			String pkgName = "";

 			IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);

+			ISourceModule sourceModule = null;

 			if (file.exists()) {

 				ISourceModule module = (ISourceModule) DLTKCore.create(file);

 				if (module != null) {

+					sourceModule = module;

 					IScriptFolder folder = (IScriptFolder) module.getParent();

 					pkgName = folder.getElementName();

 				}

@@ -87,7 +91,15 @@
 			if (source == null || name == null)

 				return; // could not retrieve document info (e.g. resource was

 						// discarded)

+//			parser.parseSourceModule(source, null);

+//			ISourceModuleInfo info = null;

+//			if( sourceModule != null ) {

+//				ISourceModuleInfoCache sourceModuleInfoCache = ModelManager.getModelManager().getSourceModuleInfoCache();

+//				sourceModuleInfoCache.remove(sourceModule);

+//				info = sourceModuleInfoCache.get(sourceModule);

+//			}

 			parser.parseSourceModule(source, null);

+			

 		} else { // This is for external documents				

 			if (parser == null || requestor == null ) {

 				//parser = ModelManager.getModelManager().indexManager.getSourceElementParser(dltkProject, requestor);