11package io .snyk .eclipse .plugin .views .snyktoolview ;
22
3+ import java .util .concurrent .CompletableFuture ;
4+
35import org .eclipse .swt .browser .Browser ;
46import org .eclipse .swt .browser .BrowserFunction ;
57
68import io .snyk .eclipse .plugin .html .StaticPageHtmlProvider ;
9+ import io .snyk .eclipse .plugin .preferences .Preferences ;
10+ import io .snyk .languageserver .protocolextension .SnykExtendedLanguageClient ;
711
812public class SummaryBrowserHandler {
913 private Browser browser ;
@@ -17,26 +21,46 @@ public void initialize() {
1721 new BrowserFunction (browser , "showAllIssuesTab" ) {
1822 @ Override
1923 public Object function (Object [] arguments ) {
20- // TODO show all scan results
24+ Preferences .getInstance ().store (Preferences .ENABLE_DELTA , Boolean .FALSE .toString ());
25+ updateConfiguration ();
26+
27+ // TODO remove this when we get the HTML from Snyk Language Server
2128 browser .execute ("document.body.innerHTML += '<p>All issues tab clicked</p>';" );
29+
2230 return null ;
2331 }
2432 };
2533
2634 new BrowserFunction (browser , "showDeltaIssuesTab" ) {
2735 @ Override
2836 public Object function (Object [] arguments ) {
29- // TODO launch delta scan or show delta scan results
37+ Preferences .getInstance ().store (Preferences .ENABLE_DELTA , Boolean .TRUE .toString ());
38+ updateConfiguration ();
39+
40+ // TODO remove this when we get the HTML from Snyk Language Server
3041 browser .execute ("document.body.innerHTML += '<p>Delta issues tab clicked</p>';" );
42+
3143 return null ;
3244 }
45+
3346 };
3447
3548 setDefaultBrowserText ();
3649 }
3750
51+ private void updateConfiguration () {
52+ CompletableFuture .runAsync (() -> {
53+ // Update the Snyk Language Server configuration.
54+ final var lc = SnykExtendedLanguageClient .getInstance ();
55+ lc .updateConfiguration ();
56+
57+ // TODO do we want to start scan here?
58+ lc .triggerScan (null );
59+ });
60+ }
61+
3862 public void setDefaultBrowserText () {
39- browser .setText (StaticPageHtmlProvider .getInstance ().getSummaryInitHtml ());
63+ browser .setText (StaticPageHtmlProvider .getInstance ().getSummaryInitHtml2 ());
4064 }
4165
4266 public void setBrowserText (String summary ) {
0 commit comments