diff --git a/plugin/OSGI-INF/l10n/bundle.properties b/plugin/OSGI-INF/l10n/bundle.properties index 89d64d5a..70baa4be 100644 --- a/plugin/OSGI-INF/l10n/bundle.properties +++ b/plugin/OSGI-INF/l10n/bundle.properties @@ -6,11 +6,50 @@ category.name=Snyk view.name=Snyk Results toolView.name=Snyk page.name=Snyk + command.name=Run command.label=Snyk Test command.label.0=Snyk Test Project +command.stopScan=Stop Scan +command.clearCache=Clear Cache +command.openSnykPreferences=Open Snyk Preferences +command.criticalSeverity=Critical Severity +command.highSeverity=High Severity +command.mediumSeverity=Medium Severity +command.lowSeverity=Low Severity +command.openSource=Open Source +command.codeSecurity=Code Security +command.codeQuality=Code Quality +command.infrastructureAsCode=Infrastructure as Code +command.collapseTree=Collapse Tree +command.expandTree=Expand Tree +command.allIssues=All Issues +command.netNewIssues=Net New Issues +command.openIssues=Open Issues +command.ignoredIssues=Ignored Issues + +tooltip.scan=Scan +tooltip.stopScan=Stop Scan +tooltip.collapseAll=Collapse all tree nodes +tooltip.expandAll=Expand all tree nodes +tooltip.emptyScanResults=Empty Scan Results Cache +tooltip.criticalSeverity=Critical Severity +tooltip.highSeverity=High Severity +tooltip.mediumSeverity=Medium Severity +tooltip.lowSeverity=Low Severity +tooltip.openPreferences=Open Snyk Preferences +tooltip.enableOSS=Enable/disable OSS scans +tooltip.enableCodeSecurity=Enable/disable Code scans +tooltip.enableCodeQuality=Enable/disable Code scans +tooltip.enableIAC=Enable/disable IAC scans +tooltip.hideIgnored=Hide Ignored +tooltip.showIgnored=Show Ignored +tooltip.showAllIssues=Show All Issues +tooltip.showNetNewIssues=Show Only Net New Issues scanWorkspace.name=snykWorkspaceScan scanWorkspace.label=Snyk Test Workspace snyk.trust.dialog.warning.text=When scanning project files for vulnerabilities, Snyk may automatically execute code such as invoking the package manager to get dependency information.

You should only scan projects you trust.

