@ SuppressWarnings ( "unchecked" ) @ Override public void fillContextMenu ( IMenuManager menu ) { IStructuredSelection selection = ( IStructuredSelection ) getContext ( ) . getSelection ( ) ; boolean hasClosedProjects = false ; Iterator < Object > resources = selection . iterator ( ) ; while ( resources . hasNext ( ) && ( ! hasClosedProjects ) ) { Object next = resources . next ( ) ; IProject project = null ; if ( next instanceof IProject ) { project = ( IProject ) next ; } else if ( next instanceof IAdaptable ) { project = ( IProject ) ( ( IAdaptable ) next ) . getAdapter ( IProject . class ) ; } if ( project == null ) { continue ; } if ( ! project . isOpen ( ) ) { hasClosedProjects = true ; } } if ( ! hasClosedProjects ) { refreshAction . selectionChanged ( selection ) ; menu . appendToGroup ( ICommonMenuConstants . GROUP_BUILD , refreshAction ) ; } }
Adds the refresh resource actions to the context menu .