[kepler-dev] adding a menu to kepler

Matt Jones jones at nceas.ucsb.edu
Wed Oct 27 02:41:23 PDT 2004


Shawn --

I now managed to add a menu to Kepler without changing the Ptolemy 
classes.  My inital attempt at doing so a few days ago failed, but was 
very close (I subclassed the wrong class -- oops).  After fixing that, 
it works.  So, if you now look at EML200DataSource, it has this line:

_nodeController = new DataSourceControllerFactory(this, 
"_controllerFactory");

This simply creates a new DataSourceControllerFactory and adds it to the 
EML200DataSource as a property.  Of course, for this to work, you have 
to define a class similar to DataSourceControllerFactory for your stuff, 
and the class that that factory creates as well (e.g., 
DataSourceInstanceController).  But its pretty straightforward.  See my 
example code.  You'll now notice there is a 'Get Metadata' menu item on 
the EML200DataSource actors, which when selected gives you an HTML view 
of all of the EML metadata for that data source.

The one frustration I still have is not being able to change an existing 
menu item.  Rather than creating a new "Get Metadata" menu item, I would 
have preferred to override the behaviour of the existing "Get 
Documentation" menu item.  But so far I haven't figured out how to do that.

Hope this helps you quest,

Matt



More information about the Kepler-dev mailing list