Bug 18163 Add Import should ignore leading/trailing whitespace
It often happens to me that I have selected i.e. "Node " instead of "Node" because I made my selection by using "Shift + Ctrl + Right". When I then use Ctrl+M (Add Import) nothing happens because of the trailing whitespace within the selection.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/AddImportOnSelectionAction.java
if (doc.getChar(nameStart + containerLen) == '.') {
				doc.replace(nameStart, containerLen + 1, ""); 
			}
		}
	}	
	/**
	 * Finds a type by the simple name.
	 */
	private static TypeInfo[] findAllTypes(String simpleTypeName, IJavaSearchScope searchScope, IProgressMonitor monitor) throws CoreException {
		SearchEngine searchEngine= new SearchEngine();
		
		ArrayList typeRefsFound= new ArrayList(10);
		ITypeNameRequestor requestor= new TypeInfoRequestor(typeRefsFound);
		searchEngine.searchAllTypeNames(
			JavaPlugin.getWorkspace(), 
			null, 
			simpleTypeName.toCharArray(), 
			IJavaSearchConstants.EXACT_MATCH, 
			IJavaSearchConstants.CASE_SENSITIVE, 
			IJavaSearchConstants.TYPE, 
			searchScope, 
			requestor, 
			IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, 
			monitor);
			
		return (TypeInfo[]) typeRefsFound.toArray(new TypeInfo[typeRefsFound.size()]);
	}
	
	private Shell getShell() {
		return fEditor.getSite().getShell();