aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorFabrice Bellingard <bellingard@gmail.com>2012-03-23 12:42:22 +0100
committerFabrice Bellingard <bellingard@gmail.com>2012-03-23 12:42:22 +0100
commit45b4fc44842d66987859f19975a5057930cf8a25 (patch)
tree57daf39dd8fad57c753a8c2bb9e5dd48e94672e3 /plugins
parent18c36f6513d75d1cdbafcd7c16ddcf91214b2ca5 (diff)
downloadsonarqube-45b4fc44842d66987859f19975a5057930cf8a25.tar.gz
sonarqube-45b4fc44842d66987859f19975a5057930cf8a25.zip
SONAR-2197 Be able to display Design/Libraries tab for any languages
Also modified to be displayed only when required measures are available: - the Dependencies tab - the LCOM4 tab
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/web/Lcom4Viewer.java14
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/GwtDependenciesTab.java17
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/GwtLibrariesPage.java7
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/GwtDesignPage.java10
4 files changed, 30 insertions, 18 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/web/Lcom4Viewer.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/web/Lcom4Viewer.java
index b4cb02c2a0a..c0a042e0fe5 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/web/Lcom4Viewer.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/web/Lcom4Viewer.java
@@ -19,13 +19,19 @@
*/
package org.sonar.plugins.core.web;
-import org.sonar.api.resources.Java;
+import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.resources.Qualifiers;
-import org.sonar.api.web.*;
+import org.sonar.api.web.AbstractRubyTemplate;
+import org.sonar.api.web.DefaultTab;
+import org.sonar.api.web.NavigationSection;
+import org.sonar.api.web.RequiredMeasures;
+import org.sonar.api.web.ResourceQualifier;
+import org.sonar.api.web.RubyRailsPage;
+import org.sonar.api.web.UserRole;
+@RequiredMeasures(mandatory = {CoreMetrics.LCOM4_KEY})
@NavigationSection(NavigationSection.RESOURCE_TAB)
@UserRole(UserRole.CODEVIEWER)
-@ResourceLanguage(Java.KEY)
@ResourceQualifier(Qualifiers.CLASS)
@DefaultTab(metrics = {"lcom4", "lcom4_blocks"})
public class Lcom4Viewer extends AbstractRubyTemplate implements RubyRailsPage {
@@ -42,4 +48,4 @@ public class Lcom4Viewer extends AbstractRubyTemplate implements RubyRailsPage {
protected String getTemplatePath() {
return "/org/sonar/plugins/core/web/lcom4_viewer.html.erb";
}
-} \ No newline at end of file
+}
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/GwtDependenciesTab.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/GwtDependenciesTab.java
index 4ca4bdce4ab..a4a20028ba4 100644
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/GwtDependenciesTab.java
+++ b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/GwtDependenciesTab.java
@@ -20,17 +20,20 @@
package org.sonar.plugins.design.ui.dependencies;
import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.resources.Java;
-
import org.sonar.api.resources.Resource;
-import org.sonar.api.web.*;
+import org.sonar.api.web.DefaultTab;
+import org.sonar.api.web.GwtPage;
+import org.sonar.api.web.NavigationSection;
+import org.sonar.api.web.RequiredMeasures;
+import org.sonar.api.web.ResourceQualifier;
+import org.sonar.api.web.UserRole;
import org.sonar.plugins.design.ui.dependencies.client.DependenciesTab;
-@ResourceLanguage({Java.KEY, "web"}) // 'web' is a temporary workaround. See http://sonar-dev.787459.n3.nabble.com/sonar-dev-Dependencies-in-Web-Plugin-td822980.html#a822980
+@RequiredMeasures(mandatory = {CoreMetrics.AFFERENT_COUPLINGS_KEY, CoreMetrics.EFFERENT_COUPLINGS_KEY})
@ResourceQualifier({Resource.QUALIFIER_FILE, Resource.QUALIFIER_CLASS, Resource.QUALIFIER_PACKAGE, Resource.QUALIFIER_PROJECT, Resource.QUALIFIER_MODULE})
-@DefaultTab(metrics={CoreMetrics.AFFERENT_COUPLINGS_KEY, CoreMetrics.EFFERENT_COUPLINGS_KEY})
+@DefaultTab(metrics = {CoreMetrics.AFFERENT_COUPLINGS_KEY, CoreMetrics.EFFERENT_COUPLINGS_KEY})
@NavigationSection({NavigationSection.RESOURCE_TAB})
-@UserRole(UserRole.USER)
+@UserRole(UserRole.USER)
public class GwtDependenciesTab extends GwtPage {
public String getTitle() {
@@ -41,5 +44,3 @@ public class GwtDependenciesTab extends GwtPage {
return DependenciesTab.GWT_ID;
}
}
-
-
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/GwtLibrariesPage.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/GwtLibrariesPage.java
index 93cca857511..b117dad6858 100644
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/GwtLibrariesPage.java
+++ b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/libraries/GwtLibrariesPage.java
@@ -19,12 +19,13 @@
*/
package org.sonar.plugins.design.ui.libraries;
-import org.sonar.api.resources.Java;
import org.sonar.api.resources.Resource;
-import org.sonar.api.web.*;
+import org.sonar.api.web.GwtPage;
+import org.sonar.api.web.NavigationSection;
+import org.sonar.api.web.ResourceQualifier;
+import org.sonar.api.web.UserRole;
import org.sonar.plugins.design.ui.libraries.client.LibrariesPage;
-@ResourceLanguage(Java.KEY)
@ResourceQualifier({Resource.QUALIFIER_PROJECT, Resource.QUALIFIER_MODULE})
@NavigationSection(NavigationSection.RESOURCE)
@UserRole(UserRole.USER)
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/GwtDesignPage.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/GwtDesignPage.java
index 6109e4b7691..602dd93720b 100644
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/GwtDesignPage.java
+++ b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/GwtDesignPage.java
@@ -20,12 +20,16 @@
package org.sonar.plugins.design.ui.page;
import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.resources.Java;
import org.sonar.api.resources.Qualifiers;
-import org.sonar.api.web.*;
+import org.sonar.api.web.DefaultTab;
+import org.sonar.api.web.GwtPage;
+import org.sonar.api.web.NavigationSection;
+import org.sonar.api.web.RequiredMeasures;
+import org.sonar.api.web.ResourceQualifier;
+import org.sonar.api.web.UserRole;
import org.sonar.plugins.design.ui.page.client.DesignPage;
-@ResourceLanguage(Java.KEY)
+@RequiredMeasures(mandatory = {CoreMetrics.DEPENDENCY_MATRIX_KEY})
@ResourceQualifier({Qualifiers.PROJECT, Qualifiers.MODULE, Qualifiers.PACKAGE, Qualifiers.DIRECTORY})
@DefaultTab(metrics = {
CoreMetrics.DEPENDENCY_MATRIX_KEY, CoreMetrics.PACKAGE_FEEDBACK_EDGES_KEY, CoreMetrics.PACKAGE_CYCLES_KEY,