From 744b24e34cbec87f50ac054a002451213738f5d2 Mon Sep 17 00:00:00 2001 From: stefanp Date: Fri, 14 Mar 2003 11:35:19 +0000 Subject: [PATCH] added getDocApplication() that tries to find a DocApplication object among the parents of the element --- src/helma/doc/DocElement.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/helma/doc/DocElement.java b/src/helma/doc/DocElement.java index 151a77c7..0a5094ac 100644 --- a/src/helma/doc/DocElement.java +++ b/src/helma/doc/DocElement.java @@ -250,6 +250,21 @@ public abstract class DocElement implements IPathElement { return arr; } + /** + * walks up the tree and tries to find a DocApplication object + */ + public DocApplication getDocApplication () { + DocElement el = this; + while (el != null) { + if (el instanceof DocApplication) { + return (DocApplication) el; + } + el = (DocElement) el.getParentElement (); + } + return null; + } + + /** * from helma.framework.IPathElement. Elements are named * like this: typename_name