aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstylePlugin.java40
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java26
-rw-r--r--plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdPlugin.java124
-rw-r--r--plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DbCleanerPlugin.java15
-rw-r--r--plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DefaultPurgeTask.java6
-rw-r--r--plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsPlugin.java43
-rw-r--r--plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties4
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidPlugin.java57
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/Property.java20
-rw-r--r--sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterClient.java29
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/server_id_configuration/index.html.erb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb19
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_BOOLEAN.html.erb5
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_FLOAT.html.erb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_INTEGER.html.erb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_PASSWORD.html.erb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_SINGLE_SELECT_LIST.html.erb6
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_TEXT.html.erb1
19 files changed, 236 insertions, 165 deletions
diff --git a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstylePlugin.java b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstylePlugin.java
index 96b61f0af77..515b8d15e04 100644
--- a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstylePlugin.java
+++ b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstylePlugin.java
@@ -19,34 +19,36 @@
*/
package org.sonar.plugins.checkstyle;
-import org.sonar.api.SonarPlugin;
import org.sonar.api.Properties;
import org.sonar.api.Property;
+import org.sonar.api.SonarPlugin;
import java.util.Arrays;
import java.util.List;
-@Properties( {
+@Properties({
@Property(key = CheckstyleConstants.FILTERS_KEY,
- defaultValue = CheckstyleConstants.FILTERS_DEFAULT_VALUE,
- name = "Filters",
- description = "Checkstyle support three error filtering mechanisms : SuppressionCommentFilter, SuppressWithNearbyCommentFilter and SuppressionFilter."
- + "This property allows to configure all those filters with a native XML format."
- + " See <a href='http://checkstyle.sourceforge.net/config.html'>Checkstyle configuration page</a> to get more information on those filters.",
- project = false, global = true) })
-public class CheckstylePlugin extends SonarPlugin {
+ defaultValue = CheckstyleConstants.FILTERS_DEFAULT_VALUE,
+ name = "Filters",
+ description = "Checkstyle support three error filtering mechanisms : SuppressionCommentFilter, SuppressWithNearbyCommentFilter and SuppressionFilter."
+ + "This property allows to configure all those filters with a native XML format."
+ + " See <a href='http://checkstyle.sourceforge.net/config.html'>Checkstyle configuration page</a> to get more information on those filters.",
+ project = false,
+ global = true,
+ type = Property.Type.TEXT)})
+public final class CheckstylePlugin extends SonarPlugin {
public List getExtensions() {
return Arrays.asList(
- CheckstyleSensor.class,
- CheckstyleConfiguration.class,
- CheckstyleExecutor.class,
- CheckstyleAuditListener.class,
- CheckstyleProfileExporter.class,
- CheckstyleProfileImporter.class,
- CheckstyleRuleRepository.class,
- SonarWayProfile.class,
- SunConventionsProfile.class,
- SonarWayWithFindbugsProfile.class);
+ CheckstyleSensor.class,
+ CheckstyleConfiguration.class,
+ CheckstyleExecutor.class,
+ CheckstyleAuditListener.class,
+ CheckstyleProfileExporter.class,
+ CheckstyleProfileImporter.class,
+ CheckstyleRuleRepository.class,
+ SonarWayProfile.class,
+ SunConventionsProfile.class,
+ SonarWayWithFindbugsProfile.class);
}
}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
index c690d8a5455..b0d273c9fe6 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
@@ -74,7 +74,8 @@ import java.util.List;
project = true,
module = true,
global = true,
- category = CoreProperties.CATEGORY_SECURITY),
+ category = CoreProperties.CATEGORY_SECURITY,
+ type = Property.Type.BOOLEAN),
@Property(
key = CoreProperties.CORE_TENDENCY_DEPTH_PROPERTY,
defaultValue = "" + CoreProperties.CORE_TENDENCY_DEPTH_DEFAULT_VALUE,
@@ -82,7 +83,8 @@ import java.util.List;
description = TendencyDecorator.PROP_DAYS_DESCRIPTION,
project = false,
global = true,
- category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
+ category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS,
+ type = Property.Type.INTEGER),
@Property(
key = CoreProperties.SKIP_TENDENCIES_PROPERTY,
defaultValue = "" + CoreProperties.SKIP_TENDENCIES_DEFAULT_VALUE,
@@ -91,7 +93,8 @@ import java.util.List;
project = true,
module = false,
global = true,
- category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
+ category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS,
+ type = Property.Type.BOOLEAN),
@Property(
key = CoreProperties.CORE_SKIPPED_MODULES_PROPERTY,
name = "Exclude modules",
@@ -106,7 +109,8 @@ import java.util.List;
description = "Forcing user authentication stops un-logged users to access Sonar.",
project = false,
global = true,
- category = CoreProperties.CATEGORY_SECURITY),
+ category = CoreProperties.CATEGORY_SECURITY,
+ type = Property.Type.BOOLEAN),
@Property(
key = CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_PROPERTY,
defaultValue = "" + CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_DEAULT_VALUE,
@@ -114,7 +118,8 @@ import java.util.List;
description = "Users can sign up online.",
project = false,
global = true,
- category = CoreProperties.CATEGORY_SECURITY),
+ category = CoreProperties.CATEGORY_SECURITY,
+ type = Property.Type.BOOLEAN),
@Property(
key = CoreProperties.CORE_DEFAULT_GROUP,
defaultValue = CoreProperties.CORE_DEFAULT_GROUP_DEFAULT_VALUE,
@@ -199,22 +204,25 @@ import java.util.List;
description = "Downcase login during user authentication, typically for Active Directory",
project = false,
global = false,
- defaultValue = "false"),
+ defaultValue = "false",
+ type = Property.Type.BOOLEAN),
@Property(
key = CoreProperties.CORE_AUTHENTICATOR_CREATE_USERS,
name = "Create user accounts",
description = "Create accounts when authenticating users via an external system",
project = false,
global = false,
- defaultValue = "true"),
+ defaultValue = "true",
+ type = Property.Type.BOOLEAN),
@Property(
key = CoreProperties.CORE_AUTHENTICATOR_IGNORE_STARTUP_FAILURE,
name = "Ignore failures during authenticator startup",
defaultValue = "false",
project = false,
- global = false)
+ global = false,
+ type = Property.Type.BOOLEAN)
})
-public class CorePlugin extends SonarPlugin {
+public final class CorePlugin extends SonarPlugin {
@SuppressWarnings({"rawtypes", "unchecked"})
public List getExtensions() {
diff --git a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdPlugin.java b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdPlugin.java
index 029b5607b49..ddefdb4fa4c 100644
--- a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdPlugin.java
+++ b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdPlugin.java
@@ -31,69 +31,75 @@ import java.util.Arrays;
import java.util.List;
@Properties({
- @Property(
- key = CoreProperties.CPD_ENGINE,
- defaultValue = CoreProperties.CPD_ENGINE_DEFAULT_VALUE,
- name = "Copy&Paste detection engine",
- description = "Sonar embeds its own CPD engine since Sonar 2.11, but it's still possible to use the old PMD CPD engine (value 'pmd')." +
- " Some Sonar users might want to keep on working with PMD CPD engine for instance to prevent any impact on measures during an upgrade of Sonar." +
- " Moreover this Sonar CPD engine is not supported by all Sonar language plugins and when this support is not available," +
- " the PMD CPD engine is automatically selected.",
- project = true,
- module = true,
- global = true,
- category = CoreProperties.CATEGORY_DUPLICATIONS),
- @Property(
- key = CoreProperties.CPD_CROSS_RPOJECT,
- defaultValue = CoreProperties.CPD_CROSS_RPOJECT_DEFAULT_VALUE + "",
- name = "Cross project duplicaton detection",
- description = "Sonar supports the detection of cross project duplications." +
- " Activating this property will slightly increase each Sonar analysis time." +
- " This mode can't be used along with the PMD CPD engine.",
- project = true,
- module = true,
- global = true,
- category = CoreProperties.CATEGORY_DUPLICATIONS),
- @Property(
- key = CoreProperties.CPD_MINIMUM_TOKENS_PROPERTY,
- defaultValue = CoreProperties.CPD_MINIMUM_TOKENS_DEFAULT_VALUE + "",
- name = "Minimum tokens",
- description = "Deprecated property used only by the PMD CPD engine." +
- " The number of duplicate tokens above which a block is considered as a duplication.",
- project = true,
- module = true,
- global = true,
- category = CoreProperties.CATEGORY_DUPLICATIONS),
- @Property(
- key = CoreProperties.CPD_IGNORE_LITERALS_PROPERTY,
- defaultValue = CoreProperties.CPD_IGNORE_LITERALS_DEFAULT_VALUE + "",
- name = "Ignore literals",
- description = "Deprecated property used only by the PMD CPD engine." +
- " If true, PMD-CPD ignores literal value differences when evaluating a duplicate block." +
- " This means that foo=\"first string\"; and foo=\"second string\"; will be seen as equivalent.",
- project = true,
- module = true,
- global = true,
- category = CoreProperties.CATEGORY_DUPLICATIONS),
- @Property(
- key = CoreProperties.CPD_IGNORE_IDENTIFIERS_PROPERTY,
- defaultValue = CoreProperties.CPD_IGNORE_IDENTIFIERS_DEFAULT_VALUE + "",
- name = "Ignore identifiers",
- description = "Deprecated property used only by the PMD CPD engine." +
- " Similar to 'Ignore literals' but for identifiers; i.e., variable names, methods names, and so forth.",
- project = true,
- module = true,
- global = true,
- category = CoreProperties.CATEGORY_DUPLICATIONS)
+ @Property(
+ key = CoreProperties.CPD_ENGINE,
+ defaultValue = CoreProperties.CPD_ENGINE_DEFAULT_VALUE,
+ name = "Copy&Paste detection engine",
+ description = "Sonar embeds its own CPD engine since Sonar 2.11, but it's still possible to use the old PMD CPD engine (value 'pmd')." +
+ " Some Sonar users might want to keep on working with PMD CPD engine for instance to prevent any impact on measures during an upgrade of Sonar." +
+ " Moreover this Sonar CPD engine is not supported by all Sonar language plugins and when this support is not available," +
+ " the PMD CPD engine is automatically selected.",
+ project = true,
+ module = true,
+ global = true,
+ category = CoreProperties.CATEGORY_DUPLICATIONS,
+ type = Property.Type.SINGLE_SELECT_LIST,
+ options = {"sonar", "pmd"}),
+ @Property(
+ key = CoreProperties.CPD_CROSS_RPOJECT,
+ defaultValue = CoreProperties.CPD_CROSS_RPOJECT_DEFAULT_VALUE + "",
+ name = "Cross project duplicaton detection",
+ description = "Sonar supports the detection of cross project duplications." +
+ " Activating this property will slightly increase each Sonar analysis time." +
+ " This mode can't be used along with the PMD CPD engine.",
+ project = true,
+ module = true,
+ global = true,
+ category = CoreProperties.CATEGORY_DUPLICATIONS,
+ type = Property.Type.BOOLEAN),
+ @Property(
+ key = CoreProperties.CPD_MINIMUM_TOKENS_PROPERTY,
+ defaultValue = CoreProperties.CPD_MINIMUM_TOKENS_DEFAULT_VALUE + "",
+ name = "Minimum tokens",
+ description = "Deprecated property used only by the PMD CPD engine." +
+ " The number of duplicate tokens above which a block is considered as a duplication.",
+ project = true,
+ module = true,
+ global = true,
+ category = CoreProperties.CATEGORY_DUPLICATIONS,
+ type = Property.Type.INTEGER),
+ @Property(
+ key = CoreProperties.CPD_IGNORE_LITERALS_PROPERTY,
+ defaultValue = CoreProperties.CPD_IGNORE_LITERALS_DEFAULT_VALUE + "",
+ name = "Ignore literals",
+ description = "Deprecated property used only by the PMD CPD engine." +
+ " If true, PMD-CPD ignores literal value differences when evaluating a duplicate block." +
+ " This means that foo=\"first string\"; and foo=\"second string\"; will be seen as equivalent.",
+ project = true,
+ module = true,
+ global = true,
+ category = CoreProperties.CATEGORY_DUPLICATIONS,
+ type = Property.Type.BOOLEAN),
+ @Property(
+ key = CoreProperties.CPD_IGNORE_IDENTIFIERS_PROPERTY,
+ defaultValue = CoreProperties.CPD_IGNORE_IDENTIFIERS_DEFAULT_VALUE + "",
+ name = "Ignore identifiers",
+ description = "Deprecated property used only by the PMD CPD engine." +
+ " Similar to 'Ignore literals' but for identifiers; i.e., variable names, methods names, and so forth.",
+ project = true,
+ module = true,
+ global = true,
+ category = CoreProperties.CATEGORY_DUPLICATIONS,
+ type = Property.Type.BOOLEAN)
})
-public class CpdPlugin extends SonarPlugin {
+public final class CpdPlugin extends SonarPlugin {
public List getExtensions() {
return Arrays.asList(CpdSensor.class, SumDuplicationsDecorator.class, DuplicationDensityDecorator.class,
- IndexFactory.class,
- SonarEngine.class,
- PmdEngine.class,
- SonarBridgeEngine.class);
+ IndexFactory.class,
+ SonarEngine.class,
+ PmdEngine.class,
+ SonarBridgeEngine.class);
}
}
diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DbCleanerPlugin.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DbCleanerPlugin.java
index dfaa65a146c..15a74fa8768 100644
--- a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DbCleanerPlugin.java
+++ b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DbCleanerPlugin.java
@@ -32,14 +32,23 @@ import java.util.List;
@Property(key = DbCleanerConstants.WEEKS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_WEEK, defaultValue = "4",
name = "Number of weeks before starting to keep only one snapshot by week",
description = "After this number of weeks, if there are several snapshots during the same week, "
- + "the DbCleaner keeps the first one and fully delete the other ones.", global = true, project = true),
+ + "the DbCleaner keeps the first one and fully delete the other ones.",
+ global = true,
+ project = true,
+ type = Property.Type.INTEGER),
@Property(key = DbCleanerConstants.WEEKS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_MONTH, defaultValue = "52",
name = "Number of weeks before starting to keep only one snapshot by month",
description = "After this number of weeks, if there are several snapshots during the same month, "
- + "the DbCleaner keeps the first one and fully delete the other ones.", global = true, project = true),
+ + "the DbCleaner keeps the first one and fully delete the other ones.",
+ global = true,
+ project = true,
+ type = Property.Type.INTEGER),
@Property(key = DbCleanerConstants.WEEKS_BEFORE_DELETING_ALL_SNAPSHOTS, defaultValue = "260",
name = "Number of weeks before starting to delete all remaining snapshots",
- description = "After this number of weeks, all snapshots are fully deleted.", global = true, project = true)
+ description = "After this number of weeks, all snapshots are fully deleted.",
+ global = true,
+ project = true,
+ type = Property.Type.INTEGER)
}
)
public final class DbCleanerPlugin extends SonarPlugin {
diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DefaultPurgeTask.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DefaultPurgeTask.java
index 10f75cc1ef7..6fe63815b53 100644
--- a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DefaultPurgeTask.java
+++ b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DefaultPurgeTask.java
@@ -37,7 +37,11 @@ import org.sonar.plugins.dbcleaner.period.DefaultPeriodCleaner;
@Property(
key = DbCleanerConstants.PROPERTY_CLEAN_DIRECTORY,
defaultValue = "true",
- name = "Clean history data of directories/packages")
+ name = "Clean history data of directories/packages",
+ global = true,
+ project = true,
+ module = false,
+ type = Property.Type.BOOLEAN)
})
public class DefaultPurgeTask implements PurgeTask {
private static final Logger LOG = LoggerFactory.getLogger(DefaultPurgeTask.class);
diff --git a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsPlugin.java b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsPlugin.java
index 0debfdac798..115feb801d2 100644
--- a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsPlugin.java
+++ b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsPlugin.java
@@ -25,25 +25,30 @@ import java.util.ArrayList;
import java.util.List;
@Properties({
- @Property(
- key = CoreProperties.FINDBUGS_EFFORT_PROPERTY,
- defaultValue = CoreProperties.FINDBUGS_EFFORT_DEFAULT_VALUE,
- name = "Effort",
- description = "Effort of the bug finders. Valid values are Min, Default and Max. Setting 'Max' increases precision but also increases " +
- "memory consumption.",
- project = true, module = true, global = true),
- @Property(
- key = CoreProperties.FINDBUGS_TIMEOUT_PROPERTY,
- defaultValue = CoreProperties.FINDBUGS_TIMEOUT_DEFAULT_VALUE + "",
- name = "Timeout",
- description = "Specifies the amount of time, in milliseconds, that FindBugs may run before it is assumed to be hung and is terminated. " +
- "The default is 600,000 milliseconds, which is ten minutes.",
- project = true, module = true, global = true),
- @Property(
- key = FindbugsConstants.EXCLUDES_FILTERS_PROPERTY,
- name = "Excludes Filters",
- description = "Paths to findbugs filter-files with exclusions (comma-separated).",
- project = true, module = true, global = true) })
+ @Property(
+ key = CoreProperties.FINDBUGS_EFFORT_PROPERTY,
+ defaultValue = CoreProperties.FINDBUGS_EFFORT_DEFAULT_VALUE,
+ name = "Effort",
+ description = "Effort of the bug finders. Valid values are Min, Default and Max. Setting 'Max' increases precision but also increases " +
+ "memory consumption.",
+ project = true,
+ module = true,
+ global = true),
+ @Property(
+ key = CoreProperties.FINDBUGS_TIMEOUT_PROPERTY,
+ defaultValue = CoreProperties.FINDBUGS_TIMEOUT_DEFAULT_VALUE + "",
+ name = "Timeout",
+ description = "Specifies the amount of time, in milliseconds, that FindBugs may run before it is assumed to be hung and is terminated. " +
+ "The default is 600,000 milliseconds, which is ten minutes.",
+ project = true,
+ module = true,
+ global = true,
+ type = Property.Type.INTEGER),
+ @Property(
+ key = FindbugsConstants.EXCLUDES_FILTERS_PROPERTY,
+ name = "Excludes Filters",
+ description = "Paths to findbugs filter-files with exclusions (comma-separated).",
+ project = true, module = true, global = true)})
public class FindbugsPlugin extends SonarPlugin {
public List<Class<? extends Extension>> getExtensions() {
diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
index d5bca7a5bdc..7ff09ae2a5e 100644
--- a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
+++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
@@ -50,6 +50,7 @@ display=Display
download_verb=Download
edit=Edit
events=Events
+false=False
file=File
files=Files
filter_verb=Filter
@@ -119,6 +120,7 @@ template=Template
title=Title
to=To
treemap=Treemap
+true=True
update_verb=Update
updated=Updated
unfollow=Unfollow
@@ -298,7 +300,6 @@ default_filters.page=Default Filters
dependencies.page=Dependencies
duplications.page=Duplications
email_configuration.page=Email Settings
-encryption.page=Settings Encryption
event_categories.page=Event Categories
filters.page=Filters
global_roles.page=Global Roles
@@ -538,6 +539,7 @@ dashboard.error_unshare_default=This dashboard can't be unshared as long as it's
#------------------------------------------------------------------------------
settings.save_category=Save {0} Settings
property.category.email=Email
+property.category.encryption=Encryption
property.category.general=General
property.category.security=Security
property.category.java=Java
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidPlugin.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidPlugin.java
index 2fefae93927..6e06dd8fde6 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidPlugin.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidPlugin.java
@@ -29,39 +29,40 @@ import java.util.Arrays;
import java.util.List;
@Properties({
- @Property(key = SquidPluginProperties.SQUID_ANALYSE_ACCESSORS_PROPERTY,
- defaultValue = SquidPluginProperties.SQUID_ANALYSE_ACCESSORS_DEFAULT_VALUE
- + "",
- name = "Separate accessors",
- description = "Flag whether Squid should separate accessors (getters/setters) from methods. " +
- "In that case, accessors are not counted in metrics such as complexity or API documentation.",
- project = true,
- global = true,
- category = CoreProperties.CATEGORY_JAVA),
- @Property(key = SquidPluginProperties.FIELDS_TO_EXCLUDE_FROM_LCOM4_COMPUTATION,
- defaultValue = SquidPluginProperties.FIELDS_TO_EXCLUDE_FROM_LCOM4_COMPUTATION_DEFAULT_VALUE,
- name = "List of fields to exclude from LCOM4 computation",
- description = "Some fields should not be taken into account when computing LCOM4 measure as they " +
- "unexpectedly and artificially decrease the LCOM4 measure. "
- + "The best example is a logger used by all methods of a class. " +
- "All field names to exclude from LCOM4 computation must be separated by a comma.",
- project = true,
- global = true,
- category = CoreProperties.CATEGORY_JAVA),
- @Property(
- key = CoreProperties.DESIGN_SKIP_DESIGN_PROPERTY,
- defaultValue = "" + CoreProperties.DESIGN_SKIP_DESIGN_DEFAULT_VALUE,
- name = "Skip design analysis",
- project = true,
- global = true,
- category = CoreProperties.CATEGORY_JAVA)
+ @Property(key = SquidPluginProperties.SQUID_ANALYSE_ACCESSORS_PROPERTY,
+ defaultValue = SquidPluginProperties.SQUID_ANALYSE_ACCESSORS_DEFAULT_VALUE + "",
+ name = "Separate accessors",
+ description = "Flag whether Squid should separate accessors (getters/setters) from methods. " +
+ "In that case, accessors are not counted in metrics such as complexity or API documentation.",
+ project = true,
+ global = true,
+ category = CoreProperties.CATEGORY_JAVA,
+ type = Property.Type.BOOLEAN),
+ @Property(key = SquidPluginProperties.FIELDS_TO_EXCLUDE_FROM_LCOM4_COMPUTATION,
+ defaultValue = SquidPluginProperties.FIELDS_TO_EXCLUDE_FROM_LCOM4_COMPUTATION_DEFAULT_VALUE,
+ name = "List of fields to exclude from LCOM4 computation",
+ description = "Some fields should not be taken into account when computing LCOM4 measure as they " +
+ "unexpectedly and artificially decrease the LCOM4 measure. "
+ + "The best example is a logger used by all methods of a class. " +
+ "All field names to exclude from LCOM4 computation must be separated by a comma.",
+ project = true,
+ global = true,
+ category = CoreProperties.CATEGORY_JAVA),
+ @Property(
+ key = CoreProperties.DESIGN_SKIP_DESIGN_PROPERTY,
+ defaultValue = "" + CoreProperties.DESIGN_SKIP_DESIGN_DEFAULT_VALUE,
+ name = "Skip design analysis",
+ project = true,
+ global = true,
+ category = CoreProperties.CATEGORY_JAVA,
+ type = Property.Type.BOOLEAN)
})
public final class SquidPlugin extends SonarPlugin {
public List getExtensions() {
return Arrays.asList(SquidSensor.class, SquidRuleRepository.class, JavaSourceImporter.class,
- ClassComplexityDistributionBuilder.class, FunctionComplexityDistributionBuilder.class, ClassesDecorator.class,
- ChidamberKemererDistributionBuilder.class, FunctionsDecorator.class);
+ ClassComplexityDistributionBuilder.class, FunctionComplexityDistributionBuilder.class, ClassesDecorator.class,
+ ChidamberKemererDistributionBuilder.class, FunctionsDecorator.class);
}
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/Property.java b/sonar-plugin-api/src/main/java/org/sonar/api/Property.java
index d0506e0418b..b48b0f5ec5a 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/Property.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/Property.java
@@ -46,6 +46,13 @@ import java.lang.annotation.Target;
public @interface Property {
/**
+ * @since 2.15
+ */
+ public static enum Type {
+ STRING, TEXT, PASSWORD, BOOLEAN, INTEGER, FLOAT, SINGLE_SELECT_LIST
+ }
+
+ /**
* Unique key within all plugins. It's recommended to prefix the key by 'sonar.' and the plugin name. Examples :
* 'sonar.cobertura.reportPath' and 'sonar.cpd.minimumTokens'.
*/
@@ -76,4 +83,17 @@ public @interface Property {
* Is the property displayed in global settings page ?
*/
boolean global() default true;
+
+ /**
+ * @since 2.15
+ */
+ Type type() default Type.STRING;
+
+ /**
+ * Options for *_LIST types
+ *
+ * @since 2.15
+ */
+ String[] options() default {};
+
}
diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterClient.java b/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterClient.java
index 41613c297da..27d8df7e0a3 100644
--- a/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterClient.java
+++ b/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterClient.java
@@ -42,20 +42,21 @@ import java.util.Date;
* @since 2.4
*/
@Properties({
- @Property(
- key = "sonar.updatecenter.activate",
- defaultValue = "true",
- name = "Enable Update Center",
- project = false,
- global = false, // hidden from UI
- category = "Update Center"),
- @Property(
- key = UpdateCenterClient.URL_PROPERTY,
- defaultValue = "http://update.sonarsource.org/update-center.properties",
- name = "Update Center URL",
- project = false,
- global = false, // hidden from UI
- category = "Update Center")
+ @Property(
+ key = "sonar.updatecenter.activate",
+ defaultValue = "true",
+ name = "Enable Update Center",
+ project = false,
+ global = false, // hidden from UI
+ category = "Update Center",
+ type = Property.Type.BOOLEAN),
+ @Property(
+ key = UpdateCenterClient.URL_PROPERTY,
+ defaultValue = "http://update.sonarsource.org/update-center.properties",
+ name = "Update Center URL",
+ project = false,
+ global = false, // hidden from UI
+ category = "Update Center")
})
public class UpdateCenterClient implements ServerComponent {
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
index ee1d52b3427..f51f6564063 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
@@ -141,7 +141,6 @@
<li class="<%= 'selected' if controller.controller_path=='updatecenter' -%>">
<a href="<%= ApplicationController.root_context -%>/updatecenter"><%= message('update_center.page') -%></a></li>
<% end %>
- <li class="<%= 'selected' if request.request_uri.include?('/encryption') -%>"><a href="<%= ApplicationController.root_context -%>/encryption"><%= message('encryption.page') -%></a></li>
<% end %>
<% end %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/server_id_configuration/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/server_id_configuration/index.html.erb
index 541f6d71ed6..c3514a80147 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/server_id_configuration/index.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/server_id_configuration/index.html.erb
@@ -36,7 +36,7 @@
<p class="marginbottom10"><%= message('server_id_configuration.organisation.desc') -%></p>
<p>
- <input type="text" name="organisation" value="<%= @organisation -%>"/>
+ <input type="text" name="organisation" value="<%= @organisation -%>" size="50"/>
</p>
</td>
</tr>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb
index 5afdf02ddbf..87a5a99b803 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb
@@ -24,10 +24,11 @@
}
</style>
<script type="text/javascript">
- function replaceTextField(span_id, key) {
- var text_field_value = $F(key);
- var text_area = '<textarea cols="100" id="' + key + '" name="' + key + '" rows="10">' + text_field_value + '</textarea>';
- $(span_id).replace(text_area);
+ function enlargeTextInput(propertyKey) {
+ var eltId = 'input_' + propertyKey;
+ var textValue = $F(eltId);
+ var textArea = '<textarea class="width100" id="' + propertyKey + '" name="' + propertyKey + '" rows="10" id="input_' + propertyKey + '">' + textValue + '</textarea>';
+ $(eltId).parentNode.replace(textArea);
}
</script>
<div id="plugins">
@@ -85,6 +86,9 @@
if @properties_per_category[@category]
@properties_per_category[@category].each do |property|
value = Property.value(property.key(), (@project ? @project.id : nil), '')
+
+ # for backward-compatibility with properties that do not define the type TEXT
+ property_type = value.include?("\n") ? 'TEXT' : property.type
%>
<tr class="<%= cycle('even', 'odd', :name => 'properties') -%>">
<td style="padding: 10px">
@@ -97,13 +101,8 @@
if desc.present? %>
<p class="marginbottom10"><%= desc -%></p>
<% end %>
+ <div><%= render :partial => "settings/type_#{property_type}", :locals => {:property => property, :value => value} -%></div>
<p>
- <% span_id = "text_" + property.key().gsub('.', '_') %>
- <% textfield = text_field_tag property.key(), value, :size => '20' %>
- <% textfield += link_to_function(image_tag("zoom.png"), "replaceTextField('#{span_id}', '#{property.key()}')", :id => "toggle_text", :class => 'nolink') %>
- <% textarea = text_area_tag property.key(), value, :size => "100x10" %>
- <span id="<%= span_id %>"><%= (value && value.length >= 50) ? textarea : textfield -%></span>
-
<%
default_prop_value = (@project ? Property.value(property.key(), nil, property.defaultValue()) : property.defaultValue())
unless default_prop_value.blank? %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_BOOLEAN.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_BOOLEAN.html.erb
new file mode 100644
index 00000000000..55e4fc408f3
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_BOOLEAN.html.erb
@@ -0,0 +1,5 @@
+<select name="<%= h property.key -%>" id="input_<%= h property.key-%>">
+ <option value="" <%= 'selected' if value.blank? -%>><%= message('default') -%></option>
+ <option value="true" <%= 'selected' if value=='true' -%>><%= message('true') -%></option>
+ <option value="false" <%= 'selected' if value=='false' -%>><%= message('false') -%></option>
+</select> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_FLOAT.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_FLOAT.html.erb
new file mode 100644
index 00000000000..6706e88ecb2
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_FLOAT.html.erb
@@ -0,0 +1 @@
+<input type="text" name="<%= h property.key -%>" value="<%= h value if value -%>" size="50" id="input_<%= h property.key-%>"/> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_INTEGER.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_INTEGER.html.erb
new file mode 100644
index 00000000000..6706e88ecb2
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_INTEGER.html.erb
@@ -0,0 +1 @@
+<input type="text" name="<%= h property.key -%>" value="<%= h value if value -%>" size="50" id="input_<%= h property.key-%>"/> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_PASSWORD.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_PASSWORD.html.erb
new file mode 100644
index 00000000000..3b6d49854b7
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_PASSWORD.html.erb
@@ -0,0 +1 @@
+<input type="password" name="<%= h property.key -%>" value="<%= h value if value -%>" size="50" id="input_<%= h property.key-%>"/> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_SINGLE_SELECT_LIST.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_SINGLE_SELECT_LIST.html.erb
new file mode 100644
index 00000000000..a6f905a3038
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_SINGLE_SELECT_LIST.html.erb
@@ -0,0 +1,6 @@
+<select name="<%= h property.key -%>" id="input_<%= h property.key-%>">
+ <option value=""><%= message('default') -%></option>
+ <% property.options.each do |option| %>
+ <option value="<%= h option -%>"><%= h option -%></option>
+ <% end %>
+</select> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_TEXT.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_TEXT.html.erb
new file mode 100644
index 00000000000..c557137557e
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_TEXT.html.erb
@@ -0,0 +1 @@
+<textarea rows="5" cols="80" class="width100" name="<%= h property.key -%>" id="input_<%= h property.key-%>"><%= h value if value -%></textarea> \ No newline at end of file