Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Tanasenko2014-10-20 12:43:58 +0000
committerAnton Tanasenko2014-10-20 12:43:58 +0000
commita8ea3e9e2d8b160520f31bb2e0658334e3dd9d85 (patch)
treee7ebd99a80d2769c5f53b83961b05e9124658e35 /org.eclipse.m2e.editor
parentd4d419e25f375b5ee4916f23bf8e8f0d12cf8e92 (diff)
downloadm2e-core-a8ea3e9e2d8b160520f31bb2e0658334e3dd9d85.tar.gz
m2e-core-a8ea3e9e2d8b160520f31bb2e0658334e3dd9d85.tar.xz
m2e-core-a8ea3e9e2d8b160520f31bb2e0658334e3dd9d85.zip
447914 Defer 'as you type' filter on pom viewer's dependency tree page
Change-Id: Id08cedb034f77d78e987f5cb172e8b2dba2d8826 Signed-off-by: Anton Tanasenko <atg.sleepless@gmail.com>
Diffstat (limited to 'org.eclipse.m2e.editor')
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/DependencyTreePage.java25
1 files changed, 18 insertions, 7 deletions
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/DependencyTreePage.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/DependencyTreePage.java
index 12216488..6cbbf3cf 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/DependencyTreePage.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/DependencyTreePage.java
@@ -80,6 +80,7 @@ import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.progress.UIJob;
+import org.eclipse.ui.progress.WorkbenchJob;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
@@ -582,23 +583,33 @@ public class DependencyTreePage extends FormPage implements IMavenProjectChanged
form.updateToolBar();
- searchControl.getSearchText().addFocusListener(new FocusAdapter() {
- public void focusGained(FocusEvent e) {
+ // 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") {
+ public IStatus runInUIThread(IProgressMonitor monitor) {
isSettingSelection = true;
selectListElements(searchMatcher);
selectTreeElements(searchMatcher);
setTreeFilter(searchFilter, false);
isSettingSelection = false;
+ return Status.OK_STATUS;
+ }
+ };
+
+ searchControl.getSearchText().addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ // The net effect here is that the field will update 200 ms after
+ // the user stops typing.
+ updateJob.cancel();
+ updateJob.schedule(200);
}
});
searchControl.getSearchText().addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
- isSettingSelection = true;
- selectListElements(searchMatcher);
- selectTreeElements(searchMatcher);
- setTreeFilter(searchFilter, false);
- isSettingSelection = false;
+ updateJob.cancel();
+ updateJob.schedule(200);
}
});
}

Back to the top