Bug 5475 F4 causes loss of context when called from a method view
1) Open a class with many methods 2) Make sure "show of source element only" is selected 3) Choose a method 4) Press F4 with no selection The class is open on the hierarchy view and the full source is shown in the editor. The method focus was lost. You have to find and select the method again.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/typehierarchy/TypeHierarchyViewPart.java
* Creates the context menu for the method viewer
	 */	
	private void fillMethodsViewerContextMenu(IMenuManager menu) {
		JavaPlugin.createStandardGroups(menu);
		
		fMethodsViewer.contributeToContextMenu(menu);
		if (fSelectedType != null &&  fAddStubAction.init(fSelectedType, fMethodsViewer.getSelection())) {
			menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, fAddStubAction);
		}
		menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, new JavaReplaceWithEditionAction(fMethodsViewer));	
		addOpenWithMenu(menu, (IStructuredSelection)fMethodsViewer.getSelection());
		addRefactoring(menu, fMethodsViewer);
		ContextMenuGroup.add(menu, new ContextMenuGroup[] { new BuildGroup(), new ReorgGroup() }, fMethodsViewer);
	}
	
	private void addRefactoring(IMenuManager menu, IInputSelectionProvider viewer){
		MenuManager refactoring= new MenuManager(TypeHierarchyMessages.getString("TypeHierarchyViewPart.menu.refactor")); 
		ContextMenuGroup.add(refactoring, new ContextMenuGroup[] { new RefactoringGroup() }, viewer);
		if (!refactoring.isEmpty())
			menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, refactoring);
	}
	
	private void addOpenWithMenu(IMenuManager menu, IStructuredSelection selection) {
		
		
		if (selection.size() != 1)
			return;
		Object element= selection.getFirstElement();
		if (!(element instanceof IJavaElement))
			return;