[kepler-dev] Kepler/Ptolemy on the Mac

Christopher Hylands Brooks cxh at eecs.berkeley.edu
Thu May 13 09:44:09 PDT 2004


Thanks for the update.

I added ptolemy/vergil/VergilUtilities.java that defines a static
method:
    public static boolean macOSLookAndFeel() {
        return UIManager.getLookAndFeel().getName().startsWith("Mac OS");
    }

We now call that method from two locations in
vergil/actor/ActorEditorGraphController.java
and one location in
vergil/toolbox/PtolemyTransferable.java

I don't think we should use "System.getProperty("mrj.version")"
because getProperty() is likely to throw a security exception under
applets or else when run inside the security sandbox.  
The security sandbox could play a big role in running models that
are open to the world, but we only want to provide access to
certain features, such as the serial port etc.

In any case, abstracting the check to a separate method might
make it possible for non Mac developers to try some things
out by editing VergilUtilities and forcing the method to return true.
We might also need to define _metaFilter in ActorEditorGraphController
differently.

Basically, the problem I'm facing is that the Mac I have access to
does not have the developer tools installed, so I need to mess with
Eclipse on the mac.  If we can replicate most of the problem in
my development tree under Windows, then it is more likely that 
I can take a look.

I'll see what I can do.

-Christopher
--------

    Hi All,
    
    I have been investigating the use of Kepler/Ptolemy on the Mac. I did find
    some threads on Mac use (especial concerning the single button mouse), but 
   I
    was still having some problems. In particular, one can find in the
    'ActorEditorGraphController' class the code fragment
    
            if (UIManager.getLookAndFeel().getName().startsWith("MacOS")) {
                // On the Mac, do not override Control-Click, which is
                // used to bring up the context menu
                _linkCreator.setMouseFilter(_metaFilter);
            } else {
                _linkCreator.setMouseFilter(_controlFilter);
            }
    
    Note the 'getName()' call and the string comparison to "MacOS". Unfortunate
   ly,
    a test on my Mac (OS version 10.3.3) shows that the getName method returns 
    "Mac OS X Aqua" (note the spaces!). Due to the spaces, the names do not mat
   ch 
    and the Mac is NEVER detected!
    
    Apple suggests in their tech note 2042 (http://developer.apple.com/
    documentation/Java/Conceptual/Java131Development/x_platform/
    chapter_5_section_5.html) that the statement
    
    System.getProperty("mrj.version")
    
    should be used to detect a mac, with any non-null result indicating that th
   e 
    machine is a mac. This approach is independent of the string value which ma
   y 
    change.
    
    I did try changing the Kepler code to correct this detection problem. I was
    
    able to get it to properly detect my Mac, but it still does not popup the 
    context menu using the control key + click. Anyone have any ideas?
    
    Incidently, a 2 button mouse plugged into the Mac USB port does work OK wit
   h 
    current code.
    
    Dan Higgins
    NCEAS
    
    
    -------------------------------------------------
    This mail sent through IMP: http://horde.org/imp/
    _______________________________________________
    kepler-dev mailing list
    kepler-dev at ecoinformatics.org
    http://www.ecoinformatics.org/mailman/listinfo/kepler-dev
--------



More information about the Kepler-dev mailing list