Skip to content

Commit 99c2cc4

Browse files
committed
fix: enable/disable delta and Update configuration
1 parent 80d778a commit 99c2cc4

2 files changed

Lines changed: 27 additions & 4 deletions

File tree

plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/SummaryBrowserHandler.java

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
package io.snyk.eclipse.plugin.views.snyktoolview;
22

3+
import java.util.concurrent.CompletableFuture;
4+
35
import org.eclipse.swt.browser.Browser;
46
import org.eclipse.swt.browser.BrowserFunction;
57

68
import io.snyk.eclipse.plugin.html.StaticPageHtmlProvider;
9+
import io.snyk.eclipse.plugin.preferences.Preferences;
10+
import io.snyk.languageserver.protocolextension.SnykExtendedLanguageClient;
711

812
public 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) {

plugin/src/main/java/io/snyk/languageserver/protocolextension/SnykExtendedLanguageClient.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@
7676
import io.snyk.eclipse.plugin.views.snyktoolview.IssueTreeNode;
7777
import io.snyk.eclipse.plugin.views.snyktoolview.ProductTreeNode;
7878
import io.snyk.eclipse.plugin.views.snyktoolview.SnykToolView;
79-
import io.snyk.eclipse.plugin.views.snyktoolview.handlers.IHandlerCommands;
8079
import io.snyk.eclipse.plugin.wizards.SnykWizard;
8180
import io.snyk.languageserver.CommandHandler;
8281
import io.snyk.languageserver.FeatureFlagConstants;

0 commit comments

Comments
 (0)