protected String autoFillBaseSettings ( ) { ISelection selection = PlatformUI . getWorkbench ( ) . getActiveWorkbenchWindow ( ) . getSelectionService ( ) . getSelection ( ) ; // .getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection(); if ( selection instanceof TreeSelection ) { TreeSelection tSelection = ( TreeSelection ) selection ; if ( tSelection . getFirstElement ( ) != null && tSelection . getFirstElement ( ) instanceof IProject ) { String name = ( ( IProject ) tSelection . getFirstElement ( ) ) . getName ( ) ; if ( name != null && name . trim ( ) . length ( ) > 0 ) { fProjectText . setText ( name ) ; String launchConfigName = DebugPlugin . getDefault ( ) . getLaunchManager ( ) . generateLaunchConfigurationName ( name ) ; return launchConfigName ; } } } return null ; }
Gets the last selected project in the platform if selection is tree selection