Mercurial > projects > dwt-addons
diff dwtx/jface/text/projection/ProjectionDocumentManager.d @ 162:1a5b8f8129df
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 08 Sep 2008 00:51:37 +0200 |
parents | f70d9508c95c |
children |
line wrap: on
line diff
--- a/dwtx/jface/text/projection/ProjectionDocumentManager.d Wed Aug 27 14:49:30 2008 +0200 +++ b/dwtx/jface/text/projection/ProjectionDocumentManager.d Mon Sep 08 00:51:37 2008 +0200 @@ -64,7 +64,11 @@ public class ProjectionDocumentManager : IDocumentListener, ISlaveDocumentManager, ISlaveDocumentManagerExtension { /** Registry for master documents and their projection documents. */ - private Map fProjectionRegistry= new HashMap(); + private Map fProjectionRegistry; + + this(){ + fProjectionRegistry= new HashMap(); + } /** * Registers the given projection document for the given master document. @@ -73,10 +77,10 @@ * @param projection the projection document */ private void add(IDocument master, ProjectionDocument projection) { - List list= cast(List) fProjectionRegistry.get(master); + List list= cast(List) fProjectionRegistry.get(cast(Object)master); if (list is null) { list= new ArrayList(1); - fProjectionRegistry.put(master, list); + fProjectionRegistry.put(cast(Object)master, cast(Object)list); } list.add(projection); } @@ -88,11 +92,11 @@ * @param projection the projection document */ private void remove(IDocument master, ProjectionDocument projection) { - List list= cast(List) fProjectionRegistry.get(master); + List list= cast(List) fProjectionRegistry.get(cast(Object)master); if (list !is null) { list.remove(projection); if (list.size() is 0) - fProjectionRegistry.remove(master); + fProjectionRegistry.remove(cast(Object)master); } } @@ -103,7 +107,7 @@ * @return <code>true</code> if the given document is a master document known to this manager */ private bool hasProjection(IDocument master) { - return (cast(List)fProjectionRegistry.get(master) ); + return ( null !is cast(List)fProjectionRegistry.get(cast(Object)master) ); } /** @@ -114,7 +118,7 @@ * @return an iterator for all registered projection documents or <code>null</code> */ private Iterator getProjectionsIterator(IDocument master) { - List list= cast(List) fProjectionRegistry.get(master); + List list= cast(List) fProjectionRegistry.get(cast(Object)master); if (list !is null) return list.iterator(); return null; @@ -214,7 +218,7 @@ * @see dwtx.jface.text.ISlaveDocumentManager#isSlaveDocument(dwtx.jface.text.IDocument) */ public bool isSlaveDocument(IDocument document) { - return ( cast(ProjectionDocument)document ); + return ( null !is cast(ProjectionDocument)document ); } /* @@ -229,11 +233,9 @@ * @see dwtx.jface.text.ISlaveDocumentManagerExtension#getSlaveDocuments(dwtx.jface.text.IDocument) */ public IDocument[] getSlaveDocuments(IDocument master) { - List list= cast(List) fProjectionRegistry.get(master); + List list= cast(List) fProjectionRegistry.get(cast(Object)master); if (list !is null) { - IDocument[] result= new IDocument[list.size()]; - list.toArray(result); - return result; + return arraycast!(IDocument)(list.toArray()); } return null; }