final VirtualFile file = anActionEvent.getData(PlatformDataKeys.VIRTUAL_FILE);
if(file == null) {
return;
}
ResourceLookupWorker resourceLookupWorker = new ResourceLookupWorker(project, file, new ResourceLookupWorker.ResourceLoadCallback() {
@Override
public void resourceLoaded(@Nullable Resource resource) {
SonarModuleComponent sonarModuleComponent = SonarResourceKeyUtils.getSonarModuleComponent(project, file);
SonarModuleComponent.SonarModuleState state = sonarModuleComponent.getState();
String resourceId;
if (resource == null) {
resourceId = state.projectKey;
} else {
resourceId = Integer.toString(resource.getId());
}
new SonarNavigator().navigateToDashboard(sonarModuleComponent, resourceId);
}
});
resourceLookupWorker.execute();
}