Skip to content

Commit

Permalink
SLE-456 Fix visibility of notifications details text
Browse files Browse the repository at this point in the history
  • Loading branch information
jblievremont committed Nov 4, 2021
1 parent e044643 commit d38db1e
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.sonarlint.eclipse.core.SonarLintLogger;
Expand All @@ -44,7 +45,8 @@ public class NotificationsWizardPage extends WizardPage {

private final ServerConnectionModel model;
private Button notificationsEnabledCheckbox;
private Link notificationsDetails;
private Link notificationsLink;
private Text notificationsDetails;
private Composite container;

public NotificationsWizardPage(ServerConnectionModel model) {
Expand Down Expand Up @@ -77,9 +79,9 @@ public void createControl(Composite parent) {

WizardPageSupport.create(this, dataBindingContext);

notificationsDetails = new Link(container, SWT.WRAP);
notificationsDetails.setLayoutData(gd);
notificationsDetails.addSelectionListener(new SelectionAdapter() {
notificationsLink = new Link(container, SWT.NONE);
notificationsLink.setLayoutData(gd);
notificationsLink.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
try {
Expand All @@ -90,6 +92,9 @@ public void widgetSelected(SelectionEvent e) {
}
});

notificationsDetails = new Text(container, SWT.WRAP);
notificationsLink.setLayoutData(gd);

setControl(container);
}

Expand All @@ -99,13 +104,13 @@ public void setVisible(boolean visible) {
final var isSc = model.getConnectionType() == ConnectionType.SONARCLOUD;
final var sqOrSc = isSc ? "SonarCloud" : "SonarQube";
notificationsEnabledCheckbox.setText("Receive notifications from " + sqOrSc);
notificationsEnabledCheckbox.requestLayout();
final var docUrl = isSc ? "https://sonarcloud.io/documentation/user-guide/sonarlint-notifications/"
: "https://docs.sonarqube.org/latest/user-guide/sonarlint-notifications/";
notificationsDetails.setText("You will receive <a href=\"" + docUrl + "\">notifications</a> from " + sqOrSc + " in situations like:\n" +
notificationsLink.setText("You will receive <a href=\"" + docUrl + "\">notifications</a> from " + sqOrSc + " in situations like:");
notificationsDetails.setText(
" - the Quality Gate status of a bound project changes\n" +
" - the latest analysis of a bound project on " + sqOrSc + " raises new issues assigned to you");
notificationsDetails.requestLayout();
container.requestLayout();
}
super.setVisible(visible);
}
Expand Down

0 comments on commit d38db1e

Please sign in to comment.