Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2006-12-31 21:51:09 +0000
committerspingel2006-12-31 21:51:09 +0000
commitc8262c7371815d064849d44afec81401ff51e69d (patch)
tree1a7fcde4e203ee6567f8b5feffc189a2a8ecd1f3 /org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model
parentdb80931a3f92652ffe759b7a3fc916ba24bd618f (diff)
downloadorg.eclipse.mylyn.tasks-c8262c7371815d064849d44afec81401ff51e69d.tar.gz
org.eclipse.mylyn.tasks-c8262c7371815d064849d44afec81401ff51e69d.tar.xz
org.eclipse.mylyn.tasks-c8262c7371815d064849d44afec81401ff51e69d.zip
NEW - bug 167188: Trac search page doesn't remember previous query details
https://bugs.eclipse.org/bugs/show_bug.cgi?id=167188
Diffstat (limited to 'org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model')
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracSearch.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracSearch.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracSearch.java
index bcc8784c8..e47bf1496 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracSearch.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracSearch.java
@@ -12,12 +12,14 @@
package org.eclipse.mylar.internal.trac.core.model;
import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.StringTokenizer;
import org.eclipse.mylar.context.core.MylarStatusHandler;
import org.eclipse.mylar.internal.trac.core.ITracClient;
@@ -39,6 +41,10 @@ public class TracSearch {
private boolean ascending = true;
+ public TracSearch(String queryParameter) {
+ fromUrl(queryParameter);
+ }
+
public TracSearch() {
}
@@ -147,4 +153,30 @@ public class TracSearch {
return sb.toString();
}
+ public void fromUrl(String url) {
+ StringTokenizer t = new StringTokenizer(url, "&");
+ while (t.hasMoreTokens()) {
+ String token = t.nextToken();
+ int i = token.indexOf("=");
+ if (i != -1) {
+ try {
+ String key = URLDecoder.decode(token.substring(0, i), ITracClient.CHARSET);
+ String value = URLDecoder.decode(token.substring(i + 1), ITracClient.CHARSET);
+
+ if ("order".equals(key)) {
+ setOrderBy(value);
+ } else if ("desc".equals(key)) {
+ setAscending(!"1".equals(value));
+ } else if ("group".equals(key) || "groupdesc".equals(key) || "verbose".equals(key)) {
+ // ignore these parameters
+ } else {
+ addFilter(key, value);
+ }
+ } catch (UnsupportedEncodingException e) {
+ MylarStatusHandler.log(e, "Unexpected exception while decoding URL");
+ }
+ }
+ }
+ }
+
}

Back to the top