aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozak2011-11-22 02:06:28 (EST)
committerWinston Prakash2011-12-01 20:46:53 (EST)
commit5d4d48e01b3c2d325b80673aaed1bc498a630395 (patch)
tree2c014809cc9813253b1156a5c3701fd4e92b937c
parentea71dba4b0b446b02b7a85ad011c43de2c3b1fcf (diff)
downloadorg.eclipse.hudson.core-5d4d48e01b3c2d325b80673aaed1bc498a630395.zip
org.eclipse.hudson.core-5d4d48e01b3c2d325b80673aaed1bc498a630395.tar.gz
org.eclipse.hudson.core-5d4d48e01b3c2d325b80673aaed1bc498a630395.tar.bz2
Add customWorkspace property handling for UI
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
-rw-r--r--hudson-core/src/main/java/hudson/model/FreeStyleProject.java15
-rw-r--r--hudson-core/src/main/resources/lib/hudson/project/config-blockWhenDownstreamBuilding.jelly2
-rw-r--r--hudson-core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly2
-rw-r--r--hudson-core/src/main/resources/lib/hudson/project/config-cleanWorkspace.jelly2
-rw-r--r--hudson-core/src/main/resources/lib/hudson/project/config-customWorkspace.jelly8
5 files changed, 21 insertions, 8 deletions
diff --git a/hudson-core/src/main/java/hudson/model/FreeStyleProject.java b/hudson-core/src/main/java/hudson/model/FreeStyleProject.java
index d577524..a0ee2d3 100644
--- a/hudson-core/src/main/java/hudson/model/FreeStyleProject.java
+++ b/hudson-core/src/main/java/hudson/model/FreeStyleProject.java
@@ -33,6 +33,9 @@ import javax.servlet.ServletException;
* @author Kohsuke Kawaguchi
*/
public class FreeStyleProject extends Project<FreeStyleProject,FreeStyleBuild> implements TopLevelItem, IFreeStyleProject {
+
+ private static final String DEFAULT_CUSTOM_WORKSPACE = "default_workspace";
+
/**
* See {@link #setCustomWorkspace(String)}.
*
@@ -58,12 +61,20 @@ public class FreeStyleProject extends Project<FreeStyleProject,FreeStyleBuild> i
public String getCustomWorkspace(boolean useParentValue) {
- if (!useParentValue || StringUtils.isNotBlank(customWorkspace)) {
+ if (!useParentValue || !isCustomWorkspaceInherited()) {
+ return DEFAULT_CUSTOM_WORKSPACE.equals(customWorkspace)? null : StringUtils.trimToNull(customWorkspace);
+ } else if (StringUtils.isNotBlank(customWorkspace)) {
return customWorkspace;
}
return hasCascadingProject()? getCascadingProject().getCustomWorkspace() : null;
}
+ public boolean isCustomWorkspaceInherited() {
+ return hasCascadingProject() && !DEFAULT_CUSTOM_WORKSPACE.equals(customWorkspace)
+ && StringUtils.isBlank(customWorkspace);
+ }
+
+
public String getCustomWorkspace() {
return getCustomWorkspace(true);
}
@@ -92,7 +103,7 @@ public class FreeStyleProject extends Project<FreeStyleProject,FreeStyleBuild> i
public void setCustomWorkspace(String customWorkspace) throws IOException {
if (!(hasCascadingProject()
&& StringUtils.equalsIgnoreCase(getCascadingProject().getCustomWorkspace(), customWorkspace))) {
- this.customWorkspace = customWorkspace;
+ this.customWorkspace = null == customWorkspace ? DEFAULT_CUSTOM_WORKSPACE : customWorkspace;
} else {
this.customWorkspace = null;
}
diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenDownstreamBuilding.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenDownstreamBuilding.jelly
index 6364734..d825d28 100644
--- a/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenDownstreamBuilding.jelly
+++ b/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenDownstreamBuilding.jelly
@@ -1,6 +1,6 @@
<!-- **************************************************************************
#
-# Copyright (c) 2004-2009 Oracle Corporation.
+# Copyright (c) 2004-2011 Oracle Corporation.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly
index 0ca36a6..d210083 100644
--- a/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly
+++ b/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly
@@ -1,6 +1,6 @@
<!-- **************************************************************************
#
-# Copyright (c) 2004-2009 Oracle Corporation.
+# Copyright (c) 2004-2011 Oracle Corporation.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-cleanWorkspace.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-cleanWorkspace.jelly
index 5b1a257..c36d563 100644
--- a/hudson-core/src/main/resources/lib/hudson/project/config-cleanWorkspace.jelly
+++ b/hudson-core/src/main/resources/lib/hudson/project/config-cleanWorkspace.jelly
@@ -1,6 +1,6 @@
<!-- **************************************************************************
#
-# Copyright (c) 2004-2009 Oracle Corporation.
+# Copyright (c) 2004-2011 Oracle Corporation.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-customWorkspace.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-customWorkspace.jelly
index dce5142..2d72cef 100644
--- a/hudson-core/src/main/resources/lib/hudson/project/config-customWorkspace.jelly
+++ b/hudson-core/src/main/resources/lib/hudson/project/config-customWorkspace.jelly
@@ -1,6 +1,6 @@
<!-- **************************************************************************
#
-# Copyright (c) 2004-2009 Oracle Corporation.
+# Copyright (c) 2004-2011 Oracle Corporation.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
@@ -9,7 +9,7 @@
#
# Contributors:
#
-# Kohsuke Kawaguchi, id:cactusman
+# Kohsuke Kawaguchi, id:cactusman, Nikita Levyankov, Anton Kozak
#
#
#************************************************************************** -->
@@ -17,7 +17,9 @@
<!-- custom workspace -->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
-<f:optionalBlock name="customWorkspace" title="${%Use custom workspace}" checked="${it.customWorkspace!=null}" help="/help/project-config/custom-workspace.html">
+<f:optionalBlock name="customWorkspace" title="${%Use custom workspace}" checked="${it.customWorkspace!=null}"
+ isCascadingValue="${it.hasCascadingProject() and !it.isCustomWorkspaceInherited()}"
+ help="/help/project-config/custom-workspace.html">
<f:entry title="${%Directory}">
<f:textbox name="customWorkspace.directory" value="${it.customWorkspace}" />
</f:entry>