33import org .eclipse .core .commands .AbstractHandler ;
44import org .eclipse .core .commands .ExecutionEvent ;
55import org .eclipse .core .commands .ExecutionException ;
6- import org .eclipse .swt .widgets .Shell ;
7- import org .eclipse .ui .IWorkbenchPage ;
8- import org .eclipse .ui .PartInitException ;
9- import org .eclipse .ui .PlatformUI ;
106
11- import io .snyk .eclipse .plugin .utils .SnykLogger ;
12- import io .snyk .eclipse .plugin .utils .SnykMessageDialog ;
13- import io .snyk .eclipse .plugin .views .snyktoolview .ISnykToolView ;
14- import io .snyk .eclipse .plugin .views .snyktoolview .SnykToolView ;
7+ import io .snyk .eclipse .plugin .SnykStartup ;
158
169public class CollapseTreeHandler extends AbstractHandler {
1710
@@ -22,27 +15,13 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
2215
2316 switch (commandId ) {
2417 case "io.snyk.eclipse.plugin.commands.TreeCollapse" :
25- getView ().getTreeViewer ().collapseAll ();
18+ SnykStartup . getView ().getTreeViewer ().collapseAll ();
2619 break ;
2720 case "io.snyk.eclipse.plugin.commands.TreeExpand" :
28- getView ().getTreeViewer ().expandAll ();
21+ SnykStartup . getView ().getTreeViewer ().expandAll ();
2922 break ;
3023 }
3124
3225 return null ;
3326 }
34-
35- public ISnykToolView getView () {
36-
37- IWorkbenchPage activePage = PlatformUI .getWorkbench ().getActiveWorkbenchWindow ().getActivePage ();
38- ISnykToolView toolView ;
39- try {
40- toolView = (ISnykToolView ) activePage .showView (SnykToolView .ID );
41- } catch (PartInitException e ) {
42- SnykLogger .logError (e );
43- return null ;
44- }
45- return toolView ;
46-
47- }
4827}
0 commit comments