Bug 13196 [Browsing] Consequences of changes
From the user's perspective, there is an unexpected behavioral difference when manipulation source in the type hierarchy and in the method list of the browser perspective. 1) open Java Browsing Perspective 2) select a type 3) select a method in the method list view 4) delete the method (context menu of the method list view) -> editor becomes dirty (ok) 5) select another type 6) open type hierarchy on this type, dock the hierachy view 7) select a method in the method list view 8) select the same method in the hierarchy view 9) delete the method (context menu of the hierarchy view) -> method is deleted on file system, type list view, method list view, editor are all cleared Note: This is not the case when the editor is dirty. Then both manipulations behave the same. Expected behavior: If there is an open editor, all manipulations should just work on the working copy shown in the editor.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/typehierarchy/MethodsViewer.java
IMethod similar= findSimilarMethod(method, currElements);
							if (similar != null) {
								newSelectionElements.add(similar);
							}
						}
					}
				}
				newSelection= new StructuredSelection(newSelectionElements);
			} catch (JavaModelException e) {
				JavaPlugin.log(e);
			}
		}
		setSelection(newSelection);
		updateSelection(newSelection);
	}
	
	private IMethod findSimilarMethod(IMethod meth, Object[] elements) throws JavaModelException {
		String name= meth.getElementName();
		String[] paramTypes= meth.getParameterTypes();
		boolean isConstructor= meth.isConstructor();
		
		for (int i= 0; i < elements.length; i++) {
			Object curr= elements[i];
			if (curr instanceof IMethod && JavaModelUtil.isSameMethodSignature(name, paramTypes, isConstructor, (IMethod) curr)) {
				return (IMethod) curr;
			}
		}
		return null;
	}
}