99import org .eclipse .jface .preference .FieldEditorPreferencePage ;
1010import org .eclipse .jface .preference .FileFieldEditor ;
1111import org .eclipse .jface .preference .StringFieldEditor ;
12+ import org .eclipse .swt .SWT ;
13+ import org .eclipse .swt .program .Program ;
1214import org .eclipse .swt .widgets .Display ;
15+ import org .eclipse .swt .widgets .Link ;
1316import org .eclipse .ui .IWorkbench ;
1417import 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