Skip to content

Commit 5279418

Browse files
committed
Squashed commit of the following:
commit ba6787a Author: Bastian Doetsch <bastian.doetsch@snyk.io> Date: Thu Dec 5 09:50:25 2024 +0100 feat: add ToS and privacy, remove old legacy view [IDE-810] [IDE-713] (#237) * feat: add ToS and privacy, remove old legacy view * chore: remove legacy view from plugin.xml * chore: update theme id for background colors Merge branch 'main' into feat/IDE-739_branch_selection_node
2 parents 34394a3 + ba6787a commit 5279418

4 files changed

Lines changed: 8 additions & 13 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
import io.snyk.languageserver.protocolextension.SnykExtendedLanguageClient;
2222

2323
public class BaseBranchDialog {
24-
private FolderConfigs preferenceState = FolderConfigs.getInstance();
24+
private FolderConfigs folderConfigs = FolderConfigs.getInstance();
2525

2626
public BaseBranchDialog() {
2727
}
2828

29-
public void baseBranchDialog(Display display, Path projectPath, String[] localBranches) {
29+
public void open(Display display, Path projectPath, String[] localBranches) {
3030
Shell shell = new Shell(display, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
3131
shell.setText("Choose base branch for net-new issues scanning");
3232
shell.setLayout(new GridLayout(1, false));
@@ -37,7 +37,7 @@ public void baseBranchDialog(Display display, Path projectPath, String[] localBr
3737
Combo dropdown = new Combo(shell, SWT.DROP_DOWN);
3838
dropdown.setItems(localBranches);
3939
dropdown.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
40-
dropdown.setText(preferenceState.getBaseBranch(projectPath));
40+
dropdown.setText(folderConfigs.getBaseBranch(projectPath));
4141

4242
Button okButton = new Button(shell, SWT.PUSH);
4343
okButton.setText("OK");
@@ -48,7 +48,7 @@ public void widgetSelected(SelectionEvent e) {
4848
// Handle OK button press
4949
String selectedBranch = dropdown.getText();
5050
if (Arrays.asList(localBranches).contains(selectedBranch)) {
51-
preferenceState.setBaseBranch(projectPath, selectedBranch);
51+
folderConfigs.setBaseBranch(projectPath, selectedBranch);
5252
shell.close();
5353
CompletableFuture.runAsync(() -> {
5454
SnykExtendedLanguageClient.getInstance().triggerScan(projectPath);

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,13 @@ public void selectionChanged(SelectionChangedEvent event) {
9898
LSPEclipseUtils.open(fileNode.getPath().toUri().toASCIIString(),
9999
issueTreeNode.getIssue().getLSP4JRange());
100100
}
101-
boolean deltaEnabled = Preferences.getInstance()
102-
.getBooleanPref(Preferences.FILTER_DELTA_NEW_ISSUES);
101+
boolean deltaEnabled = Preferences.isDeltaEnabled();
103102
if (node instanceof ContentRootNode && deltaEnabled) {
104103
ContentRootNode contentNode = (ContentRootNode) node;
105104
String[] localBranches = folderConfigs.getLocalBranches(contentNode.getPath())
106105
.toArray(new String[0]);
107106

108-
new BaseBranchDialog().baseBranchDialog(Display.getDefault(), contentNode.getPath(),
107+
new BaseBranchDialog().open(Display.getDefault(), contentNode.getPath(),
109108
localBranches);
110109
}
111110
});

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ public SnykExtendedLanguageClient() {
118118
registerRefreshFeatureFlagsTask();
119119
}
120120

121-
122121
public static SnykExtendedLanguageClient getInstance() {
123122
return instance; // we leave instantiation to LSP4e, no lazy construction here
124123
}
@@ -134,7 +133,6 @@ public LanguageServer getConnectedLanguageServer() {
134133
public CompletableFuture<List<WorkspaceFolder>> workspaceFolders() {
135134
return CompletableFuture.completedFuture(ResourceUtils.getAccessibleTopLevelProjects().stream()
136135
.map(LSPEclipseUtils::toWorkspaceFolder).toList());
137-
138136
}
139137

140138
private void registerRefreshFeatureFlagsTask() {
@@ -195,7 +193,7 @@ public void triggerScan(Path projectPath) {
195193
}
196194

197195
executeCommand(LsConstants.COMMAND_WORKSPACE_SCAN, new ArrayList<>());
198-
196+
199197
} catch (Exception e) {
200198
SnykLogger.logError(e);
201199
}
@@ -708,7 +706,7 @@ public CompletableFuture<List<LsSdk>> getSdks(WorkspaceFolder workspaceFolder) {
708706
return sdks;
709707
});
710708
}
711-
709+
712710
public ProgressManager getProgressManager() {
713711
return this.progressManager;
714712
}

tests/src/test/java/io/snyk/languageserver/LsConfigurationUpdaterTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ void testGetSettings() {
7777
assertEquals("false", settings.getActivateSnykCodeQuality());
7878
assertEquals("/usr/local/bin/snyk", settings.getCliPath());
7979
assertEquals("my-token", settings.getToken());
80-
assertArrayEquals(new String[] { "path1", "path2" }, settings.getTrustedFolders());
8180
assertEquals("automatic", settings.getScanningMode());
8281
assertEquals("token", settings.getAuthenticationMethod());
8382
assertEquals(LsBinaries.REQUIRED_LS_PROTOCOL_VERSION, settings.getRequiredProtocolVersion());
@@ -114,7 +113,6 @@ private void setupPreferenceMock() {
114113
.thenReturn("false");
115114
when(preferenceMock.getPref(Preferences.CLI_PATH, "")).thenReturn("/usr/local/bin/snyk");
116115
when(preferenceMock.getPref(Preferences.AUTH_TOKEN_KEY, "")).thenReturn("my-token");
117-
when(preferenceMock.getPref(Preferences.TRUSTED_FOLDERS)).thenReturn("path1:path2");
118116
when(preferenceMock.getBooleanPref(Preferences.SCANNING_MODE_AUTOMATIC)).thenReturn(true);
119117
when(preferenceMock.getBooleanPref(Preferences.USE_TOKEN_AUTH, false)).thenReturn(true);
120118
when(preferenceMock.getPref(Preferences.FILTER_DELTA_NEW_ISSUES, Boolean.FALSE.toString())).thenReturn("true");

0 commit comments

Comments
 (0)