Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2010 itemis AG (http://www.itemis.eu) and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html /
  
  package org.eclipse.xtext.ui.editor.findrefs;
  
 import java.util.List;
 
 import  org.eclipse.jface.resource.ImageDescriptor;
 import  org.eclipse.search.ui.ISearchQuery;
 import  org.eclipse.search.ui.ISearchResult;
 import  org.eclipse.search.ui.ISearchResultListener;
 import  org.eclipse.search.ui.SearchResultEvent;
 

Author(s):
Jan Koehnlein - Initial contribution and API
 
 public class ReferenceSearchResult implements ISearchResult, IAcceptor<IReferenceDescription> {
 
 	private ReferenceQuery query;
 
 
 	private List<ISearchResultListener> listeners;
 
 	protected ReferenceSearchResult(ReferenceQuery query) {
 		this. = query;
 		 = Lists.newArrayList();
 	}
 
 	public void addListener(ISearchResultListener l) {
 		synchronized () {
 			listeners.add(l);
 		}
 	}
 
 	public void removeListener(ISearchResultListener l) {
 		synchronized () {
 			listeners.remove(l);
 		}
 	}
 
 	void fireEvent(SearchResultEvent searchResultEvent) {
 		synchronized () {
 			for (ISearchResultListener listener : listeners) {
 				listener.searchResultChanged(searchResultEvent);
 			}
 		}
 	}
 
 	public ImageDescriptor getImageDescriptor() {
 		return null;
 	}
 
 	public String getLabel() {
 		return .getLabel();
 	}
 
 	public ISearchQuery getQuery() {
 		return ;
 	}
 
 	public String getTooltip() {
 		return getLabel();
 	}
 
 	public void accept(IReferenceDescription referenceDescription) {
 		if(.getFilter().apply(referenceDescription)) {
 			.add(referenceDescription);
 			fireEvent(new ReferenceSearchResultEvents.Added(thisreferenceDescription));
 		}
 	}
 
 	}
 
 	public void reset() {
 	}
 
 	public void finish() {
	}
New to GrepCode? Check out our FAQ X