|
17 | 17 | import io.snyk.eclipse.plugin.properties.preferences.Preferences; |
18 | 18 |
|
19 | 19 | public class SnykWizardAuthenticatePage extends WizardPage implements Listener { |
20 | | - private Text endpoint; |
21 | | - private Button unknownCerts; |
22 | | - private String trustMessage = "⚠️ When scanning folder files, Snyk may automatically execute code such as invoking the package manager to get dependency information. " |
23 | | - + "You should only scan projects you trust. <a href=\"https://docs.snyk.io/ide-tools/eclipse-plugin/folder-trust\">More Info</a>" |
24 | | - + "\n\nOn finishing the wizard, the plugin will open a browser to authenticate you, trust the current workspace projects and trigger a scan."; |
25 | | - |
26 | | - public SnykWizardAuthenticatePage() { |
27 | | - super("Snyk Wizard"); |
28 | | - setTitle("Authenticate"); |
29 | | - setDescription("Review the endpoint configuration, clicking 'Finish' will authenticate with Snyk; this will open a new browser window."); |
30 | | - } |
31 | | - |
32 | | - @Override |
33 | | - public void createControl(Composite parent) { |
| 20 | + private Text endpoint; |
| 21 | + private Button unknownCerts; |
| 22 | + private String trustMessage = "⚠️ When scanning folder files, Snyk may automatically execute code such as invoking the package manager to get dependency information. " |
| 23 | + + "You should only scan projects you trust. <a href=\"https://docs.snyk.io/ide-tools/eclipse-plugin/folder-trust\">More Info</a>" |
| 24 | + + "\n\nOn finishing the wizard, the plugin will open a browser to authenticate you, trust the current workspace projects and trigger a scan."; |
| 25 | + private Color blackColor; |
| 26 | + |
| 27 | + public SnykWizardAuthenticatePage() { |
| 28 | + super("Snyk Wizard"); |
| 29 | + setTitle("Authenticate"); |
| 30 | + setDescription( |
| 31 | + "Review the endpoint configuration, clicking 'Finish' will authenticate with Snyk; this will open a new browser window."); |
| 32 | + } |
| 33 | + |
| 34 | + @Override |
| 35 | + public void createControl(Composite parent) { |
34 | 36 | Composite composite = new Composite(parent, SWT.NONE); |
35 | 37 | GridData gd = new GridData(GridData.FILL_HORIZONTAL); |
36 | 38 |
|
@@ -58,24 +60,32 @@ public void createControl(Composite parent) { |
58 | 60 | trustText.setText(trustMessage); |
59 | 61 | gd = new GridData(GridData.FILL_BOTH); |
60 | 62 | trustText.setLayoutData(gd); |
61 | | - trustText.setBackground(new Color(0, 0, 0, 0)); |
| 63 | + this.blackColor = new Color(0, 0, 0, 0); |
| 64 | + trustText.setBackground(blackColor); |
62 | 65 | trustText.addListener(SWT.Selection, event -> org.eclipse.swt.program.Program.launch(event.text)); |
63 | 66 |
|
64 | 67 | // required to avoid an error in the system |
65 | 68 | setControl(composite); |
66 | 69 | setPageComplete(false); |
67 | | - } |
68 | | - |
69 | | - public void handleEvent(Event e) { |
70 | | - getWizard().getContainer().updateButtons(); |
71 | | - } |
72 | | - |
73 | | - public boolean isPageComplete() { |
74 | | - return true; |
75 | | - } |
76 | | - |
77 | | - void onEnterPage() { |
78 | | - endpoint.setText(Preferences.getInstance().getEndpoint()); |
79 | | - unknownCerts.setSelection(Preferences.getInstance().getBooleanPref(Preferences.INSECURE_KEY)); |
80 | | - } |
| 70 | + } |
| 71 | + |
| 72 | + @Override |
| 73 | + public void dispose() { |
| 74 | + this.blackColor.dispose(); |
| 75 | + this.blackColor = null; |
| 76 | + super.dispose(); |
| 77 | + } |
| 78 | + |
| 79 | + public void handleEvent(Event e) { |
| 80 | + getWizard().getContainer().updateButtons(); |
| 81 | + } |
| 82 | + |
| 83 | + public boolean isPageComplete() { |
| 84 | + return true; |
| 85 | + } |
| 86 | + |
| 87 | + void onEnterPage() { |
| 88 | + endpoint.setText(Preferences.getInstance().getEndpoint()); |
| 89 | + unknownCerts.setSelection(Preferences.getInstance().getBooleanPref(Preferences.INSECURE_KEY)); |
| 90 | + } |
81 | 91 | } |
0 commit comments