Mercurial > projects > dwt-addons
diff dwtx/jface/text/link/LinkedModeModel.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/link/LinkedModeModel.d Wed Aug 27 14:49:30 2008 +0200 +++ b/dwtx/jface/text/link/LinkedModeModel.d Mon Sep 08 00:51:37 2008 +0200 @@ -24,15 +24,8 @@ import dwt.dwthelper.utils; - import dwtx.dwtxhelper.Collection; - - - - - - import dwtx.core.runtime.Assert; import dwtx.jface.text.BadLocationException; import dwtx.jface.text.BadPositionCategoryException; @@ -42,7 +35,7 @@ import dwtx.jface.text.IDocumentListener; import dwtx.jface.text.IPositionUpdater; import dwtx.jface.text.Position; -import dwtx.jface.text.IDocumentExtension.IReplace; +import dwtx.jface.text.IDocumentExtension; import dwtx.text.edits.MalformedTreeException; import dwtx.text.edits.TextEdit; @@ -142,7 +135,7 @@ * Encapsulates the edition triggered by a change to a linking position. Can * be applied to a document as a whole. */ - private class Replace : IReplace { + private class Replace : IDocumentExtension.IReplace { /** The edition to apply on a document. */ private TextEdit fEdit; @@ -240,7 +233,7 @@ // edit all documents for (Iterator it2= result.keySet().iterator(); it2.hasNext(); ) { IDocument doc= cast(IDocument) it2.next(); - TextEdit edit= cast(TextEdit) result.get(doc); + TextEdit edit= cast(TextEdit) result.get(cast(Object)doc); Replace replace= new Replace(edit); // apply the edition, either as post notification replace @@ -262,13 +255,13 @@ } /** The set of linked position groups. */ - private const List fGroups= new ArrayList(); + private const List fGroups; /** The set of documents spanned by this group. */ - private const Set fDocuments= new HashSet(); + private const Set fDocuments; /** The position updater for linked positions. */ - private const IPositionUpdater fUpdater= new InclusivePositionUpdater(getCategory()); + private const IPositionUpdater fUpdater; /** The document listener on the documents affected by this model. */ - private const DocumentListener fDocumentListener= new DocumentListener(); + private const DocumentListener fDocumentListener; /** The parent model for a hierarchical set up, or <code>null</code>. */ private LinkedModeModel fParentEnvironment; /** @@ -285,14 +278,14 @@ /** <code>true</code> when this model is changing documents. */ private bool fIsChanging= false; /** The linked listeners. */ - private const List fListeners= new ArrayList(); + private const List fListeners; /** Flag telling whether we have exited: */ private bool fIsActive= true; /** * The sequence of document positions as we are going to iterate through * them. */ - private List fPositionSequence= new ArrayList(); + private List fPositionSequence; /** * Whether we are in the process of editing documents (set by <code>Replace</code>, @@ -379,8 +372,8 @@ * @param document the new document */ private void manageDocument(IDocument document) { - if (!fDocuments.contains(document)) { - fDocuments.add(document); + if (!fDocuments.contains(cast(Object)document)) { + fDocuments.add(cast(Object)document); document.addPositionCategory(getCategory()); document.addPositionUpdater(fUpdater); document.addDocumentListener(fDocumentListener); @@ -438,6 +431,14 @@ * @since 3.1 */ public this() { + // DWT inst init + fGroups= new ArrayList(); + fDocuments= new HashSet(); + fUpdater= new InclusivePositionUpdater(getCategory()); + fDocumentListener= new DocumentListener(); + fListeners= new ArrayList(); + fPositionSequence= new ArrayList(); + } /** @@ -556,9 +557,9 @@ Set docs= new HashSet(); for (Iterator it= fGroups.iterator(); it.hasNext(); ) { LinkedPositionGroup group= cast(LinkedPositionGroup) it.next(); - docs.addAll(Arrays.asList(group.getDocuments())); + docs.addAll(Arrays.asList(arraycast!(Object)(group.getDocuments()))); } - return (IDocument[]) docs.toArray(new IDocument[docs.size()]); + return arraycast!(IDocument)( docs.toArray()); } /** @@ -652,9 +653,9 @@ * @param listener the new listener */ public void addLinkingListener(ILinkedModeListener listener) { - Assert.isNotNull(listener); - if (!fListeners.contains(listener)) - fListeners.add(listener); + Assert.isNotNull(cast(Object)listener); + if (!fListeners.contains(cast(Object)listener)) + fListeners.add(cast(Object)listener); } /** @@ -664,7 +665,7 @@ * @param listener the new listener */ public void removeLinkingListener(ILinkedModeListener listener) { - fListeners.remove(listener); + fListeners.remove(cast(Object)listener); } /**