+ + diff --git a/plugin/plugin.xml b/plugin/plugin.xml index c76da4d0..54b3fa9a 100644 --- a/plugin/plugin.xml +++ b/plugin/plugin.xml @@ -65,90 +65,90 @@ name="%scanWorkspace.name"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + defaultHandler="io.snyk.eclipse.plugin.views.snyktoolview.handlers.StopScanHandler" + id="io.snyk.eclipse.plugin.commands.snykStopScan" + name="%command.stopScan"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + locationURI="toolbar:io.snyk.eclipse.plugin.views.snyktoolview"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -494,14 +482,4 @@ name="SnykWizard"> - - - - - - diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/utils/SnykIcons.java b/plugin/src/main/java/io/snyk/eclipse/plugin/utils/SnykIcons.java new file mode 100644 index 00000000..d61018fb --- /dev/null +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/utils/SnykIcons.java @@ -0,0 +1,24 @@ +package io.snyk.eclipse.plugin.utils; + +import org.eclipse.jface.resource.ImageDescriptor; + +import io.snyk.eclipse.plugin.Activator; + +public class SnykIcons { + public static final ImageDescriptor CODE = Activator.getImageDescriptor("/icons/code.png"); + public static final ImageDescriptor CODE_DISABLED = Activator.getImageDescriptor("/icons/code_disabled.png"); + + public static final ImageDescriptor OSS = Activator.getImageDescriptor("/icons/oss.png"); + public static final ImageDescriptor OSS_DISABLED = Activator.getImageDescriptor("/icons/oss_disabled.png"); + + public static final ImageDescriptor IAC = Activator.getImageDescriptor("/icons/iac.png"); + public static final ImageDescriptor IAC_DISABLED = Activator.getImageDescriptor("/icons/iac_disabled.png"); + + public static final ImageDescriptor SEVERITY_CRITICAL = Activator + .getImageDescriptor("/icons/severity-critical.png"); + public static final ImageDescriptor SEVERITY_HIGH = Activator.getImageDescriptor("/icons/severity-high.png"); + public static final ImageDescriptor SEVERITY_MEDIUM = Activator.getImageDescriptor("/icons/severity-medium.png"); + public static final ImageDescriptor SEVERITY_LOW = Activator.getImageDescriptor("/icons/severity-low.png"); + + public static final ImageDescriptor ENABLED = Activator.getImageDescriptor("/icons/enabled.png"); +} diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/BaseTreeNode.java b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/BaseTreeNode.java index 2ca7f8e1..396bcd5c 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/BaseTreeNode.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/BaseTreeNode.java @@ -50,11 +50,11 @@ public ImageDescriptor getImageDescriptor() { public String getText() { return this.text; } - + public void setText(String text) { this.text = text; } - + @Override public String toString() { return this.value.toString(); diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/ISnykToolView.java b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/ISnykToolView.java index a25c6d6e..257aa5db 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/ISnykToolView.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/ISnykToolView.java @@ -1,6 +1,7 @@ package io.snyk.eclipse.plugin.views.snyktoolview; import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.TreeViewer; /** * This interface captures the externally used methods with the tool window. @@ -12,7 +13,7 @@ public interface ISnykToolView { String NO_FIXABLE_ISSUES = "There are no issues automatically fixable."; String IGNORED_ISSUES_FILTERED_BUT_AVAILABLE = "Adjust your Issue View Options to see ignored issues."; String OPEN_ISSUES_FILTERED_BUT_AVAILABLE = "Adjust your Issue View Options to open issues."; - + String NODE_TEXT_SCANNING = "Scanning..."; String NODE_TEXT_NO_ISSUES_FOUND = "No issues found"; String NODE_TEXT_EROR = "An error occurred"; @@ -63,18 +64,17 @@ public interface ISnykToolView { * @return */ abstract BaseTreeNode getProductNode(String product); - + /** * Resets a product node */ abstract void resetNode(BaseTreeNode node); - /** * Refreshes the tree display */ abstract void refreshTree(); - + /** * Returns the tree root * @@ -82,8 +82,17 @@ public interface ISnykToolView { */ abstract BaseTreeNode getRoot(); + /** + * Clears all nodes in the tree + * + * @return + */ + abstract void clearTree(); + static String getPlural(long count) { return count > 1 ? "s" : ""; } - + + abstract TreeViewer getTreeViewer(); + } diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/ProductTreeNode.java b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/ProductTreeNode.java index 3c2ba510..7a01a66d 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/ProductTreeNode.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/ProductTreeNode.java @@ -1,54 +1,46 @@ package io.snyk.eclipse.plugin.views.snyktoolview; -import org.eclipse.jface.resource.ImageDescriptor; - -import io.snyk.eclipse.plugin.Activator; import io.snyk.eclipse.plugin.domain.ProductConstants; +import io.snyk.eclipse.plugin.utils.SnykIcons; + +public class ProductTreeNode extends BaseTreeNode { -public class ProductTreeNode extends BaseTreeNode { - public static final ImageDescriptor OSS = Activator.getImageDescriptor("/icons/oss.png"); - public static final ImageDescriptor CODE = Activator.getImageDescriptor("/icons/code.png"); - public static final ImageDescriptor IAC = Activator.getImageDescriptor("/icons/iac.png"); - private String product; public ProductTreeNode(Object value) { super(value); this.setProduct(value.toString()); - + switch (value.toString()) { case ProductConstants.DISPLAYED_OSS: - setImageDescriptor(OSS); + setImageDescriptor(SnykIcons.OSS); break; case ProductConstants.DISPLAYED_IAC: - setImageDescriptor(IAC); + setImageDescriptor(SnykIcons.IAC); break; case ProductConstants.DISPLAYED_CODE_QUALITY: - setImageDescriptor(CODE); + setImageDescriptor(SnykIcons.CODE); break; case ProductConstants.DISPLAYED_CODE_SECURITY: - setImageDescriptor(CODE); + setImageDescriptor(SnykIcons.CODE); break; } } - - @Override public void setText(String text) { this.setValue(text); } - - @Override public void setValue(Object value) { - if (!(value instanceof String)) throw new IllegalArgumentException("value of product node must be a string"); + if (!(value instanceof String)) + throw new IllegalArgumentException("value of product node must be a string"); var cleanedValue = removePrefix(value.toString()); - + // we don't want to override the product text if (!cleanedValue.isBlank()) { - cleanedValue = product + " - " + cleanedValue; + cleanedValue = product + " - " + cleanedValue; } else { cleanedValue = product; } @@ -68,14 +60,10 @@ public void reset() { this.setValue(product); } - - public String getProduct() { return product; } - - public void setProduct(String product) { this.product = product; } diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/RootNode.java b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/RootNode.java index efcba8aa..03b63743 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/RootNode.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/RootNode.java @@ -19,7 +19,8 @@ public RootNode() { codeQualityRootNode = new ProductTreeNode(DISPLAYED_CODE_QUALITY); iacRootNode = new ProductTreeNode(DISPLAYED_IAC); - BaseTreeNode[] children = new BaseTreeNode[] { ossRootNode, codeSecurityRootNode, codeQualityRootNode, iacRootNode, }; + BaseTreeNode[] children = new BaseTreeNode[] { ossRootNode, codeSecurityRootNode, codeQualityRootNode, + iacRootNode, }; setChildren(children); } } diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/SnykToolView.java b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/SnykToolView.java index ffa95122..b65bf713 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/SnykToolView.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/SnykToolView.java @@ -6,7 +6,6 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.preference.PreferenceDialog; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredSelection; @@ -25,7 +24,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Tree; import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.dialogs.PreferencesUtil; import org.eclipse.ui.part.ViewPart; import org.osgi.framework.Bundle; @@ -96,8 +94,6 @@ public void selectionChanged(SelectionChangedEvent event) { } } }); - - makeActions(); } private void registerTreeContextMeny(Composite parent) { @@ -142,27 +138,6 @@ private void initBrowserText() { + "

\n" + snykWarningText + "\n" + ""); } - private void makeActions() { - openPrefPage = new Action() { - - @Override - public void run() { - PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(getShell(), - "io.snyk.eclipse.plugin.properties.preferencespage", null, null); - if (pref != null) - pref.open(); - } - }; - openPrefPage.setText("Preferences"); - } - - private static Shell getShell() { - var activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if (activeWorkbenchWindow == null) - return SHELL; - return activeWorkbenchWindow.getShell(); - } - @Override public void setFocus() { treeViewer.getControl().setFocus(); @@ -172,26 +147,26 @@ public void setFocus() { public void setNodeText(BaseTreeNode node, String text) { node.setText(text); Display.getDefault().asyncExec(() -> { - this.treeViewer.refresh(node, true); + this.treeViewer.refresh(node, true); }); } @Override public void setNodeIcon(ImageDescriptor icon) { // TODO Auto-generated method stub - + } @Override public void addIssueNode(BaseTreeNode parent, BaseTreeNode toBeAdded) { // TODO Auto-generated method stub - + } @Override public void addFileNode(BaseTreeNode parent, BaseTreeNode toBeAdded) { // TODO Auto-generated method stub - + } @Override @@ -199,7 +174,7 @@ public void addInfoNode(BaseTreeNode parent, BaseTreeNode toBeAdded) { toBeAdded.setParent(parent); parent.addChild(toBeAdded); Display.getDefault().asyncExec(() -> { - this.treeViewer.refresh(parent, true); + this.treeViewer.refresh(parent, true); }); } @@ -226,7 +201,7 @@ public BaseTreeNode getRoot() { @Override public void refreshTree() { Display.getDefault().asyncExec(() -> { - this.treeViewer.refresh(true); + this.treeViewer.refresh(true); }); } @@ -234,7 +209,30 @@ public void refreshTree() { public void resetNode(BaseTreeNode node) { node.reset(); Display.getDefault().asyncExec(() -> { - this.treeViewer.refresh(node, true); + this.treeViewer.refresh(node, true); }); } + + public void clearTree() { + clearRoot(); + Display.getDefault().asyncExec(() -> { + if (this.treeViewer != null && !this.treeViewer.getTree().isDisposed()) { + this.treeViewer.refresh(); + this.treeViewer.expandAll(); // Optional: if you want to expand all nodes after clearing + } + }); + } + + private void clearRoot() { + if (this.rootObject != null) { + this.rootObject.removeChildren(); + this.rootObject.reset(); + } + } + + @Override + public TreeViewer getTreeViewer() { + return this.treeViewer; + } + } \ No newline at end of file diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/BaseHandler.java b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/BaseHandler.java index 4606eb82..bc384516 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/BaseHandler.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/BaseHandler.java @@ -15,7 +15,6 @@ public class BaseHandler extends AbstractHandler implements IElementUpdater { - // TODO should we replace the filter button with a filter applied button icon? protected ImageDescriptor iconEnabled = null; protected ImageDescriptor iconDisabled = null; protected String preferenceKey = null; @@ -29,25 +28,16 @@ public Object execute(ExecutionEvent event) throws ExecutionException { commandService.refreshElements(commandId, null); } + Preferences.getInstance().store(preferenceKey, + Boolean.valueOf(!Preferences.getInstance().getBooleanPref(preferenceKey)).toString()); return null; } @Override public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map map) { - - String preference = Preferences.getInstance().getPref(preferenceKey); - boolean bool = Boolean.parseBoolean(preference); - - // Toggle the value, if it was true, it should be set to false - if (bool) { - element.setIcon(iconDisabled); - Preferences.getInstance().store(preferenceKey, "false"); - - } else { - element.setIcon(iconEnabled); - Preferences.getInstance().store(preferenceKey, "true"); - - } - + boolean enabled = Preferences.getInstance().getBooleanPref(preferenceKey); + ImageDescriptor icon = enabled ? iconEnabled : iconDisabled; + element.setIcon(icon); } + } \ No newline at end of file diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/ClearCacheHandler.java b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/ClearCacheHandler.java index 4d1dd2ab..78685789 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/ClearCacheHandler.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/ClearCacheHandler.java @@ -3,13 +3,20 @@ import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; -import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; -import io.snyk.eclipse.plugin.utils.SnykMessageDialog; +import io.snyk.eclipse.plugin.utils.SnykLogger; +import io.snyk.eclipse.plugin.views.snyktoolview.ISnykToolView; +import io.snyk.eclipse.plugin.views.snyktoolview.SnykToolView; +import io.snyk.languageserver.ScanState; +import io.snyk.languageserver.SnykIssueCache; public class ClearCacheHandler extends AbstractHandler { + private ISnykToolView toolView; + public ClearCacheHandler() { super(); @@ -17,10 +24,18 @@ public ClearCacheHandler() { @Override public Object execute(ExecutionEvent event) throws ExecutionException { - String commandId = event.getCommand().getId(); - - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - SnykMessageDialog.showOkDialog(shell, commandId); + SnykIssueCache.getInstance().clearAll(); + ScanState.getInstance().clearAllScanStates(); + + IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + try { + toolView = (ISnykToolView) activePage.showView(SnykToolView.ID); + toolView.clearTree(); + toolView.refreshTree(); + } catch (PartInitException e) { + SnykLogger.logError(e); + return null; + } return null; } diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/CollapseTreeHandler.java b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/CollapseTreeHandler.java index 1fd678ed..99e28076 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/CollapseTreeHandler.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/CollapseTreeHandler.java @@ -4,28 +4,45 @@ import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; +import io.snyk.eclipse.plugin.utils.SnykLogger; import io.snyk.eclipse.plugin.utils.SnykMessageDialog; +import io.snyk.eclipse.plugin.views.snyktoolview.ISnykToolView; +import io.snyk.eclipse.plugin.views.snyktoolview.SnykToolView; public class CollapseTreeHandler extends AbstractHandler { + @Override public Object execute(ExecutionEvent event) throws ExecutionException { String commandId = event.getCommand().getId(); - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - SnykMessageDialog.showOkDialog(shell, commandId); - switch (commandId) { case "io.snyk.eclipse.plugin.commands.TreeCollapse": - // Implement behavior for command1 + getView().getTreeViewer().collapseAll(); break; case "io.snyk.eclipse.plugin.commands.TreeExpand": - // Implement behavior for command2 + getView().getTreeViewer().expandAll(); break; } return null; } + + public ISnykToolView getView() { + + IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + ISnykToolView toolView; + try { + toolView = (ISnykToolView) activePage.showView(SnykToolView.ID); + } catch (PartInitException e) { + SnykLogger.logError(e); + return null; + } + return toolView; + + } } \ No newline at end of file diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/EnableCodeQualityProductHandler.java b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/EnableCodeQualityProductHandler.java index 4cbad786..fd58ca3e 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/EnableCodeQualityProductHandler.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/EnableCodeQualityProductHandler.java @@ -2,17 +2,17 @@ import org.eclipse.ui.commands.IElementUpdater; -import io.snyk.eclipse.plugin.Activator; import io.snyk.eclipse.plugin.properties.preferences.Preferences; +import io.snyk.eclipse.plugin.utils.SnykIcons; public class EnableCodeQualityProductHandler extends BaseHandler implements IElementUpdater { public EnableCodeQualityProductHandler() { super(); - // TODO should we replace the filter button with a filter applied button icon? - iconEnabled = Activator.getImageDescriptor("/icons/oss.png"); - iconDisabled = Activator.getImageDescriptor("/icons/oss_disabled.png"); - preferenceKey = Preferences.ACTIVATE_SNYK_OPEN_SOURCE; + + iconEnabled = SnykIcons.CODE; + iconDisabled = SnykIcons.CODE_DISABLED; + preferenceKey = Preferences.ACTIVATE_SNYK_CODE_QUALITY; } } \ No newline at end of file diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/EnableCodeSecurityProductHandler.java b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/EnableCodeSecurityProductHandler.java index a14cbe31..c8fc80f3 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/EnableCodeSecurityProductHandler.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/EnableCodeSecurityProductHandler.java @@ -2,16 +2,16 @@ import org.eclipse.ui.commands.IElementUpdater; -import io.snyk.eclipse.plugin.Activator; import io.snyk.eclipse.plugin.properties.preferences.Preferences; +import io.snyk.eclipse.plugin.utils.SnykIcons; public class EnableCodeSecurityProductHandler extends BaseHandler implements IElementUpdater { - + public EnableCodeSecurityProductHandler() { super(); - // TODO should we replace the filter button with a filter applied button icon? - iconEnabled = Activator.getImageDescriptor("/icons/code.png"); - iconDisabled = Activator.getImageDescriptor("/icons/code_disabled.png"); + + iconEnabled = SnykIcons.CODE; + iconDisabled = SnykIcons.CODE_DISABLED; preferenceKey = Preferences.ACTIVATE_SNYK_CODE_SECURITY; } diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/EnableIacProductHandler.java b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/EnableIacProductHandler.java index 41abf9fd..13442571 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/EnableIacProductHandler.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/EnableIacProductHandler.java @@ -2,16 +2,16 @@ import org.eclipse.ui.commands.IElementUpdater; -import io.snyk.eclipse.plugin.Activator; import io.snyk.eclipse.plugin.properties.preferences.Preferences; +import io.snyk.eclipse.plugin.utils.SnykIcons; public class EnableIacProductHandler extends BaseHandler implements IElementUpdater { - + public EnableIacProductHandler() { super(); - // TODO should we replace the filter button with a filter applied button icon? - iconEnabled = Activator.getImageDescriptor("/icons/iac.png"); - iconDisabled = Activator.getImageDescriptor("/icons/iac_disabled.png"); + + iconEnabled = SnykIcons.IAC; + iconDisabled = SnykIcons.IAC_DISABLED; preferenceKey = Preferences.ACTIVATE_SNYK_IAC; } diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/EnableOssProductHandler.java b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/EnableOssProductHandler.java index 72e766d4..c7a7f1b0 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/EnableOssProductHandler.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/EnableOssProductHandler.java @@ -2,16 +2,16 @@ import org.eclipse.ui.commands.IElementUpdater; -import io.snyk.eclipse.plugin.Activator; import io.snyk.eclipse.plugin.properties.preferences.Preferences; +import io.snyk.eclipse.plugin.utils.SnykIcons; public class EnableOssProductHandler extends BaseHandler implements IElementUpdater { - + public EnableOssProductHandler() { super(); - // TODO should we replace the filter button with a filter applied button icon? - iconEnabled = Activator.getImageDescriptor("/icons/oss.png"); - iconDisabled = Activator.getImageDescriptor("/icons/oss_disabled.png"); + + iconEnabled = SnykIcons.OSS; + iconDisabled = SnykIcons.OSS_DISABLED; preferenceKey = Preferences.ACTIVATE_SNYK_OPEN_SOURCE; } diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterCriticalHandler.java b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterCriticalHandler.java index 02f14a9d..2668603a 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterCriticalHandler.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterCriticalHandler.java @@ -2,16 +2,16 @@ import org.eclipse.ui.commands.IElementUpdater; -import io.snyk.eclipse.plugin.Activator; import io.snyk.eclipse.plugin.properties.preferences.Preferences; +import io.snyk.eclipse.plugin.utils.SnykIcons; public class FilterCriticalHandler extends BaseHandler implements IElementUpdater { public FilterCriticalHandler() { super(); - // TODO should we replace the filter button with a filter applied button icon? - iconEnabled = Activator.getImageDescriptor("/icons/severity-critical.png"); - iconDisabled = Activator.getImageDescriptor("/icons/severity-critical.png"); + + iconEnabled = SnykIcons.SEVERITY_CRITICAL; + iconDisabled = SnykIcons.SEVERITY_CRITICAL; preferenceKey = Preferences.FILTER_CRITICAL; } diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterDeltaAllIssuesHandler.java b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterDeltaAllIssuesHandler.java index efa236a2..8afccb88 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterDeltaAllIssuesHandler.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterDeltaAllIssuesHandler.java @@ -2,16 +2,15 @@ import org.eclipse.ui.commands.IElementUpdater; -import io.snyk.eclipse.plugin.Activator; import io.snyk.eclipse.plugin.properties.preferences.Preferences; +import io.snyk.eclipse.plugin.utils.SnykIcons; public class FilterDeltaAllIssuesHandler extends BaseHandler implements IElementUpdater { public FilterDeltaAllIssuesHandler() { super(); - iconEnabled = Activator.getImageDescriptor("/icons/enabled.png"); - // iconDisabled = Activator.getImageDescriptor("/icons/severity-medium.png"); + iconEnabled = SnykIcons.ENABLED; preferenceKey = Preferences.FILTER_DELTA_ALL_ISSUES; } diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterDeltaOpenIssuesHandler.java b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterDeltaOpenIssuesHandler.java index a1923672..5feb60d7 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterDeltaOpenIssuesHandler.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterDeltaOpenIssuesHandler.java @@ -2,16 +2,15 @@ import org.eclipse.ui.commands.IElementUpdater; -import io.snyk.eclipse.plugin.Activator; import io.snyk.eclipse.plugin.properties.preferences.Preferences; +import io.snyk.eclipse.plugin.utils.SnykIcons; public class FilterDeltaOpenIssuesHandler extends BaseHandler implements IElementUpdater { public FilterDeltaOpenIssuesHandler() { super(); - iconEnabled = Activator.getImageDescriptor("/icons/enabled.png"); - // iconDisabled = Activator.getImageDescriptor("/icons/severity-medium.png"); + iconEnabled = SnykIcons.ENABLED; preferenceKey = Preferences.FILTER_DELTA_OPEN_ISSUES; } diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterHighHandler.java b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterHighHandler.java index 1da6a0e5..96716a94 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterHighHandler.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterHighHandler.java @@ -2,16 +2,16 @@ import org.eclipse.ui.commands.IElementUpdater; -import io.snyk.eclipse.plugin.Activator; import io.snyk.eclipse.plugin.properties.preferences.Preferences; +import io.snyk.eclipse.plugin.utils.SnykIcons; public class FilterHighHandler extends BaseHandler implements IElementUpdater { public FilterHighHandler() { super(); - // TODO should we replace the filter button with a filter applied button icon? - iconEnabled = Activator.getImageDescriptor("/icons/severity-high.png"); - iconDisabled = Activator.getImageDescriptor("/icons/severity-high.png"); + + iconEnabled = SnykIcons.SEVERITY_HIGH; + iconDisabled = SnykIcons.SEVERITY_HIGH; preferenceKey = Preferences.FILTER_HIGH; } diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterIgnoresIgnoredIssuesHandler.java b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterIgnoresIgnoredIssuesHandler.java index 1a99e4a5..cc079537 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterIgnoresIgnoredIssuesHandler.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterIgnoresIgnoredIssuesHandler.java @@ -2,16 +2,15 @@ import org.eclipse.ui.commands.IElementUpdater; -import io.snyk.eclipse.plugin.Activator; import io.snyk.eclipse.plugin.properties.preferences.Preferences; +import io.snyk.eclipse.plugin.utils.SnykIcons; public class FilterIgnoresIgnoredIssuesHandler extends BaseHandler implements IElementUpdater { public FilterIgnoresIgnoredIssuesHandler() { super(); - iconEnabled = Activator.getImageDescriptor("/icons/enabled.png"); - // iconDisabled = Activator.getImageDescriptor("/icons/severity-medium.png"); + iconEnabled = SnykIcons.ENABLED; preferenceKey = Preferences.FILTER_IGNORES_IGNORED_ISSUES; } } \ No newline at end of file diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterIgnoresOpenIssuesHandler.java b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterIgnoresOpenIssuesHandler.java index 9572f64c..0ec99391 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterIgnoresOpenIssuesHandler.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterIgnoresOpenIssuesHandler.java @@ -2,16 +2,15 @@ import org.eclipse.ui.commands.IElementUpdater; -import io.snyk.eclipse.plugin.Activator; import io.snyk.eclipse.plugin.properties.preferences.Preferences; +import io.snyk.eclipse.plugin.utils.SnykIcons; public class FilterIgnoresOpenIssuesHandler extends BaseHandler implements IElementUpdater { public FilterIgnoresOpenIssuesHandler() { super(); - iconEnabled = Activator.getImageDescriptor("/icons/enabled.png"); - // iconDisabled = Activator.getImageDescriptor("/icons/severity-medium.png"); + iconEnabled = SnykIcons.ENABLED; preferenceKey = Preferences.FILTER_IGNORES_OPEN_ISSUES; } diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterLowHandler.java b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterLowHandler.java index 09ec78ce..3d359ba9 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterLowHandler.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterLowHandler.java @@ -2,16 +2,16 @@ import org.eclipse.ui.commands.IElementUpdater; -import io.snyk.eclipse.plugin.Activator; import io.snyk.eclipse.plugin.properties.preferences.Preferences; +import io.snyk.eclipse.plugin.utils.SnykIcons; public class FilterLowHandler extends BaseHandler implements IElementUpdater { - + public FilterLowHandler() { super(); - // TODO should we replace the filter button with a filter applied button icon? - iconEnabled = Activator.getImageDescriptor("/icons/severity-low.png"); - iconDisabled = Activator.getImageDescriptor("/icons/severity-low.png"); + + iconEnabled = SnykIcons.SEVERITY_LOW; + iconDisabled = SnykIcons.SEVERITY_LOW; preferenceKey = Preferences.FILTER_LOW; } diff --git a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterMediumHandler.java b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterMediumHandler.java index 5e44d860..84674cdc 100644 --- a/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterMediumHandler.java +++ b/plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterMediumHandler.java @@ -2,16 +2,16 @@ import org.eclipse.ui.commands.IElementUpdater; -import io.snyk.eclipse.plugin.Activator; import io.snyk.eclipse.plugin.properties.preferences.Preferences; +import io.snyk.eclipse.plugin.utils.SnykIcons; public class FilterMediumHandler extends BaseHandler implements IElementUpdater { - + public FilterMediumHandler() { super(); - // TODO should we replace the filter button with a filter applied button icon? - iconEnabled = Activator.getImageDescriptor("/icons/severity-medium.png"); - iconDisabled = Activator.getImageDescriptor("/icons/severity-medium.png"); + + iconEnabled = SnykIcons.SEVERITY_MEDIUM; + iconDisabled = SnykIcons.SEVERITY_MEDIUM; preferenceKey = Preferences.FILTER_MEDIUM; }