private void readResourceCustomPropertyDefinitions ( Resources gpResources ) { CustomField field = m_projectFile . getCustomFields ( ) . getCustomField ( ResourceField . TEXT1 ) ; field . setAlias ( "Phone" ) ; for ( CustomPropertyDefinition definition : gpResources . getCustomPropertyDefinition ( ) ) { // // Find the next available field of the correct type. // String type = definition . getType ( ) ; FieldType fieldType = RESOURCE_PROPERTY_TYPES . get ( type ) . getField ( ) ; // // If we have run out of fields of the right type, try using a text field. // if ( fieldType == null ) { fieldType = RESOURCE_PROPERTY_TYPES . get ( "text" ) . getField ( ) ; } // // If we actually have a field available, set the alias to match // the name used in GanttProject. // if ( fieldType != null ) { field = m_projectFile . getCustomFields ( ) . getCustomField ( fieldType ) ; field . setAlias ( definition . getName ( ) ) ; String defaultValue = definition . getDefaultValue ( ) ; if ( defaultValue != null && defaultValue . isEmpty ( ) ) { defaultValue = null ; } m_resourcePropertyDefinitions . put ( definition . getId ( ) , new Pair < FieldType , String > ( fieldType , defaultValue ) ) ; } } }
Read custom property definitions for resources .