@ SuppressWarnings ( { "checkstyle:magicnumber" , "checkstyle:npathcomplexity" } ) protected void addSourceFolders ( IMavenProjectFacade facade , SARLConfiguration config , IClasspathDescriptor classpath , IProgressMonitor monitor ) throws CoreException { assertHasNature ( facade . getProject ( ) , SARLEclipseConfig . NATURE_ID ) ; assertHasNature ( facade . getProject ( ) , SARLEclipseConfig . XTEXT_NATURE_ID ) ; assertHasNature ( facade . getProject ( ) , JavaCore . NATURE_ID ) ; final String encoding = config . getEncoding ( ) ; final SubMonitor subMonitor = SubMonitor . convert ( monitor , 4 ) ; // // Add the source folders // // Input folder, e.g. "src/main/sarl" final IPath inputPath = makeFullPath ( facade , config . getInput ( ) ) ; final IFolder inputFolder = ensureFolderExists ( facade , inputPath , false , subMonitor ) ; if ( encoding != null && inputFolder != null && inputFolder . exists ( ) ) { inputFolder . setDefaultCharset ( encoding , monitor ) ; } IClasspathEntryDescriptor descriptor = classpath . addSourceEntry ( inputPath , facade . getOutputLocation ( ) , false ) ; descriptor . setPomDerived ( true ) ; subMonitor . worked ( 1 ) ; // Input folder, e.g. "src/main/generated-sources/sarl" final IPath outputPath = makeFullPath ( facade , config . getOutput ( ) ) ; final IFolder outputFolder = ensureFolderExists ( facade , outputPath , true , subMonitor ) ; if ( encoding != null && outputFolder != null && outputFolder . exists ( ) ) { outputFolder . setDefaultCharset ( encoding , monitor ) ; } descriptor = classpath . addSourceEntry ( outputPath , facade . getOutputLocation ( ) , false ) ; descriptor . setPomDerived ( true ) ; descriptor . setClasspathAttribute ( IClasspathAttribute . IGNORE_OPTIONAL_PROBLEMS , Boolean . TRUE . toString ( ) ) ; subMonitor . worked ( 1 ) ; // Test input folder, e.g. "src/test/sarl" final IPath testInputPath = makeFullPath ( facade , config . getTestInput ( ) ) ; final IFolder testInputFolder = ensureFolderExists ( facade , testInputPath , false , subMonitor ) ; if ( encoding != null && testInputFolder != null && testInputFolder . exists ( ) ) { testInputFolder . setDefaultCharset ( encoding , monitor ) ; } descriptor = classpath . addSourceEntry ( testInputPath , facade . getTestOutputLocation ( ) , true ) ; descriptor . setPomDerived ( true ) ; descriptor . setClasspathAttribute ( IClasspathAttribute . TEST , Boolean . TRUE . toString ( ) ) ; subMonitor . worked ( 1 ) ; // Test input folder, e.g. "src/test/generated-sources/sarl" final IPath testOutputPath = makeFullPath ( facade , config . getTestOutput ( ) ) ; final IFolder testOutputFolder = ensureFolderExists ( facade , testOutputPath , true , subMonitor ) ; if ( encoding != null && testOutputFolder != null && testOutputFolder . exists ( ) ) { testOutputFolder . setDefaultCharset ( encoding , monitor ) ; } descriptor = classpath . addSourceEntry ( testOutputPath , facade . getTestOutputLocation ( ) , true ) ; descriptor . setPomDerived ( true ) ; descriptor . setClasspathAttribute ( IClasspathAttribute . IGNORE_OPTIONAL_PROBLEMS , Boolean . TRUE . toString ( ) ) ; descriptor . setClasspathAttribute ( IClasspathAttribute . TEST , Boolean . TRUE . toString ( ) ) ; subMonitor . done ( ) ; }
Invoked to add the source folders .