FileDocCategorySizeDatePackage
FinderIntegrationPlugin.javaAPI DocExample2142Wed Jul 17 00:28:14 BST 2002com.wiverson.macosbook.plugin

FinderIntegrationPlugin

public class FinderIntegrationPlugin extends Object implements com.wiverson.macosbook.SimpleEditPlugin

Fields Summary
boolean
isMacOS
Constructors Summary
public FinderIntegrationPlugin()
Creates a new instance of FinderIntegrationPlugin

    
Methods Summary
public voiddoAction(com.wiverson.macosbook.SimpleEdit frame, java.awt.event.ActionEvent evt)

        return;
    
public java.lang.StringgetAction()

        if(isMacOS)
            return "Mac OS Installed";
        else
            return "Mac OS Not Available";
    
public voidinit(com.wiverson.macosbook.SimpleEdit frame)
Checks to see if Mac OS is available. If so, goes ahead and loads the class by name that actually performs the initialization. If not, the class is never loaded. This helps prevent classloader problems on non-Mac OS systems.

    
                                                
    
       
    
        if(System.getProperty("mrj.version") != null)
            isMacOS = true;
        
        if(isMacOS)
        {
            try
            {
                // This requests the classloader to find a
                // given class by name.  We are using this to
                // establish a firewall between the application
                // and Mac OS X dependencies.  This helps isolate
                // the application logic for organizational purposes,
                // as well as ensure that we won't try to drag Mac OS
                // references into our crossplatform code.
                Class myClass = Class.forName("com.wiverson.macosbook.plugin.FinderIntegration");
                
                Object myObject = myClass.getConstructor(null).newInstance(null);
                myClass.getDeclaredMethod("execute", null).invoke(myObject, null);;
            } catch (Exception e)
            {
                System.out.println("Unable to load FinderIntegration module.");
                e.printStackTrace();
            }
        }