Example #1
0
  public String resourceUrl(ISonarResource resource) {
    String urlTemplate = resourcesUrlTemplate(resource);

    String serverUrl = properties(resource).getUrl();
    String key = resource.getKey();

    return String.format(urlTemplate, serverUrl, key);
  }
 @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);
 }
Example #3
0
 private SonarProject properties(ISonarResource resource) {
   return SonarProject.getInstance(resource.getProject());
 }
Example #4
0
 private String resourcesUrlTemplate(ISonarResource resource) {
   if (resource.getResource() instanceof IFile) {
     return "%s/resource/index/%s";
   }
   return "%s/project/index/%s";
 }