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
IResource resource= resources[r];
					if (resource.getType() == IResource.PROJECT) {
						checkLocationDeleted((IProject) resource);
					} else if (resource.getType() == IResource.ROOT) {
						IProject[] projects = ((IWorkspaceRoot)resource).getProjects();
						for (int p = 0; p < projects.length; p++) {
							checkLocationDeleted(projects[p]);
						}
					}
					resource.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 1));
					IJavaElement jElement= JavaCore.create(resource);
					if (jElement != null && jElement.exists())
						javaElements.add(jElement);
				}
				IJavaModel model= JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
				model.refreshExternalArchives(
					(IJavaElement[]) javaElements.toArray(new IJavaElement[javaElements.size()]),
					new SubProgressMonitor(monitor, resources.length));
			}
		};
		
		try {
			new ProgressMonitorDialog(getShell()).run(true, true, new WorkbenchRunnableAdapter(operation));
		} catch (InvocationTargetException e) {
			ExceptionHandler.handle(e, getShell(), 
				ActionMessages.getString("RefreshAction.error.title"),  
				ActionMessages.getString("RefreshAction.error.message")); 
		} catch (InterruptedException e) {
			
		}