Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2011-10-15 16:07:48 +0000
committerSteffen Pingel2011-10-15 16:07:48 +0000
commit9bf7a5a0aff59e9e3c5c7621a7f80f15385d586d (patch)
tree611f1f583b7c39dd57ccb94ad7329fe13fa5ce66
parenta7678547546a532e0b761904e7789db1e7572aa6 (diff)
downloadorg.eclipse.mylyn.tasks-9bf7a5a0aff59e9e3c5c7621a7f80f15385d586d.tar.gz
org.eclipse.mylyn.tasks-9bf7a5a0aff59e9e3c5c7621a7f80f15385d586d.tar.xz
org.eclipse.mylyn.tasks-9bf7a5a0aff59e9e3c5c7621a7f80f15385d586d.zip
REOPENED - bug 330167: add "Clear Fields" button to query and task
search page https://bugs.eclipse.org/bugs/show_bug.cgi?id=330167
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryPage.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryPage.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryPage.java
index 76db864d4..76d2a40e9 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryPage.java
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryPage.java
@@ -12,7 +12,9 @@
package org.eclipse.mylyn.internal.trac.ui.wizard;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
+import java.util.Set;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -114,6 +116,11 @@ public class TracQueryPage extends AbstractRepositoryQueryPage2 {
}
}
+ @Override
+ public void clear() {
+ list.deselectAll();
+ }
+
// public void selectItems(String[] items) {
// list.deselectAll();
// for (String item : items) {
@@ -147,6 +154,8 @@ public class TracQueryPage extends AbstractRepositoryQueryPage2 {
public abstract void setFilter(TracSearchFilter filter);
+ public abstract void clear();
+
}
private class TextSearchField extends SearchField {
@@ -232,6 +241,12 @@ public class TracQueryPage extends AbstractRepositoryQueryPage2 {
searchText.setText(text);
}
+ @Override
+ public void clear() {
+ searchText.setText(""); //$NON-NLS-1$
+ conditionCombo.select(0);
+ }
+
}
private class UserSearchField extends SearchField {
@@ -262,6 +277,11 @@ public class TracQueryPage extends AbstractRepositoryQueryPage2 {
setSelection(index);
}
+ @Override
+ public void clear() {
+ textField.clear();
+ }
+
}
private final TextSearchField textField;
@@ -307,6 +327,11 @@ public class TracQueryPage extends AbstractRepositoryQueryPage2 {
userCombo.select(index);
}
+ @Override
+ public void clear() {
+ textField.clear();
+ }
+
}
private static final int HEIGHT_PRODUCT = 60;
@@ -353,6 +378,7 @@ public class TracQueryPage extends AbstractRepositoryQueryPage2 {
super(PAGE_NAME, repository, query);
setTitle(Messages.TracQueryPage_Enter_query_parameters);
setDescription(Messages.TracQueryPage_If_attributes_are_blank_or_stale_press_the_Update_button);
+ setNeedsClear(true);
}
@Override
@@ -383,6 +409,11 @@ public class TracQueryPage extends AbstractRepositoryQueryPage2 {
}
@Override
+ protected void doClearControls() {
+ restoreWidgetValues(new TracSearch());
+ }
+
+ @Override
public IDialogSettings getDialogSettings() {
IDialogSettings settings = TracUiPlugin.getDefault().getDialogSettings();
IDialogSettings dialogSettings = settings.getSection(PAGE_NAME);
@@ -424,16 +455,23 @@ public class TracQueryPage extends AbstractRepositoryQueryPage2 {
}
private void restoreWidgetValues(TracSearch search) {
+ Set<SearchField> allFields = new HashSet<SearchField>(searchFieldByName.values());
+
java.util.List<TracSearchFilter> filters = search.getFilters();
for (TracSearchFilter filter : filters) {
SearchField field = searchFieldByName.get(filter.getFieldName());
if (field != null) {
field.setFilter(filter);
+ allFields.remove(field);
} else {
StatusHandler.log(new Status(IStatus.WARNING, TracUiPlugin.ID_PLUGIN,
"Ignoring invalid search filter: " + filter)); //$NON-NLS-1$
}
}
+
+ for (SearchField field : allFields) {
+ field.clear();
+ }
}
@Override

Back to the top