public static void addFindBugsNature ( IProject project , IProgressMonitor monitor ) throws CoreException { if ( hasFindBugsNature ( project ) ) { return ; } IProjectDescription description = project . getDescription ( ) ; String [ ] prevNatures = description . getNatureIds ( ) ; for ( int i = 0 ; i < prevNatures . length ; i ++ ) { if ( FindbugsPlugin . NATURE_ID . equals ( prevNatures [ i ] ) ) { // nothing to do return ; } } String [ ] newNatures = new String [ prevNatures . length + 1 ] ; System . arraycopy ( prevNatures , 0 , newNatures , 0 , prevNatures . length ) ; newNatures [ prevNatures . length ] = FindbugsPlugin . NATURE_ID ; if ( DEBUG ) { for ( int i = 0 ; i < newNatures . length ; i ++ ) { System . out . println ( newNatures [ i ] ) ; } } description . setNatureIds ( newNatures ) ; project . setDescription ( description , monitor ) ; }
Adds a FindBugs nature to a project .