Christopher:

Thanks for taking the time to respond. Unfortunately, it's not so easy... :-(

>> Trying going up the containment hierarchy until
>> you get to an object that is a Configuration.

The first place I'm trying to access the config is from within the ptolemy.vergil.icon.XMLIcon class, and it looks like the icon is not part of a containment hierarchy (at least, not at the time when I try to access the config), so no luck there.

Any other pointers?

I know of a "fix" that would definitely solve this, but I'm not sure if there would be any unwanted repercussions... As far as I can tell, only one instance of VergilApplication (which extends MoMLApplication) exists at runtime, in any given JVM instance? If so, would it be possible to add a method:

  public static Configuration getConfiguration()

to MoMLApplication? (This would also necessitate adding the "static" keyword to the existing "_configuration" variable in MoMLApplication.)

Or am I missing something important?

Thanks

m


--

---------------------------------------------
Matthew Brooke, Ph.D.
Marine Sciences Research Building, Room #3407
University of California
Santa Barbara, CA  93106-6150
ph: (805) 893-7108   fx: 805-893-8062
[EMAIL PROTECTED]
---------------------------------------------


Christopher Brooks wrote:
Hi Matthew,

Edward knows this one, but I'll take a guess.

Trying going up the containment hierarchy until
you get to an object that is a Configuration.

moml/SharedParameter.java has code like:

    /** Return the top level of the containment hierarchy, unless
     *  one of the containers is an instance of EntityLibrary,
     *  in which case, return null.
     *  @return The top level, or null if this is within a library.
     */
    public NamedObj getRoot() {
        NamedObj result = this;

        while (result.getContainer() != null) {
            result = (NamedObj) result.getContainer();

            // FIXME: this means that ptolemy.moml depends on
            // ptolemy.actor.gui.  We could either do instanceof
            // or else create ptolemy.kernel.ConfigurationBase
            // and have Configuration extend it.
            if (result instanceof Configuration) {
                // If the results is a Configuration, then go no higher.
                // If we do go higher, then we end up expanding the actor
                // library tree which take a long time and fails if
                // not all the actors are present.  For example, not
                // everyone will have Matlab or quicktime.
                return null;
            }
        }

        return result;
    }

This might do it, though I think the object would need to have been
created from within the GUI.
Edward would know for sure.

_Christopher


----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list.  Please send administrative
mail for this list to: [EMAIL PROTECTED]

Reply via email to