Bug 5231 Add search for field read and write references
The UI should support the following new JDT Core feature: Search for field read and field write references. Two new constants have been added on IJavaSearchConstants to be used when creating a field reference search pattern: - READ_REFERENCES: the search results contain *only* read access to a field. - WRITE_REFERENCES: the search results contain *only* write access to a field. If REFERENCES is used, then search results contain both read and write accesss to a field.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/JavaSearchResultCollector.java
public void fill(IMenuManager menu, IInputSelectionProvider inputProvider) {
			JavaPlugin.createStandardGroups(menu);
			new JavaSearchGroup().fill(menu, new GroupContext(inputProvider));
			OpenTypeHierarchyUtil.addToMenu(getWorbenchWindow(), menu, convertSelection(inputProvider.getSelection()));
		}
		
		private Object convertSelection(ISelection selection) {
			Object element= SelectionUtil.getSingleElement(selection);
			if (!(element instanceof ISearchResultViewEntry))
				return null;
			IMarker marker= ((ISearchResultViewEntry)element).getSelectedMarker();
			try {
				return JavaCore.create((String) ((IMarker) marker).getAttribute(IJavaSearchUIConstants.ATT_JE_HANDLE_ID));	
			} catch (CoreException ex) {
				ExceptionHandler.log(ex, SearchMessages.getString("Search.Error.createJavaElement.message")); 
				return null;
			}
		}
	}
	
	public JavaSearchResultCollector() {
		fContextMenu= new ContextMenuContributor();
	}
	/**
	 * @see IJavaSearchResultCollector#aboutToStart().
	 */
	public void aboutToStart() {
		fView= SearchUI.getSearchResultView();
		fMatchCount= 0;
		if (fView != null) {