Bug 29156 Highlight all occurances of local Java variable
Sorry if this is a duplicate of the one I wrote this morning as I did not get any confirmation. My browser didn't show the confirmation either. Earlier I had requested this feature and I was told that API did not support this kind of search. I recently discovered CTL-1 mechanism and found that it allowed me to rename local variables. I see an opportunity here. If CTL-1 can rename all occurances of a local variable, data member etc, it should also be able to provide an option "highlight all occurances" in the same drop down box. It is a natural place as before I rename I should be able to view all occurance that I am renaming. I hope this makes sense and will fulfill a long time request to bring about ease of development and maintanance of code.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/JavaCorrectionProcessor.java
proposals.add(new NoCorrectionProposal(null, null));
		}
		ICompletionProposal[] res= (ICompletionProposal[]) proposals.toArray(new ICompletionProposal[proposals.size()]);
		Arrays.sort(res, new CorrectionsComparator());
		return res;
	}
	
	private boolean isAtPosition(int offset, Position pos) {
		return (pos != null) && (offset >= pos.getOffset() && offset <= (pos.getOffset() +  pos.getLength()));
	}
	
	private void processProblemAnnotations(ICompilationUnit cu, IAnnotationModel model, int offset, int length, ArrayList proposals) {
		CorrectionContext context= new CorrectionContext(cu);
		
		boolean noProbemFound= true;
		HashSet idsProcessed= new HashSet();
		Iterator iter= new ProblemAnnotationIterator(model, true);
		while (iter.hasNext()) {
			IProblemAnnotation annot= (IProblemAnnotation) iter.next();
			Position pos= model.getPosition((Annotation) annot);
			if (isAtPosition(offset, pos)) {
				int problemId= annot.getId();
				if (problemId != -1) {
					if (idsProcessed.add(new Integer(problemId))) { 
						context.initialize(pos.getOffset(), pos.getLength(), annot.getId(), annot.getArguments());
						collectCorrections(context, proposals);
						if (proposals.isEmpty()) {
							
						}
					}