~ubuntu-branches/debian/sid/eclipse-cdt/sid

« back to all changes in this revision

Viewing changes to debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CollapseAllModulesAction.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2011-10-06 21:15:04 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20111006211504-8dutmljjih0zikfv
Tags: 8.0.1-1
* New upstream release.
* Split the JNI packages into a separate architecture dependent
  package and made eclipse-cdt architecture independent.
* Install JNI libraries into multiarch aware location
* Bumped Standards-Version to 3.9.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
7
 *
 
8
 * Contributors:
 
9
 * QNX Software Systems - Initial API and implementation
 
10
 *******************************************************************************/
 
11
package org.eclipse.cdt.debug.internal.ui.actions; 
 
12
 
 
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;
 
21
 
 
22
/**
 
23
 * The delegate for the "Collapse All" action of the Modules view.
 
24
 */
 
25
public class CollapseAllModulesAction extends ActionDelegate implements IViewActionDelegate {
 
26
 
 
27
        private IDebugView fView;
 
28
 
 
29
        /* (non-Javadoc)
 
30
         * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
 
31
         */
 
32
        public void init( IViewPart view ) {
 
33
                Assert.isLegal( view instanceof IDebugView );
 
34
                fView = (IDebugView)view;
 
35
        }
 
36
 
 
37
        /* (non-Javadoc)
 
38
         * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
 
39
         */
 
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 );
 
46
                }
 
47
        }
 
48
 
 
49
        private IDebugView getView() {
 
50
                return fView;
 
51
        }
 
52
}