org.eclipse.search.ui.SearchResultEvent Java Examples

The following examples show how to use org.eclipse.search.ui.SearchResultEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FastReferenceSearchResultContentProvider.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void searchResultChanged(final SearchResultEvent e) {
  if (e instanceof Added) {
    addReference(((Added) e).getReferenceDescription());
    if (!isUIUpdateScheduled) {
      isUIUpdateScheduled = true;
      new UIUpdater().schedule();
    }
  } else if (e instanceof Reset) {
    PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
      @Override
      public void run() {
        synchronized (viewer) {
          viewer.remove(viewer.getInput(), Iterables.toArray(rootNodes.values(), ReferenceSearchViewTreeNode.class));
          rootNodes.clear();
        }
        viewer.refresh();
        viewer.expandToLevel(1);
      }
    });
  }
}
 
Example #2
Source File: ReferenceSearchResult.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
void fireEvent(SearchResultEvent searchResultEvent) {
	synchronized (listeners) {
		for (ISearchResultListener listener : listeners) {
			listener.searchResultChanged(searchResultEvent);
		}
	}
}
 
Example #3
Source File: ReferenceSearchResultContentProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void searchResultChanged(final SearchResultEvent e) {
	synchronized (batchedSearchResultEvents) {
		batchedSearchResultEvents.add(e);
	}
	if (!isUIUpdateScheduled) {
		isUIUpdateScheduled = true;
		new UIUpdater().schedule();
	}
}
 
Example #4
Source File: ReferenceSearchResultContentProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
	isUIUpdateScheduled = false;
	List<SearchResultEvent> events;
	synchronized (batchedSearchResultEvents) {
		events = new ArrayList<>(batchedSearchResultEvents);
		batchedSearchResultEvents.clear();
	}
	for (SearchResultEvent event : events) {
		if (monitor.isCanceled()) {
			return Status.CANCEL_STATUS;
		}
		if (event instanceof Added) {
			addReference(((Added) event).getReferenceDescription(), true);
		} else if (event instanceof Reset) {
			if (rootNodes != null && !rootNodes.isEmpty()) {
				synchronized (viewer) {
					viewer.remove(viewer.getInput(), rootNodes.toArray());
					rootNodes = null;
				}
			}
		}
	}
	viewer.refresh();
	expandToFirstChild();
	return Status.OK_STATUS;
}
 
Example #5
Source File: CompositeSearchResult.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
public CompositeSearchResult(CompositeSearchQuery compositeSearchQuery) {
	super(compositeSearchQuery);
	this.query = compositeSearchQuery;
	Assert.isLegal(!query.getChildren().isEmpty());
	childListener = new ISearchResultListener() {
		int removeAll = 0;
		@Override
		public void searchResultChanged(SearchResultEvent e) {
			if(!(e instanceof RemoveAllEvent) || removeAll++%query.getChildren().size() == 0)
				fireChange(e);
		}
	};
	for(ISearchQuery child: query.getChildren()) 
		child.getSearchResult().addListener(childListener);
}