use of org.eclipse.search.ui.IQueryListener in project eclipse.platform.text by eclipse.
the class QueryManagerTest method testQueryListener.
@Test
public void testQueryListener() {
final boolean[] wasAdded = { false };
final boolean[] wasRemoved = { false };
IQueryListener l = new IQueryListener() {
@Override
public void queryAdded(ISearchQuery query) {
wasAdded[0] = true;
}
@Override
public void queryRemoved(ISearchQuery query) {
wasRemoved[0] = true;
}
@Override
public void queryStarting(ISearchQuery query) {
// not interested
}
@Override
public void queryFinished(ISearchQuery query) {
// not interested
}
};
NewSearchUI.addQueryListener(l);
ISearchQuery query = new NullQuery();
InternalSearchUI.getInstance().addQuery(query);
assertTrue(wasAdded[0]);
InternalSearchUI.getInstance().removeQuery(query);
assertTrue(wasRemoved[0]);
InternalSearchUI.getInstance().removeQueryListener(l);
wasAdded[0] = false;
wasRemoved[0] = false;
InternalSearchUI.getInstance().addQuery(query);
assertFalse(wasAdded[0]);
InternalSearchUI.getInstance().removeQuery(query);
assertFalse(wasRemoved[0]);
}
use of org.eclipse.search.ui.IQueryListener in project che by eclipse.
the class QueryManager method fireStarting.
public void fireStarting(ISearchQuery query) {
Set copiedListeners = new HashSet();
synchronized (fListeners) {
copiedListeners.addAll(fListeners);
}
Iterator listeners = copiedListeners.iterator();
while (listeners.hasNext()) {
IQueryListener l = (IQueryListener) listeners.next();
l.queryStarting(query);
}
}
use of org.eclipse.search.ui.IQueryListener in project che by eclipse.
the class QueryManager method fireFinished.
public void fireFinished(ISearchQuery query) {
Set copiedListeners = new HashSet();
synchronized (fListeners) {
copiedListeners.addAll(fListeners);
}
Iterator listeners = copiedListeners.iterator();
while (listeners.hasNext()) {
IQueryListener l = (IQueryListener) listeners.next();
l.queryFinished(query);
}
}
use of org.eclipse.search.ui.IQueryListener in project eclipse.platform.text by eclipse.
the class AbstractTextSearchViewPage method createQueryListener.
private IQueryListener createQueryListener() {
return new IQueryListener() {
@Override
public void queryAdded(ISearchQuery query) {
// ignore
}
@Override
public void queryRemoved(ISearchQuery query) {
// ignore
}
@Override
public void queryStarting(final ISearchQuery query) {
final Runnable runnable1 = new Runnable() {
@Override
public void run() {
updateBusyLabel();
AbstractTextSearchResult result = getInput();
if (result == null || !result.getQuery().equals(query)) {
return;
}
turnOffDecoration();
scheduleUIUpdate();
}
};
asyncExec(runnable1);
}
@Override
public void queryFinished(final ISearchQuery query) {
// handle the end of the query in the UIUpdateJob, as ui updates
// may not be finished here.
postEnsureSelection();
}
};
}
use of org.eclipse.search.ui.IQueryListener in project eclipse.platform.text by eclipse.
the class QueryManager method fireFinished.
public void fireFinished(ISearchQuery query) {
Set<IQueryListener> copiedListeners = new HashSet<>();
synchronized (fListeners) {
copiedListeners.addAll(fListeners);
}
Iterator<IQueryListener> listeners = copiedListeners.iterator();
while (listeners.hasNext()) {
IQueryListener l = listeners.next();
l.queryFinished(query);
}
}
Aggregations