Example #1
0
 private static void cleanWorkspace() throws Exception {
   final List<ISonarServer> hosts = new ArrayList<ISonarServer>();
   hosts.addAll(SonarCorePlugin.getServersManager().getServers());
   for (final ISonarServer host : hosts) {
     SonarCorePlugin.getServersManager().removeServer(host.getUrl());
   }
   final IWorkspaceRoot root = workspace.getRoot();
   for (final IProject project : root.getProjects()) {
     project.delete(true, true, MONITOR);
   }
 }
 @Override
 protected void open(ISonarResource sonarResource) {
   SonarProject sonarProject = SonarProject.getInstance(sonarResource.getProject());
   String url = new SonarUrls().resourceUrl(sonarResource);
   ISonarServer sonarServer =
       SonarCorePlugin.getServersManager().findServer(sonarProject.getUrl());
   if (sonarServer == null) {
     showMessage(
         NLS.bind(
             Messages.No_matching_server_in_configuration_for_project,
             sonarProject.getProject().getName(),
             url));
     return;
   }
   if (sonarServer.disabled()) {
     showMessage("Server is disabled.");
     return;
   }
   if (!WSClientFactory.getSonarClient(sonarServer).exists(sonarResource.getKey())) {
     showMessage("Not found.");
     return;
   }
   super.open(sonarProject, url);
 }