Bug 31962 Package Explorer context menu should not allow refresh on a closed project
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/RefreshAction.java
*/
	protected void selectionChanged(IStructuredSelection selection) {
		setEnabled(checkEnabled(selection));
	}
	private boolean checkEnabled(IStructuredSelection selection) {
		if (selection.isEmpty())
			return true;
		for (Iterator iter= selection.iterator(); iter.hasNext();) {
			Object element= (Object) iter.next();
			if (element instanceof IAdaptable) {
				IResource resource= (IResource)((IAdaptable)element).getAdapter(IResource.class);
				if (resource == null)
					return false;
			} else {
				return false;
			}
		}
		return true;
	}
	/* (non-Javadoc)
	 * Method declared in SelectionDispatchAction
	 */
	protected void run(IStructuredSelection selection) {
		final IResource[] resources= getResources(selection);
		IWorkspaceRunnable operation= new IWorkspaceRunnable() {
			public void run(IProgressMonitor monitor) throws CoreException {
				monitor.beginTask(ActionMessages.getString("RefreshAction.progressMessage"), resources.length * 2); 
				monitor.subTask(""); 
				List javaElements= new ArrayList(5);
				for (int r= 0; r < resources.length; r++) {