public void addMasterListeners()
    {
        super.addMasterListeners();
        this.getField(ProgramControl.LAST_PACKAGE_UPDATE).setEnabled(false);
        
        this.addListener(new FileListener()
        {
            public void doNewRecord(boolean bDisplayOption)
            {
                super.doNewRecord(bDisplayOption);
                
                PropertiesStringField field = (PropertiesStringField)this.getOwner().getField(ProgramControl.BASE_DIRECTORY);
                field.enableConversion = false;
                if (!field.isModified())
                    if (field.getDefault().equals(field.getData()))
                {
                    try {
                        String home = System.getProperty("user.home");
                        String current = System.getProperty("user.dir");
                        if (!home.equals(current))
                            if (current.startsWith(home))
                        {   // Set the base directory to the current directories' home
                            current = Utility.addToPath((String)field.getDefault(), current.substring(home.length()));
                            int lastPathSeparator = current.lastIndexOf(File.separator);
                            if (lastPathSeparator == -1)
                                lastPathSeparator = current.lastIndexOf('/');
                            if (lastPathSeparator != -1)
                            {
                                ((InitOnceFieldHandler)field.getListener(InitOnceFieldHandler.class)).setFirstTime(true);
                                field.setString(current.substring(0, lastPathSeparator), DBConstants.DISPLAY, DBConstants.INIT_MOVE);
                            }
                        }
                    } catch (SecurityException e) {
                        // Ignore (default is fine)
                    }
                }
                field.enableConversion = true;
            }
        });
    }
public void addMasterListeners ( ) { super . addMasterListeners ( ) ; this . getField ( ProgramControl . LAST_PACKAGE_UPDATE ) . setEnabled ( false ) ; this . addListener ( new FileListener ( ) { public void doNewRecord ( boolean bDisplayOption ) { super . doNewRecord ( bDisplayOption ) ; PropertiesStringField field = ( PropertiesStringField ) this . getOwner ( ) . getField ( ProgramControl . BASE_DIRECTORY ) ; field . enableConversion = false ; if ( ! field . isModified ( ) ) if ( field . getDefault ( ) . equals ( field . getData ( ) ) ) { try { String home = System . getProperty ( "user.home" ) ; String current = System . getProperty ( "user.dir" ) ; if ( ! home . equals ( current ) ) if ( current . startsWith ( home ) ) { current = Utility . addToPath ( ( String ) field . getDefault ( ) , current . substring ( home . length ( ) ) ) ; int lastPathSeparator = current . lastIndexOf ( File . separator ) ; if ( lastPathSeparator == - 1 ) lastPathSeparator = current . lastIndexOf ( '/' ) ; if ( lastPathSeparator != - 1 ) { ( ( InitOnceFieldHandler ) field . getListener ( InitOnceFieldHandler . class ) ) . setFirstTime ( true ) ; field . setString ( current . substring ( 0 , lastPathSeparator ) , DBConstants . DISPLAY , DBConstants . INIT_MOVE ) ; } } } catch ( SecurityException e ) { } } field . enableConversion = true ; } } ) ; }
AddMasterListeners Method.