You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by pr...@apache.org on 2003/09/04 03:52:28 UTC

cvs commit: jakarta-commons/jelly/jelly-tags/jface/src/java/org/apache/commons/jelly/tags/jface/preference PreferenceDialogTag.java

proyal      2003/09/03 18:52:28

  Modified:    jelly/jelly-tags/jface/src/java/org/apache/commons/jelly/tags/jface/preference
                        PreferenceDialogTag.java
  Log:
  [JELLY-39] Allow specification of a preferenceDialog's parent
  
  Patch from Christiaan ten Klooster
  
  Revision  Changes    Path
  1.3       +10 -3     jakarta-commons/jelly/jelly-tags/jface/src/java/org/apache/commons/jelly/tags/jface/preference/PreferenceDialogTag.java
  
  Index: PreferenceDialogTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/jface/src/java/org/apache/commons/jelly/tags/jface/preference/PreferenceDialogTag.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PreferenceDialogTag.java	26 Feb 2003 12:53:37 -0000	1.2
  +++ PreferenceDialogTag.java	4 Sep 2003 01:52:28 -0000	1.3
  @@ -96,10 +96,17 @@
           ApplicationWindowTag tag =
               (ApplicationWindowTag) findAncestorWithClass(ApplicationWindowTag.class);
   
  -        if (tag == null) {
  -            throw new JellyTagException("This tag must be nested inside a <applicationWindow>");
  -        } else {
  +        if (tag != null) {
               return tag.getWindow().getShell();
  +            
  +        } else {
  +            Map attributes = getAttributes();
  +            Object parent = attributes.remove("parent");
  +            if (parent instanceof Shell) {
  +                return (Shell) parent;
  +            } else {
  +                throw new JellyTagException("This tag must be nested inside a <applicationWindow> or have a parent of type Shell");
  +            }
           }
       }