mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-18 06:22:29 +00:00
using field binding to simplify this a bit.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@14015 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
6785b22caf
commit
4841d45c84
3 files changed
+42
-37
No files matched your search
@@ -44,6 +44,12 @@ public class ListView extends View {
|
||||
super(name);
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
if(includeRegex!=null)
|
||||
includePattern = Pattern.compile(includeRegex);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a read-only view of all {@link Job}s in this view.
|
||||
*
|
||||
@@ -54,19 +60,12 @@ public class ListView extends View {
|
||||
public synchronized List<TopLevelItem> getItems() {
|
||||
Set<String> names = (Set<String>) ((TreeSet<String>) jobNames).clone();
|
||||
|
||||
if (includeRegex != null) {
|
||||
try {
|
||||
if (includePattern == null) {
|
||||
includePattern = Pattern.compile(includeRegex);
|
||||
if (includePattern != null) {
|
||||
for (TopLevelItem item : Hudson.getInstance().getItems()) {
|
||||
String itemName = item.getName();
|
||||
if (includePattern.matcher(itemName).matches()) {
|
||||
names.add(itemName);
|
||||
}
|
||||
|
||||
for (TopLevelItem item : Hudson.getInstance().getItems()) {
|
||||
String itemName = item.getName();
|
||||
if (includePattern.matcher(itemName).matches()) {
|
||||
names.add(itemName);
|
||||
}
|
||||
}
|
||||
} catch (PatternSyntaxException pse) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,11 +119,12 @@ public class ListView extends View {
|
||||
description = Util.nullify(req.getParameter("description"));
|
||||
|
||||
if (req.getParameter("useincluderegex") != null) {
|
||||
includeRegex = Util.nullify(req.getParameter("includeregex"));
|
||||
includeRegex = Util.nullify(req.getParameter("includeRegex"));
|
||||
includePattern = Pattern.compile(includeRegex);
|
||||
} else {
|
||||
includeRegex = null;
|
||||
includePattern = null;
|
||||
}
|
||||
includePattern = null;
|
||||
|
||||
try {
|
||||
rename(req.getParameter("name"));
|
||||
@@ -138,26 +138,6 @@ public class ListView extends View {
|
||||
rsp.sendRedirect2("../"+name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the include regular expression is valid.
|
||||
*/
|
||||
public void doIncludeRegexCheck( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, InterruptedException {
|
||||
new FormFieldValidator(req, rsp, false) {
|
||||
@Override
|
||||
protected void check() throws IOException, ServletException {
|
||||
String v = Util.fixEmpty(request.getParameter("value"));
|
||||
if (v != null) {
|
||||
try {
|
||||
Pattern.compile(v);
|
||||
} catch (PatternSyntaxException pse) {
|
||||
error(pse.getMessage());
|
||||
}
|
||||
}
|
||||
ok();
|
||||
}
|
||||
}.process();
|
||||
}
|
||||
|
||||
public ViewDescriptor getDescriptor() {
|
||||
return DESCRIPTOR;
|
||||
}
|
||||
@@ -176,5 +156,25 @@ public class ListView extends View {
|
||||
public String getDisplayName() {
|
||||
return Messages.ListView_DisplayName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the include regular expression is valid.
|
||||
*/
|
||||
public void doCheckIncludeRegex( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, InterruptedException {
|
||||
new FormFieldValidator(req, rsp, false) {
|
||||
@Override
|
||||
protected void check() throws IOException, ServletException {
|
||||
String v = Util.fixEmpty(request.getParameter("value"));
|
||||
if (v != null) {
|
||||
try {
|
||||
Pattern.compile(v);
|
||||
} catch (PatternSyntaxException pse) {
|
||||
error(pse.getMessage());
|
||||
}
|
||||
}
|
||||
ok();
|
||||
}
|
||||
}.process();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user