Skip to content

Commit b907365

Browse files
committed
NestedViewsSearch made optional
enabeled by default, can be disabled by existence of ~/.nestedViewsSearch
1 parent 45037f2 commit b907365

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

Diff for: src/main/java/hudson/plugins/nested_view/NestedViewsSearchFactory.java

+12-4
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,24 @@
44
import hudson.search.Search;
55
import hudson.search.SearchFactory;
66
import hudson.search.SearchableModelObject;
7-
import jenkins.model.Jenkins;
8-
9-
import javax.inject.Inject;
107

8+
import java.io.File;
119

1210
@Extension
1311
public class NestedViewsSearchFactory extends SearchFactory {
1412

1513
@Override
1614
public Search createFor(final SearchableModelObject owner) {
17-
return new NestedViewsSearch();
15+
String userHomeDir = System.getProperty("user.home");
16+
if (userHomeDir == null) {
17+
return new NestedViewsSearch();
18+
} else {
19+
File nestedViewsFile = new File(userHomeDir, ".nestedViewsSearch");
20+
if (nestedViewsFile.exists()) {
21+
return new Search();
22+
} else {
23+
return new NestedViewsSearch();
24+
}
25+
}
1826
}
1927
}

0 commit comments

Comments
 (0)