1919import io .snyk .languageserver .protocolextension .SnykExtendedLanguageClient ;
2020
2121public class PreferencesPage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
22- private BooleanFieldEditor snykCodeSecurityCheckbox ;
22+ private BooleanFieldEditor snykCodeSecurityCheckbox , snykCodeQualityCheckbox ;
2323
2424 public PreferencesPage () {
2525 super (GRID );
@@ -34,69 +34,81 @@ public void init(IWorkbench workbench) {
3434 @ Override
3535 protected void createFieldEditors () {
3636 TokenFieldEditor tokenField = new TokenFieldEditor (Preferences .getInstance (), Preferences .AUTH_TOKEN_KEY ,
37- "Token:" , getFieldEditorParent ());
37+ "Token:" , getFieldEditorParent ());
3838
39- addField (new BooleanFieldEditor (Preferences .USE_TOKEN_AUTH , "Use token authentication. It is recommended to keep this turned off, as the default OAuth2 authentication is more secure." ,
39+ addField (new BooleanFieldEditor (Preferences .USE_TOKEN_AUTH ,
40+ "Use token authentication. It is recommended to keep this turned off, as the default OAuth2 authentication is more secure." ,
4041 getFieldEditorParent ()));
4142
4243 addField (tokenField );
4344 addField (new StringFieldEditor (Preferences .PATH_KEY , "Path:" , 80 , getFieldEditorParent ()));
4445 addField (new StringFieldEditor (Preferences .ENDPOINT_KEY , "Custom Endpoint:" , 80 , getFieldEditorParent ()));
45- addField (new BooleanFieldEditor (Preferences .INSECURE_KEY , "Allow unknown certificate authorities" ,
46- getFieldEditorParent ()));
46+ addField (new BooleanFieldEditor (Preferences .INSECURE_KEY , "Allow unknown certificate authorities" ,
47+ getFieldEditorParent ()));
4748
4849 addField (space ());
49- addField (new LabelFieldEditor ("The following options involve the Snyk Language Server." , getFieldEditorParent ()));
50+ addField (new LabelFieldEditor ("The following options involve the Snyk Language Server." ,
51+ getFieldEditorParent ()));
5052 addField (new LabelFieldEditor (
51- "Activating Snyk Code will cause upload of source code to Snyk or the given endpoint address." ,
52- getFieldEditorParent ()));
53+ "Activating Snyk Code will cause upload of source code to Snyk or the given endpoint address." ,
54+ getFieldEditorParent ()));
5355 addField (space ());
5456 addField (new BooleanFieldEditor (Preferences .ACTIVATE_SNYK_OPEN_SOURCE , "Snyk Open Source enabled" ,
55- getFieldEditorParent ()));
56- snykCodeSecurityCheckbox = new BooleanFieldEditor (Preferences .ACTIVATE_SNYK_CODE , "Snyk Code enabled" ,
57- getFieldEditorParent ());
58-
57+ getFieldEditorParent ()));
58+ snykCodeSecurityCheckbox = new BooleanFieldEditor (Preferences .ACTIVATE_SNYK_CODE_SECURITY , "Snyk Code Security enabled" ,
59+ getFieldEditorParent ());
5960 addField (snykCodeSecurityCheckbox );
61+ snykCodeQualityCheckbox = new BooleanFieldEditor (Preferences .ACTIVATE_SNYK_CODE_QUALITY , "Snyk Code Quality enabled" ,
62+ getFieldEditorParent ());
63+ addField (snykCodeQualityCheckbox );
6064
6165 addField (new BooleanFieldEditor (Preferences .ACTIVATE_SNYK_IAC , "Snyk Infrastructure-as-Code enabled" ,
62- getFieldEditorParent ()));
66+ getFieldEditorParent ()));
6367
6468 addField (space ());
65- addField (new BooleanFieldEditor (Preferences .SCANNING_MODE_AUTOMATIC , "Scan automatically on start-up and save" , getFieldEditorParent ()));
69+ addField (new BooleanFieldEditor (Preferences .SCANNING_MODE_AUTOMATIC , "Scan automatically on start-up and save" ,
70+ getFieldEditorParent ()));
6671 addField (space ());
6772 addField (new LabelFieldEditor ("Advanced options:" , getFieldEditorParent ()));
6873 addField (new StringFieldEditor (Preferences .ORGANIZATION_KEY , "Organization:" , 80 , getFieldEditorParent ()));
6974 addField (
70- new StringFieldEditor (Preferences .ADDITIONAL_PARAMETERS , "Additional Parameters:" , 80 , getFieldEditorParent ()));
75+ new StringFieldEditor (Preferences .ADDITIONAL_PARAMETERS , "Additional Parameters:" , 80 ,
76+ getFieldEditorParent ()));
7177 addField (
72- new StringFieldEditor (Preferences .ADDITIONAL_ENVIRONMENT , "Additional Environment:" , 80 , getFieldEditorParent ()));
78+ new StringFieldEditor (Preferences .ADDITIONAL_ENVIRONMENT , "Additional Environment:" , 80 ,
79+ getFieldEditorParent ()));
7380
7481 addField (space ());
7582 BooleanFieldEditor manageBinaries = new BooleanFieldEditor (Preferences .MANAGE_BINARIES_AUTOMATICALLY ,
76- "Update and install Snyk binaries automatically" , getFieldEditorParent ());
83+ "Update and install Snyk binaries automatically" , getFieldEditorParent ());
7784 manageBinaries .setPropertyChangeListener ((PropertyChangeEvent propertyChangeEvent ) -> {
7885 System .out .println ("managed bionaries changed" );
7986 });
8087 addField (manageBinaries );
81- addField (new StringFieldEditor (Preferences .CLI_BASE_URL , "Base URL for CLI download:" , 80 , getFieldEditorParent ()));
82- addField (new FileFieldEditor (Preferences .CLI_PATH , "Snyk CLI (incl. Language Server):" , getFieldEditorParent ()));
88+ addField (new StringFieldEditor (Preferences .CLI_BASE_URL , "Base URL for CLI download:" , 80 ,
89+ getFieldEditorParent ()));
90+ addField (
91+ new FileFieldEditor (Preferences .CLI_PATH , "Snyk CLI (incl. Language Server):" , getFieldEditorParent ()));
8392
8493 addField (space ());
8594
8695 addField (
87- new BooleanFieldEditor (Preferences .SEND_ERROR_REPORTS , "Send error reports to Snyk" , getFieldEditorParent ()));
96+ new BooleanFieldEditor (Preferences .SEND_ERROR_REPORTS , "Send error reports to Snyk" ,
97+ getFieldEditorParent ()));
8898 addField (
89- new BooleanFieldEditor (Preferences .ENABLE_TELEMETRY , "Send usage statistics to Snyk" , getFieldEditorParent ()));
99+ new BooleanFieldEditor (Preferences .ENABLE_TELEMETRY , "Send usage statistics to Snyk" ,
100+ getFieldEditorParent ()));
90101
91102 addField (space ());
92103
93104 addField (new LabelFieldEditor (
94- "Only trusted paths are scanned by Snyk. The Trusted Folders setting allows to specify, which \n "
95- + "paths are safe to scan. Every path below a given path is considered safe to scan. \n "
96- + "Please separate entries with \" " + File .pathSeparator + "\" ." ,
97- getFieldEditorParent ()));
98- StringFieldEditor trustedFoldersEditor = new StringFieldEditor (Preferences .TRUSTED_FOLDERS , "Trusted Folders:" , 80 , getFieldEditorParent ());
99- addField (trustedFoldersEditor );
105+ "Only trusted paths are scanned by Snyk. The Trusted Folders setting allows to specify, which \n "
106+ + "paths are safe to scan. Every path below a given path is considered safe to scan. \n "
107+ + "Please separate entries with \" " + File .pathSeparator + "\" ." ,
108+ getFieldEditorParent ()));
109+ StringFieldEditor trustedFoldersEditor = new StringFieldEditor (Preferences .TRUSTED_FOLDERS , "Trusted Folders:" ,
110+ 80 , getFieldEditorParent ());
111+ addField (trustedFoldersEditor );
100112 disableSnykCodeIfOrgDisabled ();
101113 }
102114
@@ -131,13 +143,14 @@ public void run() {
131143 boolean showMessage = false ;
132144 boolean checkBoxValue ;
133145 try {
134- checkBoxValue = snykCodeSecurityCheckbox != null && snykCodeSecurityCheckbox .getBooleanValue ();
146+ checkBoxValue = snykCodeSecurityCheckbox != null && snykCodeSecurityCheckbox .getBooleanValue ();
135147 } catch (NullPointerException e ) {
136- // this can happen, if the UI checkbox is not initialized fully, we return then
137- return ;
148+ // this can happen, if the UI checkbox is not initialized fully, we return then
149+ return ;
138150 }
139151 if (checkBoxValue && !isSastEnabled ) {
140- snykCodeSecurityCheckbox .setLabelText (snykCodeSecurityCheckbox .getLabelText () + " (" + message + ")" );
152+ snykCodeSecurityCheckbox
153+ .setLabelText (snykCodeSecurityCheckbox .getLabelText () + " (" + message + ")" );
141154 showMessage = true ;
142155 }
143156
0 commit comments