public void unsubscribe(SonarQubeNotificationListener listener) { SonarQubeNotifications.get().remove(listener); } }
private void unregister() { SonarQubeNotifications.get().remove(eventListener); }
public boolean subscribe(ISonarLintProject project, SonarLintProjectConfiguration config, SonarQubeNotificationListener listener) { Optional<IServer> server = SonarLintCorePlugin.getServersManager().forProject(project, config); if (!server.isPresent() || !server.get().areNotificationsEnabled()) { return false; } LastNotificationTime notificationTime = new ProjectNotificationTime(project); NotificationConfiguration configuration = new NotificationConfiguration(listener, notificationTime, config.getProjectBinding().get().serverId(), ((Server) server.get()).getConfig()); SonarQubeNotifications.get().register(configuration); return true; }
public static boolean checkNotificationsSupported(String url, @Nullable String organization, String username, String password) { Builder builder = Server.getConfigBuilderNoCredentials(url, organization); if (StringUtils.isNotBlank(username) || StringUtils.isNotBlank(password)) { builder.credentials(username, password); } return SonarQubeNotifications.get().isSupported(builder.build()); }
@Override public void run(@NotNull ProgressIndicator indicator) { indicator.setText("Connecting to " + server.getHostUrl() + "..."); indicator.setIndeterminate(false); try { ServerConfiguration serverConfiguration = SonarLintUtils.getServerConfiguration(server); indicator.setText("Checking support of notifications"); notificationsSupported = SonarQubeNotifications.get().isSupported(serverConfiguration); WsHelper wsHelper = new WsHelperImpl(); organizations = wsHelper.listUserOrganizations(serverConfiguration, new TaskProgressMonitor(indicator)); } catch (UnsupportedServerException e) { organizations = Collections.emptyList(); } catch (Exception e) { LOGGER.info("Failed to fetch information", e); exception = e; } }
private void register(SonarLintProjectSettings settings) { unregister(); if (settings.isBindingEnabled()) { SonarQubeServer server; try { server = bindingManager.getSonarQubeServer(); } catch (InvalidBindingException e) { // do nothing return; } if (server.enableNotifications()) { NotificationConfiguration config = createConfiguration(settings, server); SonarQubeNotifications.get().register(config); } } }