Bug 24040 JavaBrowsingPerspective - the packages/types and members view clear selection and then contents when an IStructuredSelection event is fired that isn't an IJavaElement
We have an editor in WebSphere Studio that is able to be opened on a .java source file. In this editor the user can select objects. When this occurs in the Java Browsing Perspective the packages/types and members views are cleared out of their contents. It would be nicer if the views weren't clear out. The reason the views are cleared is codein org.eclipse.jdt.internal.ui.browsing.JavaBrowsingPart. This listens to selection and if the selection is an IStructuredSelection ( which our editorpart signals ) it first de-selects the selected items in the editor and then clears the editor contents. If the selection is an IStructuredSelection and the items implement IAdapter but don't return an IJavaElement then the behavior should be the same as for a TextSelectionEvent which the Java Editor fires right now as the user selects text and doesn't reset the viewers' contents to null.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
}
	void adjustInputAndSetSelection(IJavaElement je) {
		IJavaElement elementToSelect= getSuitableJavaElement(findElementToSelect(je));
		IJavaElement newInput= findInputForJavaElement(je);
		if (elementToSelect == null && !isValidInput(newInput))
			
			setInput(null);
		else if (elementToSelect == null || getViewer().testFindItem(elementToSelect) == null) {
			
			setInput(newInput);
			
			elementToSelect= getSuitableJavaElement(elementToSelect);
		}
		
		if (elementToSelect != null && elementToSelect.exists())
			setSelection(new StructuredSelection(elementToSelect), true);
		else
			setSelection(StructuredSelection.EMPTY, true);
	}
	/**
	 * Finds the closest Java element which can be used as input for
	 * this part and has the given Java element as child
	 * 
	 * @param 	je 	the Java element for which to search the closest input
	 * @return	the closest Java element used as input for this part
	 */
	protected IJavaElement findInputForJavaElement(IJavaElement je) {
		if (je == null || !je.exists())
			return null;
		if (isValidInput(je))