From f766f2a9c74facac47ddf8052ab88f493c57d2fb Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Wed, 15 Jun 2011 13:57:27 -0700 Subject: [PATCH] [JENKINS-5577] A better way to implement this is to extend from StringParameterDefinition and reuse most of its views. --- .../hudson/model/TextParameterDefinition.java | 54 ++----------------- .../TextParameterDefinition/config.jelly | 36 ------------- .../config_da.properties | 25 --------- .../config_de.properties | 3 -- .../config_es.properties | 25 --------- .../config_fr.properties | 26 --------- .../config_ja.properties | 25 --------- .../config_pt_BR.properties | 25 --------- .../config_ru.properties | 25 --------- .../config_zh_TW.properties | 25 --------- 10 files changed, 3 insertions(+), 266 deletions(-) delete mode 100644 core/src/main/resources/hudson/model/TextParameterDefinition/config.jelly delete mode 100644 core/src/main/resources/hudson/model/TextParameterDefinition/config_da.properties delete mode 100644 core/src/main/resources/hudson/model/TextParameterDefinition/config_de.properties delete mode 100644 core/src/main/resources/hudson/model/TextParameterDefinition/config_es.properties delete mode 100644 core/src/main/resources/hudson/model/TextParameterDefinition/config_fr.properties delete mode 100644 core/src/main/resources/hudson/model/TextParameterDefinition/config_ja.properties delete mode 100644 core/src/main/resources/hudson/model/TextParameterDefinition/config_pt_BR.properties delete mode 100644 core/src/main/resources/hudson/model/TextParameterDefinition/config_ru.properties delete mode 100644 core/src/main/resources/hudson/model/TextParameterDefinition/config_zh_TW.properties diff --git a/core/src/main/java/hudson/model/TextParameterDefinition.java b/core/src/main/java/hudson/model/TextParameterDefinition.java index a8e2871782a0..a4c4f48a49b9 100644 --- a/core/src/main/java/hudson/model/TextParameterDefinition.java +++ b/core/src/main/java/hudson/model/TextParameterDefinition.java @@ -29,44 +29,12 @@ import org.kohsuke.stapler.StaplerRequest; /** - * Parameter whose value is a string value. + * {@link StringParameterDefinition} that uses textarea, instead of text box. */ -public class TextParameterDefinition extends SimpleParameterDefinition { - - private String defaultValue; - +public class TextParameterDefinition extends StringParameterDefinition { @DataBoundConstructor public TextParameterDefinition(String name, String defaultValue, String description) { - super(name, description); - this.defaultValue = defaultValue; - } - - public TextParameterDefinition(String name, String defaultValue) { - this(name, defaultValue, null); - } - - @Override - public ParameterDefinition copyWithDefaultValue(ParameterValue defaultValue) { - if (defaultValue instanceof StringParameterValue) { - StringParameterValue value = (StringParameterValue) defaultValue; - return new TextParameterDefinition(getName(), value.value, getDescription()); - } else { - return this; - } - } - - public String getDefaultValue() { - return defaultValue; - } - - public void setDefaultValue(String defaultValue) { - this.defaultValue = defaultValue; - } - - @Override - public StringParameterValue getDefaultParameterValue() { - StringParameterValue v = new StringParameterValue(getName(), defaultValue, getDescription()); - return v; + super(name, defaultValue, description); } @Extension @@ -75,21 +43,5 @@ public static class DescriptorImpl extends ParameterDescriptor { public String getDisplayName() { return Messages.TextParameterDefinition_DisplayName(); } - - @Override - public String getHelpFile() { - return "/help/parameter/string.html"; - } - } - - @Override - public ParameterValue createValue(StaplerRequest req, JSONObject jo) { - StringParameterValue value = req.bindJSON(StringParameterValue.class, jo); - value.setDescription(getDescription()); - return value; - } - - public ParameterValue createValue(String value) { - return new StringParameterValue(getName(), value, getDescription()); } } diff --git a/core/src/main/resources/hudson/model/TextParameterDefinition/config.jelly b/core/src/main/resources/hudson/model/TextParameterDefinition/config.jelly deleted file mode 100644 index ec53a85838d2..000000000000 --- a/core/src/main/resources/hudson/model/TextParameterDefinition/config.jelly +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - diff --git a/core/src/main/resources/hudson/model/TextParameterDefinition/config_da.properties b/core/src/main/resources/hudson/model/TextParameterDefinition/config_da.properties deleted file mode 100644 index 1fa04ed0bbe5..000000000000 --- a/core/src/main/resources/hudson/model/TextParameterDefinition/config_da.properties +++ /dev/null @@ -1,25 +0,0 @@ -# The MIT License -# -# Copyright (c) 2004-2010, Sun Microsystems, Inc. Kohsuke Kawaguchi. Knud Poulsen. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -Name=Navn -Default\ Value=Standardv\u00e6rdi -Description=Beskrivelse diff --git a/core/src/main/resources/hudson/model/TextParameterDefinition/config_de.properties b/core/src/main/resources/hudson/model/TextParameterDefinition/config_de.properties deleted file mode 100644 index ac7c983a0816..000000000000 --- a/core/src/main/resources/hudson/model/TextParameterDefinition/config_de.properties +++ /dev/null @@ -1,3 +0,0 @@ -Name=Name -Default\ Value=Vorgabewert -Description=Beschreibung diff --git a/core/src/main/resources/hudson/model/TextParameterDefinition/config_es.properties b/core/src/main/resources/hudson/model/TextParameterDefinition/config_es.properties deleted file mode 100644 index 0effa47580d5..000000000000 --- a/core/src/main/resources/hudson/model/TextParameterDefinition/config_es.properties +++ /dev/null @@ -1,25 +0,0 @@ -# The MIT License -# -# Copyright (c) 2004-2010, Sun Microsystems, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -Name=Nombre -Default\ Value=Valor por defecto -Description=Descripción diff --git a/core/src/main/resources/hudson/model/TextParameterDefinition/config_fr.properties b/core/src/main/resources/hudson/model/TextParameterDefinition/config_fr.properties deleted file mode 100644 index f955c9153216..000000000000 --- a/core/src/main/resources/hudson/model/TextParameterDefinition/config_fr.properties +++ /dev/null @@ -1,26 +0,0 @@ -# The MIT License -# -# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Eric Lefevre-Ardant -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -Name=Nom -Default\ Value=Valeur par défaut -Description=Description - diff --git a/core/src/main/resources/hudson/model/TextParameterDefinition/config_ja.properties b/core/src/main/resources/hudson/model/TextParameterDefinition/config_ja.properties deleted file mode 100644 index dc4c2c15b62c..000000000000 --- a/core/src/main/resources/hudson/model/TextParameterDefinition/config_ja.properties +++ /dev/null @@ -1,25 +0,0 @@ -# The MIT License -# -# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -Name=\u540D\u524D -Default\ Value=\u30C7\u30D5\u30A9\u30EB\u30C8\u5024 -Description=\u8AAC\u660E diff --git a/core/src/main/resources/hudson/model/TextParameterDefinition/config_pt_BR.properties b/core/src/main/resources/hudson/model/TextParameterDefinition/config_pt_BR.properties deleted file mode 100644 index 27ba76ec3a05..000000000000 --- a/core/src/main/resources/hudson/model/TextParameterDefinition/config_pt_BR.properties +++ /dev/null @@ -1,25 +0,0 @@ -# The MIT License -# -# Copyright (c) 2004-2010, Sun Microsystems, Inc., Cleiber Silva -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -Name=Nome -Default\ Value=Valor padr\u00e3o -Description=Descri\u00e7\u00e3o diff --git a/core/src/main/resources/hudson/model/TextParameterDefinition/config_ru.properties b/core/src/main/resources/hudson/model/TextParameterDefinition/config_ru.properties deleted file mode 100644 index 069c2794cb07..000000000000 --- a/core/src/main/resources/hudson/model/TextParameterDefinition/config_ru.properties +++ /dev/null @@ -1,25 +0,0 @@ -# The MIT License -# -# Copyright (c) 2004-2010, Sun Microsystems, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -Default\ Value=\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043F\u043E-\u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E -Description=\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 -Name=\u0418\u043C\u044F diff --git a/core/src/main/resources/hudson/model/TextParameterDefinition/config_zh_TW.properties b/core/src/main/resources/hudson/model/TextParameterDefinition/config_zh_TW.properties deleted file mode 100644 index 92ae5cb97dcd..000000000000 --- a/core/src/main/resources/hudson/model/TextParameterDefinition/config_zh_TW.properties +++ /dev/null @@ -1,25 +0,0 @@ -# The MIT License -# -# Copyright (c) 2004-2010, Sun Microsystems, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -Default\ Value=\u9810\u8A2D\u503C -Description=\u63CF\u8FF0 -Name=\u540D\u7A31