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
return;
					}
					removeQualification(doc, nameStart, chosen);
					
					CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings();
					AddImportsOperation op= new AddImportsOperation(cu, new IJavaElement[] { type }, settings, false);
					ProgressMonitorDialog dialog= new ProgressMonitorDialog(getShell());
					try {
						dialog.run(false, true, new WorkbenchRunnableAdapter(op));
					} catch (InvocationTargetException e) {
						JavaPlugin.log(e);
						MessageDialog.openError(getShell(), JavaEditorMessages.getString("AddImportOnSelection.error.title"), e.getTargetException().getMessage()); 
					} catch (InterruptedException e) {
						
					}
					return;
				} catch (CoreException e) {
					JavaPlugin.log(e);
					ErrorDialog.openError(getShell(), JavaEditorMessages.getString("AddImportOnSelection.error.title"), null, e.getStatus()); 
				} catch (BadLocationException e) {
					JavaPlugin.log(e);
					MessageDialog.openError(getShell(), JavaEditorMessages.getString("AddImportOnSelection.error.title"), e.getMessage()); 
				}
			}
		}		
	}
	
	private int getNameStart(IDocument doc, int pos) throws BadLocationException {
		while (pos > 0) {
			char ch= doc.getChar(pos - 1);