use of org.eclipse.m2e.editor.pom.SearchMatcher in project m2e-core by eclipse-m2e.
the class DependenciesComposite method setSearchControl.
public void setSearchControl(SearchControl searchControl) {
if (this.searchControl != null) {
return;
}
this.searchMatcher = new SearchMatcher(searchControl);
this.searchFilter = new DependencyFilter(searchMatcher);
this.searchControl = searchControl;
// we add filter here as the default behaviour is to filter..
final TableViewer dependenciesViewer = dependenciesEditor.getViewer();
dependenciesViewer.addFilter(searchFilter);
final TableViewer dependencyManagementViewer = dependencyManagementEditor.getViewer();
dependencyManagementViewer.addFilter(searchFilter);
// Create a job to update the contents of the viewers when the
// filter text is modified. Using a job is in this way lets us
// defer updating the field while the user is typing.
final Job updateJob = new WorkbenchJob("Update Maven Dependency Viewers") {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
dependenciesViewer.refresh();
dependencyManagementViewer.refresh();
return Status.OK_STATUS;
}
};
// Run the update job when the user modifies the filter text.
this.searchControl.getSearchText().addModifyListener(e -> {
// The net effect here is that the field will update 200 ms after
// the user stops typing.
updateJob.cancel();
updateJob.schedule(200);
});
}
Aggregations