Skip to content

Commit 930f0cb

Browse files
authored
Merge pull request #276 from snyk/fix/IDE-1054_update-endpoint-description
feat: Update Endpoint Description in Settings
2 parents a0d1f42 + 9d1ec94 commit 930f0cb

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

plugin/src/main/java/io/snyk/eclipse/plugin/preferences/PreferencesPage.java

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
import org.eclipse.jface.preference.FieldEditorPreferencePage;
1010
import org.eclipse.jface.preference.FileFieldEditor;
1111
import org.eclipse.jface.preference.StringFieldEditor;
12+
import org.eclipse.swt.SWT;
13+
import org.eclipse.swt.program.Program;
1214
import org.eclipse.swt.widgets.Display;
15+
import org.eclipse.swt.widgets.Link;
1316
import org.eclipse.ui.IWorkbench;
1417
import org.eclipse.ui.IWorkbenchPreferencePage;
1518

@@ -37,8 +40,8 @@ protected void createFieldEditors() {
3740
setPreferenceStore(prefs.getInsecureStore());
3841

3942
// token field editor is configured to use a secure store
40-
TokenFieldEditor tokenField = new TokenFieldEditor(prefs, Preferences.AUTH_TOKEN_KEY,
41-
"Token:", getFieldEditorParent());
43+
TokenFieldEditor tokenField = new TokenFieldEditor(prefs, Preferences.AUTH_TOKEN_KEY, "Token:",
44+
getFieldEditorParent());
4245

4346
final var useTokenAuth = new BooleanFieldEditor(Preferences.USE_TOKEN_AUTH,
4447
"Use token authentication. It is recommended to keep this turned off, as the default OAuth2 authentication is more secure.",
@@ -47,6 +50,16 @@ protected void createFieldEditors() {
4750
addField(tokenField);
4851

4952
addField(new StringFieldEditor(Preferences.PATH_KEY, "Path:", 80, getFieldEditorParent()));
53+
addField(new LabelFieldEditor("If you're using SSO with Snyk and OAuth2, the custom endpoint configuration is automatically populated.\n"
54+
+ "Otherwise, for public regional instances, " + "see the docs: ", getFieldEditorParent()));
55+
Link link = new Link(this.getFieldEditorParent(), SWT.NONE);
56+
57+
link.setText("<a>https://docs.snyk.io/working-with-snyk</a>");
58+
link.addListener(SWT.Selection, event -> Program.launch(
59+
"https://docs.snyk.io/working-with-snyk/regional-hosting-and-data-residency#available-snyk-regions"));
60+
61+
addField(new LabelFieldEditor("For private instances, contact your team or account manager.\n",
62+
getFieldEditorParent()));
5063
addField(new StringFieldEditor(Preferences.ENDPOINT_KEY, "Custom Endpoint:", 80, getFieldEditorParent()));
5164
addField(new BooleanFieldEditor(Preferences.INSECURE_KEY, "Allow unknown certificate authorities",
5265
getFieldEditorParent()));
@@ -124,12 +137,12 @@ private FieldEditor space() {
124137
public boolean performOk() {
125138
boolean superOK = super.performOk();
126139
disableSnykCodeIfOrgDisabled();
127-
CompletableFuture.runAsync(() -> {
128-
SnykExtendedLanguageClient lc = SnykExtendedLanguageClient.getInstance();
140+
CompletableFuture.runAsync(() -> {
141+
SnykExtendedLanguageClient lc = SnykExtendedLanguageClient.getInstance();
129142

130143
lc.updateConfiguration();
131-
lc.refreshFeatureFlags();
132-
});
144+
lc.refreshFeatureFlags();
145+
});
133146
return superOK;
134147
}
135148

@@ -152,7 +165,7 @@ private void disableSnykCodeIfOrgDisabled() {
152165

153166
@Override
154167
public void run() {
155-
checkBoxValue = snykCodeSecurityCheckbox != null && snykCodeSecurityCheckbox.getBooleanValue();
168+
checkBoxValue = snykCodeSecurityCheckbox != null && snykCodeSecurityCheckbox.getBooleanValue();
156169
if (checkBoxValue && !enabled) {
157170
snykCodeSecurityCheckbox
158171
.setLabelText(snykCodeSecurityCheckbox.getLabelText() + " (" + message + ")");

0 commit comments

Comments
 (0)