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/JavaSearchPage.java
IJavaElement element= (IJavaElement)((IAdaptable)o).getAdapter(IJavaElement.class);
			if (element != null) {
				result= determineInitValuesFrom(element);
			} else {
				IWorkbenchAdapter adapter= (IWorkbenchAdapter)((IAdaptable)o).getAdapter(IWorkbenchAdapter.class);
				result= new SearchPatternData(TYPE, REFERENCES, adapter.getLabel(o), null);
			}
		}
		return result;
	}
	private IJavaElement getJavaElement(IMarker marker) {
		try {
			return JavaCore.create((String)marker.getAttribute(IJavaSearchUIConstants.ATT_JE_HANDLE_ID));
		} catch (CoreException ex) {
			ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.createJavaElement.title"), SearchMessages.getString("Search.Error.createJavaElement.message")); 
			return null;
		}
	}
	
	private SearchPatternData determineInitValuesFrom(IJavaElement element) {
		if (element == null)
			return null;
		int searchFor= UNKNOWN;
		int limitTo= UNKNOWN;
		String pattern= null; 
		switch (element.getElementType()) {
			case IJavaElement.PACKAGE_FRAGMENT:
				searchFor= PACKAGE;
				limitTo= REFERENCES;
				pattern= element.getElementName();