diff --git a/conformance/org.universaal.tools.conformancePlugin/META-INF/MANIFEST.MF b/conformance/org.universaal.tools.conformancePlugin/META-INF/MANIFEST.MF index 399417a050658d595f70df0c41d73dd23b997c74..5d50b450fa7dd293f0fc4cefdcc02806c8fb9aec 100644 --- a/conformance/org.universaal.tools.conformancePlugin/META-INF/MANIFEST.MF +++ b/conformance/org.universaal.tools.conformancePlugin/META-INF/MANIFEST.MF @@ -6,26 +6,15 @@ Bundle-Version: 0.5.1 Bundle-Activator: org.universaal.tools.conformance.Activator Bundle-Vendor: CERTH-ITI Require-Bundle: org.eclipse.ui;bundle-version="3.7.0", - org.eclipse.core.runtime;bundle-version="3.7.0", - org.eclipse.debug.core;bundle-version="3.7.0", org.eclipse.debug.ui;bundle-version="3.7.0", - org.eclipse.jdt.launching;bundle-version="3.6.0", - org.eclipse.pde.core;bundle-version="3.7.0", - org.eclipse.pde.ui;bundle-version="3.6.100", - org.eclipse.equinox.launcher;bundle-version="1.2.0", org.eclipse.core.runtime.compatibility;bundle-version="3.2.100", org.eclipse.jdt.core;bundle-version="3.7.0", org.sonar.ide.eclipse.ui;bundle-version="1.0.0", org.eclipse.m2e.maven.runtime;bundle-version="1.0.0", org.eclipse.jdt.ui;bundle-version="3.7.0", org.sonar.ide.eclipse.core;bundle-version="1.0.0", - org.sonar.ide.eclipse.jdt;bundle-version="1.0.0", org.sonar.ide.eclipse.sonar_embedder;bundle-version="1.0.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Import-Package: org.eclipse.core.internal.resources, - org.eclipse.pde.core.plugin, - org.eclipse.pde.internal.core.iproduct, - org.eclipse.pde.internal.core.util, - org.eclipse.pde.internal.ui.editor +Import-Package: org.eclipse.core.internal.resources Bundle-ActivationPolicy: lazy Plugin-Class: org.universaal.tools.conformance.Activator diff --git a/conformance/org.universaal.tools.conformancePlugin/build.properties b/conformance/org.universaal.tools.conformancePlugin/build.properties index 0f839537ea73dd61202663e8d1c9ab8a5219f2e6..98586ed018e4bb17c4029d661450f6623c83a417 100644 --- a/conformance/org.universaal.tools.conformancePlugin/build.properties +++ b/conformance/org.universaal.tools.conformancePlugin/build.properties @@ -3,6 +3,5 @@ output.. = bin/ bin.includes = plugin.xml,\ META-INF/,\ .,\ - icons/,\ - libs/org.sonar.ide.eclipse.ui_1.0.0.201011251615.jar + icons/ diff --git a/conformance/org.universaal.tools.conformancePlugin/plugin.xml b/conformance/org.universaal.tools.conformancePlugin/plugin.xml index 84f4e987111805c75195c967edca17619547d6ac..ad460655b2af848f0c899651065c3add060467c4 100644 --- a/conformance/org.universaal.tools.conformancePlugin/plugin.xml +++ b/conformance/org.universaal.tools.conformancePlugin/plugin.xml @@ -13,14 +13,30 @@ icon="icons/compile.png" class="org.universaal.tools.conformance.actions.ConformanceAction" tooltip="Test for conformance" - menubarPath="org.universaal.tools.AALStudio.menu/build" + menubarPath="org.universaal.tools.AALStudio.menu/test" toolbarPath="uAALGroup" id="org.universaal.tools.conformance.actions.ConformanceAction"> - </action> - + </action> </actionSet> - </extension> - + <extension + point="org.eclipse.ui.commands"> + <category + name="universAAL" + id="org.universaal.tools.conformance.commands"> + </category> + <command + name="Test for conformance" + categoryId="org.universaal.tools.conformance.commands" + id="org.universaal.tools.conformance.actions.ConformanceAction"> + </command> + </extension> + <extension + point="org.eclipse.ui.handlers"> + <handler + commandId="org.universaal.tools.conformance.actions.ConformanceAction" + class="org.universaal.tools.conformance.handlers.ConformanceHandler"> + </handler> + </extension> </plugin> \ No newline at end of file diff --git a/conformance/org.universaal.tools.conformancePlugin/src/org/universaal/tools/conformance/actions/ConformanceAction.java b/conformance/org.universaal.tools.conformancePlugin/src/org/universaal/tools/conformance/actions/ConformanceAction.java index 399ba01bb072d0bf26164d980dcef1d3f93919ba..eccb61689015550325925209704394368d8bc55c 100644 --- a/conformance/org.universaal.tools.conformancePlugin/src/org/universaal/tools/conformance/actions/ConformanceAction.java +++ b/conformance/org.universaal.tools.conformancePlugin/src/org/universaal/tools/conformance/actions/ConformanceAction.java @@ -3,6 +3,7 @@ package org.universaal.tools.conformance.actions; import java.io.File; import java.io.FileReader; import java.io.Reader; +import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -27,6 +28,7 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.IJobChangeEvent; import org.eclipse.core.runtime.jobs.Job; @@ -39,6 +41,7 @@ import org.eclipse.jdt.internal.core.PackageFragmentRoot; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.swt.widgets.Display; @@ -65,8 +68,6 @@ import org.sonar.wsclient.Sonar; import org.sonar.wsclient.services.Resource; import org.sonar.wsclient.services.ResourceQuery; - - /** * Our sample action implements workbench action delegate. The action proxy will * be created by the workbench and shown in the UI. When the user tries to use @@ -89,9 +90,9 @@ public class ConformanceAction implements IWorkbenchWindowActionDelegate { private String selectedProjectName = ""; private String selectedProjectPath = ""; private static IProject iproject = null; - private static String SONAR_SERVER_URL="http://universaal2008.itaca.upv.es:9000"; - private static String SONAR_SERVER_USERNAME="sonar"; - private static String SONAR_SERVER_PASSWORD="Sonar1"; + private static String SONAR_SERVER_URL = "http://84.124.53.250:9000"; + private static String SONAR_SERVER_USERNAME = "sonar"; + private static String SONAR_SERVER_PASSWORD = "Sonar1"; /** * The constructor. @@ -367,64 +368,69 @@ public class ConformanceAction implements IWorkbenchWindowActionDelegate { + selectedProjectName + "\"...", 50); setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.FALSE); - // URL url = Platform.getBundle( - // "org.universaal.tools.buildPlugin") - // .getEntry("icons/compile.png"); - // setProperty(IProgressConstants.ICON_PROPERTY, - // ImageDescriptor.createFromURL(url)); + URL url = Platform.getBundle( + "org.universaal.tools.aalstudio.core") + .getEntry("logo_32x32.png"); + setProperty(IProgressConstants.ICON_PROPERTY, + ImageDescriptor.createFromURL(url)); // adds sonar server to sonar preferences window ServersManager serversManager = ((ServersManager) SonarCorePlugin .getServersManager()); - serversManager.addServer( - SONAR_SERVER_URL, - SONAR_SERVER_USERNAME, SONAR_SERVER_PASSWORD); + serversManager.addServer(SONAR_SERVER_URL, + SONAR_SERVER_USERNAME, + SONAR_SERVER_PASSWORD); serversManager.save(); - setUpMavenBuild(); + setUpMaven(); monitor.worked(15); installResult = runSonarGoal(selectedProjectPath); monitor.worked(45); try { - + org.sonar.ide.eclipse.internal.ui.wizards.ConfigureProjectsWizard p1 = new org.sonar.ide.eclipse.internal.ui.wizards.ConfigureProjectsWizard( null, null); ConfigureProjectsWizard.ConfigureProjectsPage p = p1.new ConfigureProjectsPage( null, null); SonarProject myProject = p.new SonarProject( iproject); - myProject.setArtifactId(getArtifactIdOfSelectedProject()); - myProject.setGroupId(getGroupIdOfSelectedProject()); + myProject + .setArtifactId(getArtifactIdOfSelectedProject()); + myProject + .setGroupId(getGroupIdOfSelectedProject()); SonarProject[] projects = new SonarProject[1]; - projects[0]=myProject; + projects[0] = myProject; AssociateProjects associate = p.new AssociateProjects( SONAR_SERVER_URL, projects); - - - - // from file ConfigureProjectsWizard.java - - - - ResourceQuery query = new ResourceQuery().setScopes(Resource.SCOPE_SET).setQualifiers(Resource.QUALIFIER_PROJECT, - Resource.QUALIFIER_MODULE); - Sonar sonar = SonarCorePlugin.getServersManager().getSonar(SONAR_SERVER_URL); - List<Resource> resources = sonar.findAll(query); - for (SonarProject sonarProject : projects) { - for (Resource resource : resources) { - if (resource.getKey().endsWith(":" + sonarProject.getName())) { - sonarProject.setGroupId(StringUtils.substringBefore(resource.getKey(), ":")); - sonarProject.setArtifactId(sonarProject.getName()); - } - } - } - - - - - + + // from file ConfigureProjectsWizard.java + + ResourceQuery query = new ResourceQuery() + .setScopes(Resource.SCOPE_SET) + .setQualifiers( + Resource.QUALIFIER_PROJECT, + Resource.QUALIFIER_MODULE); + Sonar sonar = SonarCorePlugin + .getServersManager().getSonar( + SONAR_SERVER_URL); + List<Resource> resources = sonar.findAll(query); + for (SonarProject sonarProject : projects) { + for (Resource resource : resources) { + if (resource.getKey().endsWith( + ":" + sonarProject.getName())) { + sonarProject.setGroupId(StringUtils + .substringBefore( + resource.getKey(), + ":")); + sonarProject + .setArtifactId(sonarProject + .getName()); + } + } + } + String key = SonarKeyUtils.projectKey( myProject.getGroupId(), myProject.getArtifactId(), @@ -435,8 +441,8 @@ public class ConformanceAction implements IWorkbenchWindowActionDelegate { monitor.subTask(message); Sonar sonar2 = SonarCorePlugin - .getServersManager() - .getSonar(SONAR_SERVER_URL); + .getServersManager().getSonar( + SONAR_SERVER_URL); // TODO Godin: sonar.find throws NPE here List<Resource> resources2 = sonar2 .findAll(new ResourceQuery(key)); @@ -566,15 +572,6 @@ public class ConformanceAction implements IWorkbenchWindowActionDelegate { e.printStackTrace(); } - // IWorkbenchWindow dw = - // PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - // IWorkbenchPage page = dw.getActivePage(); - // try{ - // page.showView("WebView.ID"); - // }catch (Exception e){ - // e.printStackTrace(); - // } - } }; } @@ -582,7 +579,7 @@ public class ConformanceAction implements IWorkbenchWindowActionDelegate { /** * Sets up Maven embedder for execution. */ - protected void setUpMavenBuild() { + protected void setUpMaven() { try { container = new DefaultPlexusContainer(); maven = container.lookup(Maven.class); diff --git a/conformance/org.universaal.tools.conformancePlugin/src/org/universaal/tools/conformance/handlers/ConformanceHandler.java b/conformance/org.universaal.tools.conformancePlugin/src/org/universaal/tools/conformance/handlers/ConformanceHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..d00f4b20444fa4a3accac629000a49bd6d7edecb --- /dev/null +++ b/conformance/org.universaal.tools.conformancePlugin/src/org/universaal/tools/conformance/handlers/ConformanceHandler.java @@ -0,0 +1,18 @@ +package org.universaal.tools.conformance.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.universaal.tools.conformance.actions.ConformanceAction; + + +public class ConformanceHandler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + ConformanceAction conformanceAction=new ConformanceAction(); + conformanceAction.run(null); + return null; + } + +}