drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/editors/completion/DSLTree.java
public Node[] getChildren(String obj, String text) {
        Node thenode = this.rootCond.getChild(obj);
        if (thenode == null) {
            for (Node child: this.rootCond.getChildren()) {
                String tokenText = child.getToken();
                if (tokenText != null) {
                    int index = tokenText.indexOf("{");
                    if (index != -1) {
                        String substring = tokenText.substring(0, index);
                        if (obj != null && obj.startsWith(substring)) {
                            thenode = child;
                        }
                    }
                }
            }
        }
        if (thenode != null && text.length() > 0) {
            StringTokenizer tokenz = new StringTokenizer(text);
            this.last = this.current;
            while (tokenz.hasMoreTokens()) {
                String strtk = tokenz.nextToken();
                Node ch = thenode.getChild(strtk);
                // if a child is found, we set thenode to the child Node
                if (ch != null) {
                    thenode = ch;
                } else {
                    break;
                }
            }
            if (thenode != this.rootCond) {
                this.current = thenode;
            }
        }
        if (thenode == null) {
            return null;
            // thenode = this.rootCond;
        }
        Collection<Node> children = thenode.getChildren();
        Node[] nchild = new Node[children.size()];
        return children.toArray(nchild);
    }
public Node[] getChildren(String obj, String text) {
        Node thenode = this.rootCond.getChild(obj);
        if (thenode == null) {
            for (Node child: this.rootCond.getChildren()) {
                String tokenText = child.getToken();
                if (tokenText != null) {
                    int index = tokenText.indexOf("{");
                    if (index != -1) {
                        String substring = tokenText.substring(0, index);
                        if (obj != null && obj.startsWith(substring)) {
                            thenode = child;
                        }
                    }
                }
            }
        }
        if (thenode != null && text.length() > 0) {
            StringTokenizer tokenz = new StringTokenizer(text);
            this.last = this.current;
            while (tokenz.hasMoreTokens()) {
                String strtk = tokenz.nextToken();
                Node ch = thenode.getChild(strtk);
                // if a child is found, we set thenode to the child Node
                if (ch != null) {
                    thenode = ch;
                } else {
                    break;
                }
            }
            if (thenode != this.rootCond) {
                this.current = thenode;
            }
        }
        if (thenode == null) {
            return null;
            // thenode = this.rootCond;
        }
        Collection<Node> children = thenode.getChildren();
        Node[] nchild = new Node[children.size()];
        return children.toArray(nchild);
    }
public Node [ ] getChildren ( String obj , String text ) { Node thenode = this . rootCond . getChild ( obj ) ; if ( thenode == null ) { for ( Node child : this . rootCond . getChildren ( ) ) { String tokenText = child . getToken ( ) ; if ( tokenText != null ) { int index = tokenText . indexOf ( "{" ) ; if ( index != - 1 ) { String substring = tokenText . substring ( 0 , index ) ; if ( obj != null && obj . startsWith ( substring ) ) { thenode = child ; } } } } } if ( thenode != null && text . length ( ) > 0 ) { StringTokenizer tokenz = new StringTokenizer ( text ) ; this . last = this . current ; while ( tokenz . hasMoreTokens ( ) ) { String strtk = tokenz . nextToken ( ) ; Node ch = thenode . getChild ( strtk ) ; // if a child is found, we set thenode to the child Node if ( ch != null ) { thenode = ch ; } else { break ; } } if ( thenode != this . rootCond ) { this . current = thenode ; } } if ( thenode == null ) { return null ; // thenode = this.rootCond; } Collection < Node > children = thenode . getChildren ( ) ; Node [ ] nchild = new Node [ children . size ( ) ] ; return children . toArray ( nchild ) ; }
the method expects the caller to pass the object
@param obj
@param text
@return
the method expects the caller to pass the object