From ca6f4c389f00f511cdd0f8244b09fa9260f9dff0 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Sat, 1 Sep 2007 14:33:10 +0000 Subject: [PATCH] choosing the default values bit more wisely git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@4569 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/Functions.java | 10 ++++++++++ core/src/main/resources/hudson/scm/CVSSCM/config.jelly | 2 +- .../resources/hudson/scm/SubversionSCM/config.jelly | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/hudson/Functions.java b/core/src/main/java/hudson/Functions.java index 67be82b812..a94cd838fe 100644 --- a/core/src/main/java/hudson/Functions.java +++ b/core/src/main/java/hudson/Functions.java @@ -608,4 +608,14 @@ public class Functions { public static String getResourcePath() { return Hudson.RESOURCE_PATH; } + + /** + * Can be used to check a checkbox by default. + * Used from views like {@code h.defaultToTrue(scm.useUpdate)}. + * The expression will evaluate to true if scm is null. + */ + public static boolean defaultToTrue(Boolean b) { + if(b==null) return true; + return b; + } } diff --git a/core/src/main/resources/hudson/scm/CVSSCM/config.jelly b/core/src/main/resources/hudson/scm/CVSSCM/config.jelly index 222ed31428..0b01d0836a 100644 --- a/core/src/main/resources/hudson/scm/CVSSCM/config.jelly +++ b/core/src/main/resources/hudson/scm/CVSSCM/config.jelly @@ -16,7 +16,7 @@ - + diff --git a/core/src/main/resources/hudson/scm/SubversionSCM/config.jelly b/core/src/main/resources/hudson/scm/SubversionSCM/config.jelly index cc0e3c7952..68dd314d70 100644 --- a/core/src/main/resources/hudson/scm/SubversionSCM/config.jelly +++ b/core/src/main/resources/hudson/scm/SubversionSCM/config.jelly @@ -23,7 +23,7 @@ description=" If checked, Hudson will use 'svn update' whenever possible, making the build faster. But this causes the artifacts from the previous build to remain when a new build starts."> - + -- GitLab