diff dwtx/jface/viewers/AbstractTreeViewer.d @ 71:4878bef4a38e

Some fixing
author Frank Benoit <benoit@tionex.de>
date Thu, 22 May 2008 04:03:58 +0200
parents 46a6e0e6ccd4
children 5df4896124c7
line wrap: on
line diff
--- a/dwtx/jface/viewers/AbstractTreeViewer.d	Thu May 22 01:36:46 2008 +0200
+++ b/dwtx/jface/viewers/AbstractTreeViewer.d	Thu May 22 04:03:58 2008 +0200
@@ -375,10 +375,10 @@
         // start position. This is the insertion position relative to the
         // original item array.
         int indexInItems = 0;
-        
+
         // Count of elements we have added. See bug 205700 for why this is needed.
         int newItems = 0;
-        
+
         elementloop: for (int i = 0; i < elements.length; i++) {
             Object element = elements[i];
             // update the index relative to the original item array
@@ -1936,13 +1936,13 @@
                 Object parent = getParentElement(element);
                 if (parent !is null
                         && !equals(parent, getRoot())
-                        && !(parent instanceof TreePath && ((TreePath) parent)
+                        && !((null !is cast(TreePath)parent) && (cast(TreePath) parent)
                                 .getSegmentCount() is 0)) {
                     Widget[] parentItems = internalFindItems(parent);
                     for (int j = 0; j < parentItems.length; j++) {
                         Widget parentItem = parentItems[j];
-                        if (parentItem instanceof Item) {
-                            updatePlus((Item) parentItem, parent);
+                        if (null !is cast(Item)parentItem ) {
+                            updatePlus(cast(Item) parentItem, parent);
                         }
                     }
                 }
@@ -1980,9 +1980,9 @@
             Item[] children = getChildren(parentItem);
 
             if (children.length is 1 && children[0].getData() is null &&
-                    parentItem instanceof Item) { // dummy node
+                    (null !is cast(Item)parentItem )) { // dummy node
                 // Remove plus if parent element has no children
-                updatePlus((Item) parentItem, parent);
+                updatePlus(cast(Item) parentItem, parent);
             } else {
                 for (int j = 0; j < children.length; j++) {
                     Item child = children[j];
@@ -2620,7 +2620,7 @@
         }
 
         Item[] items = getChildren(widget,elementChildren);
-        
+
         // save the expanded elements
         CustomHashtable expanded = newHashtable(CustomHashtable.DEFAULT_CAPACITY); // assume
                                                                                     // num
@@ -3001,8 +3001,8 @@
                     createTreeItem(item, element, insertionPosition);
                 } else {
                     Object parentElement = parentElementOrTreePath;
-                    if (element instanceof TreePath)
-                        parentElement = ((TreePath) parentElement).getLastSegment();
+                    if (null !is cast(TreePath)element )
+                        parentElement = (cast(TreePath) parentElement).getLastSegment();
                     updatePlus(item, parentElement);
                 }
             } else {