diff --git a/core/src/main/java/hudson/model/UserProperty.java b/core/src/main/java/hudson/model/UserProperty.java
index e43cdaf93f..bbbdebbf51 100644
--- a/core/src/main/java/hudson/model/UserProperty.java
+++ b/core/src/main/java/hudson/model/UserProperty.java
@@ -45,7 +45,7 @@ import org.kohsuke.stapler.export.ExportedBean;
* Configuration screen should be defined in config.jelly.
* Within this page, the {@link UserProperty} instance is available
* as instance variable (while it refers to {@link User}.
- * See {@link Mailer.UserProperty}'s config.jelly for an example.
+ * See {@link UserSearchProperty.UserProperty}'s config.jelly for an example.
*
*
* @author Kohsuke Kawaguchi
diff --git a/core/src/main/java/hudson/search/CollectionSearchIndex.java b/core/src/main/java/hudson/search/CollectionSearchIndex.java
index 4a62cb6245..e758d514a6 100644
--- a/core/src/main/java/hudson/search/CollectionSearchIndex.java
+++ b/core/src/main/java/hudson/search/CollectionSearchIndex.java
@@ -53,16 +53,13 @@ public abstract class CollectionSearchIndex i
public void suggest(String token, List result) {
Collection items = all();
- User user = User.current();
- boolean caseSensitive = false;
- if(user!=null && user.getProperty(Search.UserProperty.class).getInsensitiveSearch()){ //Searching for anonymous user is case-sensitive
+ if(UserSearchProperty.isCaseSensitive()){
token = token.toLowerCase();
- caseSensitive=true;
}
if(items==null) return;
for (SMT o : items) {
String name = getName(o);
- if(caseSensitive)
+ if(UserSearchProperty.isCaseSensitive())
name=name.toLowerCase();
if(o!=null && name.contains(token))
result.add(o);
diff --git a/core/src/main/java/hudson/search/FixedSet.java b/core/src/main/java/hudson/search/FixedSet.java
index c28d64b0c8..2e2f72abae 100644
--- a/core/src/main/java/hudson/search/FixedSet.java
+++ b/core/src/main/java/hudson/search/FixedSet.java
@@ -45,7 +45,7 @@ public class FixedSet implements SearchIndex {
}
public void find(String token, List result) {
- boolean caseSensitive = getCaseSensitivity();
+ boolean caseSensitive = UserSearchProperty.isCaseSensitive();
for (SearchItem i : items){
String name = i.getSearchName();
if(caseSensitive){
@@ -56,18 +56,9 @@ public class FixedSet implements SearchIndex {
result.add(i);
}
}
-
- public boolean getCaseSensitivity(){
- User user = User.current();
- boolean caseSensitive = false;
- if(user!=null && user.getProperty(Search.UserProperty.class).getInsensitiveSearch()){//Searching for anonymous user is case-sensitive
- caseSensitive=true;
- }
- return caseSensitive;
- }
public void suggest(String token, List result) {
- boolean caseSensitive = getCaseSensitivity();
+ boolean caseSensitive = UserSearchProperty.isCaseSensitive();
for (SearchItem i : items){
String name = i.getSearchName();
if(caseSensitive){
diff --git a/core/src/main/java/hudson/search/Search.java b/core/src/main/java/hudson/search/Search.java
index 34399713e4..1228094ede 100644
--- a/core/src/main/java/hudson/search/Search.java
+++ b/core/src/main/java/hudson/search/Search.java
@@ -353,35 +353,4 @@ public class Search {
}
private final static Logger LOGGER = Logger.getLogger(Search.class.getName());
-
- //User`s setting of case-sensitivity for searching
- public static class UserProperty extends hudson.model.UserProperty {
-
- private final boolean insensitiveSearch;
-
- public UserProperty(boolean insensitiveSearch) {
- this.insensitiveSearch = insensitiveSearch;
- }
-
- @Exported
- public boolean getInsensitiveSearch() {
- return insensitiveSearch;
- }
-
- @Extension
- public static final class DescriptorImpl extends UserPropertyDescriptor {
- public String getDisplayName() {
- return "Setting for search";
- }
-
- public UserProperty newInstance(User user) {
- return new UserProperty(false); //default setting is case-sensitive searching
- }
-
- @Override
- public UserProperty newInstance(StaplerRequest req, JSONObject formData) throws FormException {
- return new UserProperty(formData.optBoolean("insensitiveSearch"));
- }
- }
- }
}
diff --git a/core/src/main/java/hudson/search/UserSearchProperty.java b/core/src/main/java/hudson/search/UserSearchProperty.java
new file mode 100644
index 0000000000..f626331625
--- /dev/null
+++ b/core/src/main/java/hudson/search/UserSearchProperty.java
@@ -0,0 +1,53 @@
+package hudson.search;
+
+import hudson.Extension;
+import hudson.model.User;
+import hudson.model.UserProperty;
+import hudson.model.UserPropertyDescriptor;
+import net.sf.json.JSONObject;
+
+import org.kohsuke.stapler.DataBoundConstructor;
+import org.kohsuke.stapler.StaplerRequest;
+import org.kohsuke.stapler.export.Exported;
+
+public class UserSearchProperty extends hudson.model.UserProperty {
+
+ private final boolean insensitiveSearch;
+
+ public UserSearchProperty(boolean insensitiveSearch) {
+ this.insensitiveSearch = insensitiveSearch;
+ }
+
+ @Exported
+ public boolean getInsensitiveSearch() {
+ return insensitiveSearch;
+ }
+
+ public static boolean isCaseSensitive(){
+ User user = User.current();
+ boolean caseSensitive = false;
+ if(user!=null && user.getProperty(UserSearchProperty.class).getInsensitiveSearch()){//Searching for anonymous user is case-sensitive
+ caseSensitive=true;
+ }
+ return caseSensitive;
+ }
+
+
+ @Extension
+ public static final class DescriptorImpl extends UserPropertyDescriptor {
+ public String getDisplayName() {
+ return "Setting for search";
+ }
+
+ public UserProperty newInstance(User user) {
+ return new UserSearchProperty(false); //default setting is case-sensitive searching
+ }
+
+ @Override
+ public UserProperty newInstance(StaplerRequest req, JSONObject formData) throws FormException {
+ return new UserSearchProperty(formData.optBoolean("insensitiveSearch"));
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/core/src/main/resources/hudson/search/Search/UserProperty/config.jelly b/core/src/main/resources/hudson/search/UserSearchProperty/config.jelly
similarity index 100%
rename from core/src/main/resources/hudson/search/Search/UserProperty/config.jelly
rename to core/src/main/resources/hudson/search/UserSearchProperty/config.jelly