1
/*******************************************************************************
2
* Copyright (c) 2004, 2007 QNX Software Systems and others.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* QNX Software Systems - Initial API and implementation
10
*******************************************************************************/
11
package org.eclipse.cdt.debug.internal.ui.actions;
13
import org.eclipse.core.runtime.Assert;
14
import org.eclipse.debug.ui.IDebugView;
15
import org.eclipse.jface.action.IAction;
16
import org.eclipse.jface.viewers.TreeViewer;
17
import org.eclipse.jface.viewers.Viewer;
18
import org.eclipse.ui.IViewActionDelegate;
19
import org.eclipse.ui.IViewPart;
20
import org.eclipse.ui.actions.ActionDelegate;
23
* The delegate for the "Collapse All" action of the Modules view.
25
public class CollapseAllModulesAction extends ActionDelegate implements IViewActionDelegate {
27
private IDebugView fView;
30
* @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
32
public void init( IViewPart view ) {
33
Assert.isLegal( view instanceof IDebugView );
34
fView = (IDebugView)view;
38
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
40
public void run( IAction action ) {
41
Viewer viewer = getView().getViewer();
42
if ( viewer instanceof TreeViewer ) {
43
viewer.getControl().setRedraw( false );
44
((TreeViewer)viewer).collapseAll();
45
viewer.getControl().setRedraw( true );
49
private IDebugView getView() {