diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2011-11-28 15:37:25 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2011-11-28 15:59:16 +0100 |
commit | 0b8d3782ffe66fbad7ab01238d30a84a57d2a2ef (patch) | |
tree | 3b7331dd3250f51459f1535845b422922a7331e8 /plugins/sonar-design-plugin/src | |
parent | 8b775b812a4e50f49e4a0e13320f28231e0f96ec (diff) | |
download | sonarqube-0b8d3782ffe66fbad7ab01238d30a84a57d2a2ef.tar.gz sonarqube-0b8d3782ffe66fbad7ab01238d30a84a57d2a2ef.zip |
SONAR-3039 Refactor the LCOM4 viewer with Ruby extension
Diffstat (limited to 'plugins/sonar-design-plugin/src')
8 files changed, 0 insertions, 266 deletions
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 ac392718a4f..c4a8aabe8e8 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 @@ -23,7 +23,6 @@ import com.google.common.collect.Lists; import org.sonar.api.SonarPlugin; import org.sonar.plugins.design.batch.*; import org.sonar.plugins.design.ui.dependencies.GwtDependenciesTab; -import org.sonar.plugins.design.ui.lcom4.GwtLcom4Tab; import org.sonar.plugins.design.ui.libraries.GwtLibrariesPage; import org.sonar.plugins.design.ui.page.GwtDesignPage; import org.sonar.plugins.design.ui.widgets.ChidamberKemererWidget; @@ -51,7 +50,6 @@ public class DesignPlugin extends SonarPlugin { extensions.add(FileDesignWidget.class); extensions.add(PackageDesignWidget.class); extensions.add(ChidamberKemererWidget.class); - extensions.add(GwtLcom4Tab.class); return extensions; } diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/lcom4/GwtLcom4Tab.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/lcom4/GwtLcom4Tab.java deleted file mode 100644 index 51eef44558a..00000000000 --- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/lcom4/GwtLcom4Tab.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2011 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.lcom4; - -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.plugins.design.ui.lcom4.client.Lcom4Tab; - -@ResourceLanguage(Java.KEY) -@ResourceQualifier({Resource.QUALIFIER_CLASS}) -@DefaultTab(metrics = {CoreMetrics.LCOM4_KEY}) -@NavigationSection({NavigationSection.RESOURCE_TAB}) -@UserRole(UserRole.CODEVIEWER) -public class GwtLcom4Tab extends GwtPage { - - public String getTitle() { - return "LCOM4"; - } - - public String getGwtId() { - return Lcom4Tab.GWT_ID; - } -} diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/lcom4/client/Data.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/lcom4/client/Data.java deleted file mode 100644 index 76ee31729f2..00000000000 --- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/lcom4/client/Data.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2011 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.lcom4.client; - -import com.google.gwt.core.client.JavaScriptObject; - -public final class Data { - - public static class Entity extends JavaScriptObject { - // Overlay types always have protected, zero-arg ctors - protected Entity() { - } - - public final native String getName() /*-{ return this.n; }-*/; - public final native String getQualifier() /*-{ return this.q; }-*/; - } - - public static class Block extends JavaScriptObject { - protected Block() { - } - public final native int size() /*-{ return this.length; }-*/; - public final native Entity get(int i) /*-{ return this[i]; }-*/; - } - - public static class Blocks extends JavaScriptObject { - protected Blocks() { - } - public final native int size() /*-{ return this.length; }-*/; - public final native Block get(int i) /*-{ return this[i]; }-*/; - } - - public static native Blocks parse(String json) /*-{ - return eval('(' + json + ')') - }-*/; -} diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/lcom4/client/Lcom4Tab.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/lcom4/client/Lcom4Tab.java deleted file mode 100644 index b9aaba09578..00000000000 --- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/lcom4/client/Lcom4Tab.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2011 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.lcom4.client; - -import com.google.gwt.i18n.client.Dictionary; -import com.google.gwt.user.client.ui.*; -import org.sonar.gwt.ui.Icons; -import org.sonar.gwt.ui.Loading; -import org.sonar.gwt.ui.Page; -import org.sonar.wsclient.gwt.AbstractCallback; -import org.sonar.wsclient.gwt.Sonar; -import org.sonar.wsclient.services.Resource; -import org.sonar.wsclient.services.ResourceQuery; - -public class Lcom4Tab extends Page { - public static final String GWT_ID = "org.sonar.plugins.design.ui.lcom4.Lcom4Tab"; - - private VerticalPanel panel; - - @Override - protected Widget doOnResourceLoad(Resource resource) { - panel = new VerticalPanel(); - panel.setWidth("100%"); - loadData(resource); - return panel; - } - - private void loadData(Resource resource) { - panel.add(new Loading()); - ResourceQuery query = ResourceQuery.createForMetrics(resource.getId().toString(), "lcom4", "lcom4_blocks"); - Sonar.getInstance().find(query, new AbstractCallback<Resource>() { - @Override - protected void doOnResponse(Resource resource) { - panel.clear(); - panel.add(new Header(resource)); - if (resource != null && resource.getMeasure("lcom4_blocks") != null) { - String json = resource.getMeasure("lcom4_blocks").getData(); - Data.Blocks blocks = Data.parse(json); - - Grid grid = new Grid(blocks.size(), 2); - grid.setStyleName("lcom4blocks"); - grid.getColumnFormatter().setStyleName(0, "index"); - - for (int indexBlock = 0; indexBlock < blocks.size(); indexBlock++) { - Data.Block block = blocks.get(indexBlock); - grid.setHTML(indexBlock, 0, "<div class='index'>" + (indexBlock + 1) + "</div>"); - - VerticalPanel blockPanel = new VerticalPanel(); - blockPanel.setStyleName("lcom4block"); - - for (int indexEntity = 0; indexEntity < block.size(); indexEntity++) { - Data.Entity entity = block.get(indexEntity); - HTML row = new HTML(Icons.forQualifier(entity.getQualifier()).getHTML() + " " + entity.getName()); - row.setStyleName("lcom4row"); - blockPanel.add(row); - } - grid.setWidget(indexBlock, 1, blockPanel); - - } - panel.add(grid); - } - } - }); - } - - private static class Header extends Composite { - private FlowPanel header; - - public Header(Resource resource) { - header = new FlowPanel(); - header.setStyleName("gwt-ViewerHeader"); - - HorizontalPanel panel = new HorizontalPanel(); - HTML html = new HTML(Dictionary.getDictionary("l10n").get("lcom4.metric") + ": "); - html.setStyleName("metric"); - panel.add(html); - - if (resource != null) { - html = new HTML(resource.getMeasureFormattedValue("lcom4", "-")); - html.setStyleName("value"); - panel.add(html); - } - - header.add(panel); - initWidget(header); - } - } -} diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/lcom4/Lcom4Tab.gwt.xml b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/lcom4/Lcom4Tab.gwt.xml deleted file mode 100644 index 124aa37c47d..00000000000 --- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/lcom4/Lcom4Tab.gwt.xml +++ /dev/null @@ -1,8 +0,0 @@ -<module> - <inherits name="com.google.gwt.user.User"/> - <inherits name="com.google.gwt.json.JSON"/> - <inherits name="com.google.gwt.http.HTTP"/> - <inherits name="org.sonar.Sonar"/> - <stylesheet src="lcom4.css"/> - <entry-point class="org.sonar.plugins.design.ui.lcom4.client.Lcom4Tab"/> -</module> diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/lcom4/Lcom4TabDev.gwt.xml b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/lcom4/Lcom4TabDev.gwt.xml deleted file mode 100644 index c4f98f07a4c..00000000000 --- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/lcom4/Lcom4TabDev.gwt.xml +++ /dev/null @@ -1,6 +0,0 @@ -<module rename-to="org.sonar.plugins.design.ui.lcom4.Lcom4Tab"> - <inherits name="org.sonar.plugins.design.ui.lcom4.Lcom4Tab"/> - <inherits name="org.sonar.SonarDev"/> - - <entry-point class="org.sonar.plugins.design.ui.lcom4.client.Lcom4Tab"/> -</module> diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/lcom4/public/lcom4.css b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/lcom4/public/lcom4.css deleted file mode 100644 index bbd35eb6237..00000000000 --- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/lcom4/public/lcom4.css +++ /dev/null @@ -1,23 +0,0 @@ -.lcom4blocks { - width: 100%; - margin-top: 10px; -} -.lcom4blocks td { - vertical-align: top; -} -.lcom4blocks .index { - font-size: 130%; - text-align: center; - width: 2em; - margin-top: 3px; -} -.lcom4block { - width: 100%; - border: 1px solid #ccc; - margin-bottom: 15px; - background-color: #eee; -} -.lcom4row { - padding: 2px 5px; - word-wrap:break-word; -}
\ No newline at end of file diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/lcom4/public/lcom4.html b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/lcom4/public/lcom4.html deleted file mode 100644 index 8ae47cdd1c0..00000000000 --- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/lcom4/public/lcom4.html +++ /dev/null @@ -1,28 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html> -<head> - <meta http-equiv="content-type" content="text/html; charset=UTF-8"> - <meta name="gwt:property" content="locale=fr_CH"> - - <title>LCOM4</title> - <link href="http://localhost:9000/stylesheets/sonar.css" media="all" rel="Stylesheet" type="text/css" /> - <script src="http://localhost:9000/javascripts/sonar.js" type="text/javascript"></script> -</head> - -<body> -<h1>LCOM4</h1> -<div id="gwtpage"> -</div> -<script type="text/javascript"> -var config = { - "sonar_url": "http://localhost:9000", - "metric":"lcom4", - "resource":[{"id":11, "key":"org.apache.struts:struts-core:org.apache.struts.action.Action","scope": "FIL", "qualifier": "CLA", "name": "ActionServlet", "lang":"java"}] -}; - var modules = {}; -</script> -<script type="text/javascript" language="javascript" src="org.sonar.plugins.design.ui.lcom4.Lcom4Tab.nocache.js"></script> -</body> -</html>
\ No newline at end of file |