From 3a4246ab08dc99138f112ebd1769ee8a7935be9a Mon Sep 17 00:00:00 2001 From: Fabrice Bellingard Date: Tue, 27 Mar 2012 15:40:24 +0200 Subject: SONAR-3114 Refactor the "Dependencies" tab (GWT -> Ruby) --- plugins/sonar-design-plugin/pom.xml | 1 - .../org/sonar/plugins/design/DesignPlugin.java | 16 ++-- .../design/ui/dependencies/DependenciesViewer.java | 51 +++++++++++ .../design/ui/dependencies/GwtDependenciesTab.java | 47 ----------- .../design/ui/dependencies/client/Data.java | 64 -------------- .../ui/dependencies/client/DependenciesTab.java | 98 ---------------------- .../ui/dependencies/client/DependenciesTable.java | 98 ---------------------- .../design/ui/dependencies/client/Header.java | 77 ----------------- .../design/ui/dependencies/DependenciesTab.gwt.xml | 9 -- .../ui/dependencies/DependenciesTabDev.gwt.xml | 6 -- .../ui/dependencies/dependencies_viewer.html.erb | 48 +++++++++++ .../ui/dependencies/public/dependencies-tab.css | 23 ----- .../design/ui/dependencies/public/test.html | 31 ------- .../main/resources/org/sonar/l10n/core.properties | 10 +++ 14 files changed, 120 insertions(+), 459 deletions(-) create mode 100644 plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/DependenciesViewer.java delete mode 100644 plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/GwtDependenciesTab.java delete mode 100644 plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/client/Data.java delete mode 100644 plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/client/DependenciesTab.java delete mode 100644 plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/client/DependenciesTable.java delete mode 100644 plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/client/Header.java delete mode 100644 plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/dependencies/DependenciesTab.gwt.xml delete mode 100644 plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/dependencies/DependenciesTabDev.gwt.xml create mode 100644 plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/dependencies/dependencies_viewer.html.erb delete mode 100644 plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/dependencies/public/dependencies-tab.css delete mode 100644 plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/dependencies/public/test.html (limited to 'plugins') diff --git a/plugins/sonar-design-plugin/pom.xml b/plugins/sonar-design-plugin/pom.xml index fbdb19cbac5..2ec2ceb9d5e 100644 --- a/plugins/sonar-design-plugin/pom.xml +++ b/plugins/sonar-design-plugin/pom.xml @@ -74,7 +74,6 @@ org.sonar.plugins.design.ui.page.DesignPage${gwt.permutationSuffix} - org.sonar.plugins.design.ui.dependencies.DependenciesTab${gwt.permutationSuffix} org.sonar.plugins.design.ui.libraries.LibrariesPage${gwt.permutationSuffix} ${skipGwt} diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java index 6bce7de316c..cb643053bfa 100644 --- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java +++ b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java @@ -19,20 +19,26 @@ */ package org.sonar.plugins.design; -import com.google.common.collect.Lists; +import java.util.List; + import org.sonar.api.SonarPlugin; -import org.sonar.plugins.design.batch.*; -import org.sonar.plugins.design.ui.dependencies.GwtDependenciesTab; +import org.sonar.plugins.design.batch.FileTangleIndexDecorator; +import org.sonar.plugins.design.batch.MavenDependenciesSensor; +import org.sonar.plugins.design.batch.PackageTangleIndexDecorator; +import org.sonar.plugins.design.batch.ProjectDsmDecorator; +import org.sonar.plugins.design.batch.SuspectLcom4DensityDecorator; +import org.sonar.plugins.design.ui.dependencies.DependenciesViewer; import org.sonar.plugins.design.ui.libraries.GwtLibrariesPage; import org.sonar.plugins.design.ui.page.GwtDesignPage; import org.sonar.plugins.design.ui.widgets.ChidamberKemererWidget; import org.sonar.plugins.design.ui.widgets.FileDesignWidget; import org.sonar.plugins.design.ui.widgets.PackageDesignWidget; -import java.util.List; +import com.google.common.collect.Lists; public class DesignPlugin extends SonarPlugin { + @SuppressWarnings({"unchecked", "rawtypes"}) public List getExtensions() { List extensions = Lists.newArrayList(); @@ -46,7 +52,7 @@ public class DesignPlugin extends SonarPlugin { // UI extensions.add(GwtDesignPage.class); - extensions.add(GwtDependenciesTab.class); + extensions.add(DependenciesViewer.class); extensions.add(FileDesignWidget.class); extensions.add(PackageDesignWidget.class); extensions.add(ChidamberKemererWidget.class); diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/DependenciesViewer.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/DependenciesViewer.java new file mode 100644 index 00000000000..ed69dd324f7 --- /dev/null +++ b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/DependenciesViewer.java @@ -0,0 +1,51 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2012 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.design.ui.dependencies; + +import org.sonar.api.measures.CoreMetrics; +import org.sonar.api.resources.Qualifiers; +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(allOf = {CoreMetrics.AFFERENT_COUPLINGS_KEY, CoreMetrics.EFFERENT_COUPLINGS_KEY}) +@ResourceQualifier({Qualifiers.FILE, Qualifiers.CLASS, Qualifiers.PACKAGE, Qualifiers.PROJECT, Qualifiers.MODULE}) +@DefaultTab(metrics = {CoreMetrics.AFFERENT_COUPLINGS_KEY, CoreMetrics.EFFERENT_COUPLINGS_KEY}) +@NavigationSection({NavigationSection.RESOURCE_TAB}) +@UserRole(UserRole.USER) +public class DependenciesViewer extends AbstractRubyTemplate implements RubyRailsPage { + + public String getId() { + return "dependencies_viewer"; + } + + public String getTitle() { + return "Dependencies"; + } + + @Override + protected String getTemplatePath() { + return "/org/sonar/plugins/design/ui/dependencies/dependencies_viewer.html.erb"; + } +} 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 deleted file mode 100644 index 3c479bebca6..00000000000 --- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/GwtDependenciesTab.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.design.ui.dependencies; - -import org.sonar.api.measures.CoreMetrics; -import org.sonar.api.resources.Qualifiers; -import org.sonar.api.resources.Resource; -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; - -@RequiredMeasures(allOf = {CoreMetrics.AFFERENT_COUPLINGS_KEY, CoreMetrics.EFFERENT_COUPLINGS_KEY}) -@ResourceQualifier({Qualifiers.FILE, Qualifiers.CLASS, Qualifiers.PACKAGE, Qualifiers.PROJECT, Qualifiers.MODULE}) -@DefaultTab(metrics = {CoreMetrics.AFFERENT_COUPLINGS_KEY, CoreMetrics.EFFERENT_COUPLINGS_KEY}) -@NavigationSection({NavigationSection.RESOURCE_TAB}) -@UserRole(UserRole.USER) -public class GwtDependenciesTab extends GwtPage { - - public String getTitle() { - return "Dependencies"; - } - - public String getGwtId() { - return DependenciesTab.GWT_ID; - } -} diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/client/Data.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/client/Data.java deleted file mode 100644 index 59e259c6f4c..00000000000 --- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/client/Data.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.design.ui.dependencies.client; - -import org.sonar.wsclient.services.Dependency; -import org.sonar.wsclient.services.Resource; - -import java.util.List; - -public class Data { - - private long resourceId; - private List dependencies = null; - private Resource resource = null; - - public Data(long resourceId) { - this.resourceId = resourceId; - } - - public long getResourceId() { - return resourceId; - } - - public boolean isLoaded() { - return dependencies!=null && resource!=null; - } - - public boolean canDisplay() { - return resource.getMeasure("ca")!=null && resource.getMeasure("ce")!=null; - } - - public List getDependencies() { - return dependencies; - } - - public void setDependencies(List dependencies) { - this.dependencies = dependencies; - } - - public Resource getResource() { - return resource; - } - - public void setMeasures(Resource resource) { - this.resource = resource; - } -} diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/client/DependenciesTab.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/client/DependenciesTab.java deleted file mode 100644 index 03a2192e2de..00000000000 --- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/client/DependenciesTab.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.design.ui.dependencies.client; - -import com.google.gwt.user.client.ui.FlowPanel; -import com.google.gwt.user.client.ui.Widget; -import org.sonar.gwt.Metrics; -import org.sonar.gwt.ui.Loading; -import org.sonar.gwt.ui.Page; -import org.sonar.wsclient.gwt.AbstractCallback; -import org.sonar.wsclient.gwt.AbstractListCallback; -import org.sonar.wsclient.gwt.Sonar; -import org.sonar.wsclient.services.Dependency; -import org.sonar.wsclient.services.DependencyQuery; -import org.sonar.wsclient.services.Resource; -import org.sonar.wsclient.services.ResourceQuery; - -import java.util.List; - -public class DependenciesTab extends Page { - public static final String GWT_ID = "org.sonar.plugins.design.ui.dependencies.DependenciesTab"; - - private FlowPanel panel = null; - private DependenciesTable dependenciesTable = null; - private Loading loading; - - @Override - protected Widget doOnResourceLoad(Resource resource) { - prepare(); - Data data = new Data(resource.getId()); - loadMeasures(data); - loadDependencies(data); - return panel; - } - - private void prepare() { - if (panel == null) { - panel = new FlowPanel(); - panel.getElement().setId("deps"); - loading = new Loading(); - dependenciesTable = new DependenciesTable(); - panel.setWidth("100%"); - } - panel.clear(); - panel.add(loading); - } - - private void loadMeasures(final Data data) { - ResourceQuery query = new ResourceQuery(data.getResourceId()); - query.setMetrics(Metrics.EFFERENT_COUPLINGS, Metrics.AFFERENT_COUPLINGS); - query.setVerbose(true); - Sonar.getInstance().find(query, new AbstractCallback() { - @Override - protected void doOnResponse(org.sonar.wsclient.services.Resource resource) { - data.setMeasures(resource); - displayMeasures(data); - } - }); - } - - private void loadDependencies(final Data data) { - DependencyQuery query = DependencyQuery.createForResource(data.getResourceId()); - Sonar.getInstance().findAll(query, new AbstractListCallback() { - - @Override - protected void doOnResponse(List dependencies) { - data.setDependencies(dependencies); - displayMeasures(data); - } - }); - } - - - private void displayMeasures(Data data) { - if (data.isLoaded()) { - panel.clear(); - dependenciesTable.display(data); - panel.add(dependenciesTable); - } - } -} diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/client/DependenciesTable.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/client/DependenciesTable.java deleted file mode 100644 index 8812b9706fb..00000000000 --- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/client/DependenciesTable.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.design.ui.dependencies.client; - -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.i18n.client.Dictionary; -import com.google.gwt.user.client.ui.*; -import org.sonar.gwt.Links; -import org.sonar.gwt.ui.Icons; -import org.sonar.wsclient.services.Dependency; - -public class DependenciesTable extends Composite { - - private HorizontalPanel panel; - - public DependenciesTable() { - panel = new HorizontalPanel(); - panel.setStylePrimaryName("dependencies"); - initWidget(panel); - } - - - public void display(final Data data) { - panel.clear(); - if (data.canDisplay()) { - panel.add(createIncomingColumn(data)); - panel.add(createOutgoingColumn(data)); - } else { - panel.add(new Label(Dictionary.getDictionary("l10n").get("noData"))); - } - } - - - private Panel createIncomingColumn(Data data) { - FlexTable grid = new FlexTable(); - grid.setStyleName("col"); - grid.setWidget(0, 1, new HTML(Dictionary.getDictionary("l10n").get("depsTab.afferentCouplings") + ": " + data.getResource().getMeasureIntValue("ca") + "")); - grid.getRowFormatter().setStyleName(0, "coltitle"); - - int row = 1; - for (Dependency dependency : data.getDependencies()) { - if (data.getResourceId() == dependency.getToId()) { - addDependencyRow(grid, row, dependency.getFromId(), dependency.getFromName() + " (" + dependency.getWeight() + ")"); - grid.setWidget(row, 0, Icons.forQualifier(dependency.getFromQualifier()).createImage()); - row++; - } - } - - return grid; - } - - private Panel createOutgoingColumn(Data data) { - FlexTable grid = new FlexTable(); - grid.setStyleName("col"); - grid.setWidget(0, 1, new HTML(Dictionary.getDictionary("l10n").get("depsTab.efferentCouplings") + ": " + data.getResource().getMeasureIntValue("ce") + "")); - grid.getRowFormatter().setStyleName(0, "coltitle"); - - int row = 1; - for (Dependency dependency : data.getDependencies()) { - if (data.getResourceId() == dependency.getFromId()) { - addDependencyRow(grid, row, dependency.getToId(), dependency.getToName() + " (" + dependency.getWeight() + ")"); - grid.setWidget(row, 0, Icons.forQualifier(dependency.getToQualifier()).createImage()); - row++; - } - } - - return grid; - } - - private void addDependencyRow(final FlexTable grid, final int row, final long resourceId, final String name) { - Label link = new Label(name); - link.setStyleName("link"); - link.addClickHandler(new ClickHandler() { - public void onClick(ClickEvent clickEvent) { - Links.openResourcePopup(String.valueOf(resourceId)); - } - }); - grid.setWidget(row, 1, link); - } -} \ No newline at end of file diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/client/Header.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/client/Header.java deleted file mode 100644 index 3160fc29d25..00000000000 --- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/dependencies/client/Header.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.design.ui.dependencies.client; - -import com.google.gwt.i18n.client.Dictionary; -import com.google.gwt.user.client.ui.*; -import org.sonar.wsclient.services.Measure; -import org.sonar.wsclient.services.Resource; - -public class Header extends Composite { - private FlowPanel header; - - public Header() { - header = new FlowPanel(); - header.setStyleName("gwt-ViewerHeader"); - initWidget(header); - } - - private void addMeasure(Panel panel, Resource resource, String key, String label) { - Measure measure = resource.getMeasure(key); - if (measure != null) { - HTML html = new HTML(label + ": "); - html.setStyleName("metric"); - panel.add(html); - - html = new HTML(measure.getFormattedValue("-")); - html.setStyleName("value"); - panel.add(html); - } - } - - public void display(Data data) { - header.clear(); - HorizontalPanel panel = new HorizontalPanel(); - header.add(panel); - Dictionary l10n = Dictionary.getDictionary("l10n"); - addMeasure(panel, data.getResource(), "classes", l10n.get("depsTab.classes")); - addMeasure(panel, data.getResource(), "dit", l10n.get("depsTab.dit")); - addMeasure(panel, data.getResource(), "noc", l10n.get("depsTab.noc")); - addMeasure(panel, data.getResource(), "rfc", l10n.get("depsTab.rfc")); - addLcom4(data, panel); - } - - private void addLcom4(Data data, HorizontalPanel panel) { - Measure lcom4 = data.getResource().getMeasure("lcom4"); - if (lcom4 != null && lcom4.getIntValue()!=null) { - HTML html = new HTML(Dictionary.getDictionary("l10n").get("depsTab.lcom4") + ": "); - html.setStyleName("metric"); - panel.add(html); - - html = new HTML(lcom4.getIntValue() + ""); - html.setStyleName("value"); - if (lcom4.getIntValue()>1) { - html.addStyleName("red bold"); - } - - panel.add(html); - } - } -} diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/dependencies/DependenciesTab.gwt.xml b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/dependencies/DependenciesTab.gwt.xml deleted file mode 100644 index dcb24d7e3fa..00000000000 --- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/dependencies/DependenciesTab.gwt.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/dependencies/DependenciesTabDev.gwt.xml b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/dependencies/DependenciesTabDev.gwt.xml deleted file mode 100644 index 44bf5bf0788..00000000000 --- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/dependencies/DependenciesTabDev.gwt.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/dependencies/dependencies_viewer.html.erb b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/dependencies/dependencies_viewer.html.erb new file mode 100644 index 00000000000..755512d6631 --- /dev/null +++ b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/dependencies/dependencies_viewer.html.erb @@ -0,0 +1,48 @@ +
+ +<% + ca = @snapshot.measure('ca') + ce = @snapshot.measure('ce') + dependencies = Dependency.find(:all, + :include => ['from','to'], + :conditions => ['(dependencies.from_snapshot_id=? OR dependencies.to_snapshot_id=?)', @snapshot.id, @snapshot.id]) + + resource_id = @resource.id + dependencies_by_measure = [] + dependencies_by_measure << {:metric => 'ca', :measure => ca, + :dependencies => dependencies.select {|dep| dep.to_resource_id == resource_id}} + dependencies_by_measure << {:metric => 'ce', :measure => ce, + :dependencies => dependencies.select {|dep| dep.from_resource_id == resource_id}} + + dependencies_by_measure.each do |deps_by_m| + metric_name = deps_by_m[:metric] + measure = deps_by_m[:measure] + deps = deps_by_m[:dependencies] +%> + +
+ + + + + + + + + + <% + deps.each do |dep| + resource = metric_name=='ca' ? dep.from : dep.to + %> + + + + + <% end %> + + +
<%= message('dependencies_viewer.' + metric_name) -%>: <%= format_measure(measure) -%>
<%= image_tag 'q/CLA.png'-%><%= link_to_resource resource, resource.long_name -%> (<%= dep.weight -%>)
+
+<% end %> + +
diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/dependencies/public/dependencies-tab.css b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/dependencies/public/dependencies-tab.css deleted file mode 100644 index 4bee7667fb1..00000000000 --- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/dependencies/public/dependencies-tab.css +++ /dev/null @@ -1,23 +0,0 @@ -#deps { - padding: 10px; -} - -#deps .data { - min-width: 380px; -} -#deps .col { - margin: 0 10px 0 0; - border-right: 1px solid #ccc; - border-left: 1px solid #ccc; - border-bottom: 1px solid #ccc; -} -#deps .col td { - padding: 3px 5px; -} - -#deps .coltitle { - background-color: #efefef; - padding: 3px; - border-top: 1px solid #ccc; - border-bottom: 1px solid #ccc; -} diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/dependencies/public/test.html b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/dependencies/public/test.html deleted file mode 100644 index 55cbc551234..00000000000 --- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/dependencies/public/test.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - Sources - - - - - - - - - - -
-
-
- - -load - - \ No newline at end of file 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 21c9bcb712f..1a60cfa55e8 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 @@ -325,6 +325,7 @@ violations.page=Violations violations_drilldown.page=Violations Drilldown update_center.page=Update Center lcom4_viewer.page=LCOM4 +dependencies_viewer.page=Dependencies # GWT pages @@ -836,6 +837,15 @@ code_viewer.create_violation.bad_assignee=Unknown assignee code_viewer.create_violation.unit_test_not_supported=Users can not create their own violations on unit test files. +#------------------------------------------------------------------------------ +# +# DEPENDENCIES VIEWER +# +#------------------------------------------------------------------------------ +dependencies_viewer.ca=Afferent (incoming) couplings +dependencies_viewer.ce=Efferent (outgoing) couplings + + #------------------------------------------------------------------------------ # # MANUAL MEASURES -- cgit v1.2.3